when i put thia in it levels but doesnt addf it multiplys
how do i fix it?
if(usr.Class == "Knight")
usr.Strength += rand(2,4) usr.Defense += rand(1,4)
usr.AGI += rand(1,2)
usr.DEX += rand(1,3)
usr.MAX_HP += rand(4,7)
usr.MAX_MP += rand(1,3)
usr.MAX_SP += rand(15)
ID:174237
Sep 12 2003, 3:21 am
|
|
Darkfirewolf5 wrote:
when i put thia in it levels but doesnt addf it multiplys What the hell?..I dont understand what do you mean, oh well. I think you want it do be multiplied? if you do this is the symbol you want: * |
In response to Wanabe
|
|
Iam sorry I hurt my wrist and i can really type
|
In response to Darkfirewolf5
|
|
I think he means that thats called probably pretty often and instead of it adding those values just once it adds em everytime basically constantly so its adding em multiple times so the stats just keep gettin higher and higher.
How to fix it would be not to use += if the proc that does it is called often like everytime you gain xp. The way Im doin it in my game is I have a tick() proc and it gets called every 10th of a second. In it I make sure all stats are set to what values theyre based off of. So if my MaxHp are spose to be based off my Str*2 then every tick it sets my MaxHp to my Str*2. Your usin random values so if you set it up like I got then your stats would change by those random values every tick and it wouldnt really be useful. I really dont have a good answer for ya short of dont use += for somethin thats called often. I would think about reworking how my stuff gets called and work from there. =( |
That's quite an accomplishment considering there's no multiplication operators anywhere in that snippet. Mayhap you showed us the wrong piece of code?
Lummox JR