• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Trigger for bonus stats not working

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,337
Hi,

I tried using the binary count off system for bonus stats (attack speed, spell resistance, and mana). The only one that seems to work is attack speed--the rest don't stack or fail to.

But before that, I use the manual of health tome to give permanent health bonuses. In this function below, I should be adding one manual of health tome (+1 health) every call, so my total hero's health should increase by +100 after 100 calls to this function. This works, but as soon as I add an additional stat to the loop (spell resistance), my hero gains 7 less health everytime. This doesn't make any sense, because the loop structure is the SAME as for attack speed, I just copied and pasted and replaced the names.

So why is this function producing the correct health (+100) but the extended one failing to do so (it adds only 93 health and not 100, even though I call it 100 times).
 
Last edited:
Level 15
Joined
Aug 7, 2013
Messages
1,337
Well I tried changing that value but still same result.

But interestingly (and again this just doesn't make any sense) if I add this line inside the elseif for HP I get 8 less health rather than 7.

JASS:
 set gain = (newPts / attrRatio[cntNum]) - (attrPts[cntNum] / attrRatio[cntNum])

Quite frustrating...
 
well, that means something in the calculations or in the variable values that are wrong... which is where debug messages can come in handy...

I really find it nice and helpful to put debug messages first to see which part is wrong... and it could help you fix it on your own too

for this, you probably want to put debug messages before each if-checks to see the values for yourself
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
well, that means something in the calculations or in the variable values that are wrong... which is where debug messages can come in handy...

I really find it nice and helpful to put debug messages first to see which part is wrong... and it could help you fix it on your own too

for this, you probably want to put debug messages before each if-checks to see the values for yourself

Well I was thinking that, but the calculations work out fine, except when adding that additional elseif case. And since I can't see how it interacts with the other variables to affect the final outcome of the total health gained, I'm quite confused.

I'll need to look up a tutorial for debug message.
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
Alright I think I solved it. It looks like I got caught in a few infinite loops, which prevented the rest of the health from being calculated. That's my only hunch, otherwise it's a mystery (because health should always finish b4 any infinite loop starts), but I guess they add up and prevent further computation.
 
Alright I think I solved it. It looks like I got caught in a few infinite loops, which prevented the rest of the health from being calculated. That's my only hunch, otherwise it's a mystery (because health should always finish b4 any infinite loop starts), but I guess they add up and prevent further computation.

That is why you need to put debug messages so we can see where it stops...
 
Status
Not open for further replies.
Top