• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Reducing a stat, but not below a value

Illyahr

Well-known member
Working on a template that reduces some stats, but not below 3. I think I have the right code, but it isn't working.

Code:
var intval as number
intval = minimum(hero.child[aINT].field[aNormal].value-3,6)
hero.child[aINT].field[aNormal].value -= intval

It should check what attribute-3 is and apply either that (making the score 3) or 6 as a penalty to the attribute. What am I doing wrong?
 
Working on a template that reduces some stats, but not below 3. I think I have the right code, but it isn't working.

Code:
var intval as number
intval = minimum(hero.child[aINT].field[aNormal].value-3,6)
hero.child[aINT].field[aNormal].value -= intval

It should check what attribute-3 is and apply either that (making the score 3) or 6 as a penalty to the attribute. What am I doing wrong?

Hard to say without knowing your results or doing some testing. I might suggest a different approach, though. Something like this, perhaps:

Code:
var intval as number
intval = hero.child[aINT].field[aNormal].value-6
hero.child[aINT].field[aNormal].value = maximum(intval,3)
 
Ok, what I have is:

Code:
Phase=Preattributes, Priority=10000
var intval as number

intval = hero.child[aINT].field[aNormal].value-3
intval = minimum(intval,6)

hero.child[aINT].field[aNormMod].value -= intval

At this timing, it calculates Int as 0 and, consequently, comes back with -3. It then subtracts -3 from your score, adding 3. I've tried playing around with timing, but if I try it after the Pre-attributes phase, the code doesn't add or subtract anything. I'm at a loss here.
 
Quick pointers, i hope they help

If Phase is Pre-Attributes, attributes have not yet been determined, so you cannot manipulate them. Timing should be later (Post attributes?)

minimum(interval,6) would return the lowest value between int-3 and 6, which doesn't sound like what you're gunning for here. Use maximum (int-3,3) instead
 
minimum(interval,6) would return the lowest value between int-3 and 6, which doesn't sound like what you're gunning for here. Use maximum (int-3,3) instead

It actually is. I was trying to find whichever was lower, int-3 or 6, and applying that as a modifier to the final score
 
Back
Top