# How do I base item stats on level on drop?

0 favourites
• 22 posts
From the Asset Store
Hand-animated Sprite Base for isometric game/animation development
• There are different ways to do it. You could have the weapon choose(1,2,3), if 1 is chosen then it is a +strength item, if it is a +strength item then you pick a random value for the strength variable of the weapon i.e. strength=random(1,5), then if 3 is chosen its strength is 3, hence a +3 strength item. Then when the player equips this weapon, wherever the equip logic is, you add weapon.strength to player.strength so it'll be player.strength+3. You could actually put logic in to cover all values for all weapons at this point, since dex and vit will be +0.

So on any equip weapon:

player.str = player.str+weapon.str = player.str+3

player.vit = player.vit+weapon.vit = player.vit+0

player.dex = player.dex+weapon.dex = player.dex+0

You can advance this further later on by choosing multiple initial numbers and assigning negative values so you can gain strength and lose vitality on weapon equip.

• There are different ways to do it. You could have the weapon choose(1,2,3), if 1 is chosen then it is a +strength item, if it is a +strength item then you pick a random value for the strength variable of the weapon i.e. strength=random(1,5), then if 3 is chosen its strength is 3, hence a +3 strength item. Then when the player equips this weapon, wherever the equip logic is, you add weapon.strength to player.strength so it'll be player.strength+3. You could actually put logic in to cover all values for all weapons at this point, since dex and vit will be +0.

So on any equip weapon:

player.str = player.str+weapon.str = player.str+3

player.vit = player.vit+weapon.vit = player.vit+0

player.dex = player.dex+weapon.dex = player.dex+0

You can advance this further later on by choosing multiple initial numbers and assigning negative values so you can gain strength and lose vitality on weapon equip.

Correct, was my first idea - BUT since we have item stats display, then its bad if it displays 'dex 0, vit 0, str 3' Makes no sense :/

However, choose 1,2,3 how is that done? Varaible on the weapon or?

• It makes some sense if it says +0, +0, +3, -1 in my opinion but you can choose to display whatever you want. Yes you can assign it to an instance variable on the weapon when it is created if you want.

• ## Try Construct 3

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

Construct 3 users don't see these ads
• It makes some sense if it says +0, +0, +3, -1 in my opinion but you can choose to display whatever you want. Yes you can assign it to an instance variable on the weapon when it is created if you want.

No i mean the text display to the player when hovering over the item with the mouse.

If it said;

Str+3

Dex+0

Vit+0

It seems weird xD - better it says

Str+3

Dex+1

-Done-

• Yes you can choose not to display values that are 0 but these are all just minor tweaks, no need to continue this thread really I would go on and test it out and come back if you require any major assistance.

• You are probably looking to use an array inventory, complex at first but useful once you know how. Check out the manual and some tutorials on how to create an inventory from arrays. If you pick up an item that's on the ground you would then add it to a slot in the array. The array can store the stats of the item etc

Its usually better to decouple your item data from c2 objects. The c2 sprite should just be the handle that references the 'item' in the data structure, then you can pull data out for when you need it.

• > You are probably looking to use an array inventory, complex at first but useful once you know how. Check out the manual and some tutorials on how to create an inventory from arrays. If you pick up an item that's on the ground you would then add it to a slot in the array. The array can store the stats of the item etc

>

Its usually better to decouple your item data from c2 objects. The c2 sprite should just be the handle that references the 'item' in the data structure, then you can pull data out for when you need it.

Yep I didn't really expand on the arrays after saying look at tutorials. This thread quickly became less about an inventory storage and more about assigning variables to loot items you pick up in an action RPG type game.

• 22 posts