How do I exchange stats on 'Equip' ?

0 favourites
  • 5 posts
  • Hey there! ^_^

    So im currently designing an 'Equip' system, and i need some advice on how to exchange the stats of the item, on the character when replacing the current item with a different item.

    Example;

    Say Hero has 'Dagger' equipped (+2 Strength and +1 Health)

    Player replaces 'Dagger' with a sword that has '+1 Strength and +5 Health.

    Now there are random stats on the items so doing a constant factor does not work, as a dagger may have 2 strength or 5 strength.

    Do we in this case save the stats of 'Equipped' Item, and deduct it from the Hero, THEN equip the Sword and add the stats to the Hero?

    How would that go? Thanks in advance! ^_^

  • One method would keep two separate stats for the player - base stats and equipment stats. Then you can just replace the equipment stat if you get new equipment. Any calculations done would simply add them together. This gives you more fine control over what stats are additive and multiplicative as well. However, this can be harder to implement if you have a lot of equipment categories modifying the same stats. You only have to do it once to set up the system though, and it should be flexible.

    An alternative is to subtract out the stats when you unequip as you mentioned, but to me that method raises immediate concerns about possible number bugs/mistakes that can be cumulative. Also if you have any stat modifiers more complex than straight addition and subtraction you will need to work backwards for those too.

  • One method would keep two separate stats for the player - base stats and equipment stats. Then you can just replace the equipment stat if you get new equipment. Any calculations done would simply add them together. This gives you more fine control over what stats are additive and multiplicative as well. However, this can be harder to implement if you have a lot of equipment categories modifying the same stats. You only have to do it once to set up the system though, and it should be flexible.

    An alternative is to subtract out the stats when you unequip as you mentioned, but to me that method raises immediate concerns about possible number bugs/mistakes that can be cumulative. Also if you have any stat modifiers more complex than straight addition and subtraction you will need to work backwards for those too.

    Hey there! Thanks for the reply! ^_^

    So basically we have 10 equipment slots. Each equipment slot needs a variable of what is equipped, example -

    ''Helm slot''

    Strength = X

    Dexterity = X

    Health = X

    Mana = X

    And so on....... And then when u equip, u will add to these variables the items stats and add them to the Heros stats.

    When u unequip, u subtrack the variable stats from the Hero stats, and replace the variable stats with the new item u equipped and add them to the Hero.

    Since we have alot of slots and items and stats, this will mean 10-15 variables for each slot. Is this really the easiest way to do it?

  • With that amount of slots and stats, it makes more sense to use a single array to keep track of each slots' stats seperately. Each x column can represent one stat, and each y row can be an equipment slot. Then with all the data available to you at any given time, you can apply the numbers however you like, and they are easily replaceable.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • With that amount of slots and stats, it makes more sense to use a single array to keep track of each slots' stats seperately. Each x column can represent one stat, and each y row can be an equipment slot. Then with all the data available to you at any given time, you can apply the numbers however you like, and they are easily replaceable.

    Yeh dont really know how to do that, thanks anyway ^_^

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