rodrigorhardt's Recent Forum Activity

  • Hey Lionz!! Thank you for your response!! :)

    Hm, yes, I did share! It's in the same dictionary as the picked item (3rd image that I shared), and it's "code" is the number 2.

    So, I don't understand why the 'while' loop should not work properly as the 'for' loop, since both of them should find the empty slot.

    Also, ok, I could add the picked item to a global variable, but since it's a mobile app game, any layout suspension will need it to save this global variable. If I start adding global variable for everything, it will be a mess to save all of them, so that's why I use dictionaries and arrays. And I found many posts also recommending it, to use arrays and dictionaries instead of global variables, so I'm confused now! haha

    And sorry, the function thing, I didn't get it, is there any other way I can call the while without using functions? Or should I optimze it somehow?

    thank you again! :))

  • Hi y'all!

    I'm working on an inventory system and for some reason it's not updating the slots. I "pick" a item from other layout, set the key "PickedItem" in a Dictionary as the picked item, then I go back to the inventory and call a while expression to check the next empty slot (the inventory is in an array) and add this picked item there.

    But the problem is that it's not adding the item properly to the first empty slot. Actually it's not adding anywhere, it stays as the "PickedItem", the "PickedItem" slot never empties and the slots remains as 0.

    What is strange is that for some miliseconds, it works as it should: 0 for picked item, 2 in the slot 1 (uncommon medicine herb code), 0 in the slot 2 and slot 3 as well. But after this miliseconds, it gets back to the wrong structure showed bellow on the output image.

    So: what am I doing wrong!?

    Thank you so much for your time and for helping me!!! Really appreciate it :)

    Here is my code:

    Here is my inventory array:

    Here is my item list dictionary: (used to call the picked item code into the slot)

    Here is the Inventory Layout (dummy texts on the bottom to test it):

    Here is the output from the code:

  • Got it, guys!

    But my point is, is too much global variables to save and load everytime, also the arrays and dictionaries is way easier to refer to, where I can find values based on a (x,y) from the matrix.

    Also, my game has no animated layouts, is all based on actions that you call from a menu, so there is no global objects such as the player’s character, or npcs, monsters, etc.

    Question 1: If dictionaries and arrays are not the recommended plug in to use, what should I do?

    Question 2: How can I load an array/dic value twice, as you said AllanR?

    Thank you again! :)

  • 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

rodrigorhardt's avatar

rodrigorhardt

Member since 7 Dec, 2018

None one is following rodrigorhardt yet!

Trophy Case

  • 5-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

7/44
How to earn trophies