How do I base item stats on level on drop?

Get help using Construct 2

Post » Mon Feb 06, 2017 11:40 am

Hey there! ^_^
So bascially an item system like Diablo 3 or Borderlands - where when an item drops, its stats/dmg is based on the character
level WHEN it was dropped -> Lets say;

Hero is lvl 5 and a Broadsword drops, - then its stats are dependant on the Hero's level, in this case level 5.
But now the Hero gains lvl 6 or 7 - however the item stats should stay the same stats it was when it dropped (Hero lvl 5) -

Is it possible to do that? And in that case, how is it done?
B
5
S
1
Posts: 37
Reputation: 451

Post » Mon Feb 06, 2017 11:42 am

Broadsword has a 'level' instance variable. Character has a 'level' instance variable. On Broadsword created, Broadsword.level = Character.level.
B
46
S
16
G
78
Posts: 2,166
Reputation: 46,349

Post » Mon Feb 06, 2017 11:46 am

plinkie wrote:Broadsword has a 'level' instance variable. Character has a 'level' instance variable. On Broadsword created, Broadsword.level = Character.level.


Loool ur a smart one xD hoho -
And then an ItemText base for the weapon??
If Item lvl X = set text to X ?

Should i btw have same text for displaying dmg/stregth etc on the item, or 1 text for each variable?
B
5
S
1
Posts: 37
Reputation: 451

Post » Mon Feb 06, 2017 11:52 am

That's just for display purposes in a menu but yes I guess so, text can display broadsword.level. The variables will be whatever you need for the gameplay, if the damage and strength both matter to the gameplay then you will need them. The text can be displayed in one or separate textboxes depending on how you want your inventory to look.
B
46
S
16
G
78
Posts: 2,166
Reputation: 46,349

Post » Mon Feb 06, 2017 4:57 pm

plinkie wrote:That's just for display purposes in a menu but yes I guess so, text can display broadsword.level. The variables will be whatever you need for the gameplay, if the damage and strength both matter to the gameplay then you will need them. The text can be displayed in one or separate textboxes depending on how you want your inventory to look.


How about if i want a random stat on the weapon? Like strength or dexterity or vitality, 1 or 2 randomly??
Can that be done?
B
5
S
1
Posts: 37
Reputation: 451

Post » Mon Feb 06, 2017 5:22 pm

On weapon created, weapon.strength = choose(a,b,c) will give strength a value of a or b or c. The stats will just be instance variables, you add them to the object in the creator. You could create a family 'weapons' and add family instance variables such as name, level, strength, damage etc
B
46
S
16
G
78
Posts: 2,166
Reputation: 46,349

Post » Mon Feb 06, 2017 6:34 pm

plinkie wrote:On weapon created, weapon.strength = choose(a,b,c) will give strength a value of a or b or c. The stats will just be instance variables, you add them to the object in the creator. You could create a family 'weapons' and add family instance variables such as name, level, strength, damage etc


Hehe hey thanks alot for this response! ^_^
How would that work if i need to 'pick up' or 'equip' that item, i must destroy it and create an equal in bag? How would i transfer those stats to the new items?
B
5
S
1
Posts: 37
Reputation: 451

Post » Mon Feb 06, 2017 6:40 pm

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
B
46
S
16
G
78
Posts: 2,166
Reputation: 46,349

Post » Mon Feb 06, 2017 7:20 pm

plinkie wrote: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


So these stats created on drop on the item can be stored into the array?
B
5
S
1
Posts: 37
Reputation: 451

Post » Mon Feb 06, 2017 8:25 pm

B
46
S
16
G
78
Posts: 2,166
Reputation: 46,349

Next

Return to How do I....?

Who is online

Users browsing this forum: hrisnz and 9 guests