rodrigorhardt's Forum Posts

  • Hi y'all!

    I'm saving my variables such as player inventory, player attributes, experience table, monsters description (loot, gold drop, etc) and I'm using the AJAX plug in to load them.

    I work with multiple layouts, so everytime a layout starts or is suspended/closed, I have to load/save the new infos into the arrays. I have json files for every array/dictionary and save it there.

    Everything was going well, until I add the new player inventory array. I have a variable AJAX_Loading to check if everything was loaded, and exactly on this new array, it's crashing up. If I delete this, it starts working. Also, if I clean the local storage, it works, but for once only. Then, when I save it changing or suspending the layout, the next time, it won't load.

    So, does anybody have any clue on what is going on here? What am I doing wrong?

    Here is my code:

    Thank you so much for your help! :)

  • You do not have permission to view this post

  • It worked, guys!!!

    Thank you so much!!!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • First of all, thanks for the replies! :)

    I agree with you guys, but it will be a little weird to do like you guys said. I'll explain why:

    If I suspend the game while its Sunny, there is no chance that will be Snowy in the next hour, it's like a cycle, and every weather change has a probability to happe. For example: If it's sunny now, there is 50% chance that will remain Sunny, 40% chance that will be partly cloudy in the next hour and 10% that it will be windy. See the image below:

    So let's say that the player went 10 hours offline and then came back to the game... I need to calculate the probability based in this cycle for every hour. Do you guys have any suggestion on how to do that? Nothing comes in my mind when I think about it..

    Other ideia that may work here, is creating an online server/site/whatever and make a global weather for each city in the game, so I can "upload" from this repository the last 10 hours weather condition. What do you guys think? Is this possible? Or the other idea is more effective?

    Thank you so much!!

  • Let me clarify the problem:

    - I'm building a weather system that interfers in many aspects of the game.

    - The game is based on real-life elapsed time, for example: my character in the game is crafting a item that will take 10 real-life hours to finish, and the weather during this 10 hours will interfer in the item quality when it finishes.

    - The weather has a chance to change every hour IN THE GAME.

    - So, if I stay offline in this 10 hours, I need to know if it was 5 hours sunny and 5 were cloudy to determine the item quality. But since I capture a Timestamp when the game is suspended and another one when it's resumed, I just get the elapsed offline time, but not the weather changes.

    How can I keep this variables (the weather to keep changing and saving the elapsed time in each weather condition) changing offline?

    Thank you so much for reading this and helping me out! :)

  • This will help me a lot too!

  • Hi everyone! How you guys doing? :)

    Let me clarify the problem:

    I'm building a mobile app game, which many of the actions are based on real time, so when the App is suspended, I generate a timestamp that will be comapred with a new timestamp when the game is resumed, so I can get the "offline time".

    It's working perfectly when I switch tabs on my phone, but NOT when I lock the screen! When I lock the screen, the game remains like "paused", and the timestamps are not generated.

    So, is there any event option that I can use to trigger the 'screen locking'?

    Thank you so much for reading this and helping me out! <3