How do I properly load item stats?

Not favoritedFavorited Favorited 0 favourites
  • 5 posts
From the Asset Store
Custom Loading Icons to Enhance Your Loading Screens
  • Hello, everyone.

    I have a problem with reloading the game (after turning it off). It saves all item statistics in Array, and when upgrading or loading them, it loads the data.

    To confirm, I checked in DEBUG whether the AFFIX was actually stored in the Array and in the item itself. And this work

    Array:

    And Item:

    Also item in eq:

    When I use the UPGRADE option, the affix stats are added to the item and then to the hero's stats. But if I reload the game, it looks like an item with basic stats is created and that's it...

    This is what my LOADING SYSTEM looks like:

    And my Functions:

    UPDATE_UI

    UPDATE PLAYER STATS

    Maybe someone will notice something I can't see, because I'm slowly running out of ideas :P

    Tagged:

  • First thing to do is to debug this and see if it is actually picking the item. If you set something obscure on the 'pick last created item' you can see if it picked it. If it doesn't apply then it is because you are creating + picking in the same event, this doesn't always work in Construct and you have to wait til the next tick, so if this is the issue you can resolve by adding a small wait then pick last created item later or in a separate function.

  • Hey, I worked on it for a few days and managed to fix it, but only 50%...

    The change in the Update_UI function solved the problem on PC. When I play on my computer, the affixes in items are added correctly.

    But when I launch the game on my phone (I want the game to be mobile), everything breaks, and the stats don't add up to the item... I don't know what's causing this. I tried the wait option and pressed it wherever I could, but still nothing...

  • What were the changes ? Better if you come back and mention what was changed to fix it. Have you cleared cache on PC and tried it ? If it still works on PC after this like it is not using old data, then it might be just because the mobile device is slower and the arrays haven't loaded yet.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Okay, I found the solution to the problem. It turned out to be so simple that I'm embarrassed to admit I overlooked it :P

    When creating AFFIX, I set the name in Affix1 and the value of this affix in Affix1_Value in ARRAY, but I forgot to transfer this value to ARRAY in the place where the item had this value, so it worked when creating the item, but not when loading it, because ARRAY had information about AFFIX but did not assign it anywhere...

    Over 7 days of struggle...

Jump to:
Active Users
There are 0 visitors browsing this topic (0 users and 0 guests)