View Single Post
Lawful_g
Senior Member
Volunteer Data File Contributor
 
Join Date: Mar 2007
Posts: 1,245

Old February 9th, 2011, 04:00 AM
Much, thank you.

You can use different math commands in HL scripts, I assume that it is 1/2 level, rounded down? You can use the round command.

round(EQUATION, #decimal places to round to, round up=1 or round down=-1)

In the equation you can use + and - as obvious. * means multiplication, and / means division.

So for this case it would be:

hero.childfound[xInitiate].field[Value].value += round(field[cTotalLev].value/2, 0, -1)

If there is a minimum of 1st level you will have to employ another command "maximum(X, Y)" which chooses the highest of the two. That will allow you to round down to 0, but still get 1. Remember you can nest commands inside one another. With a minimum of 1st level added it would look like this:

hero.childfound[xInitiate].field[Value].value += maximum(round(field[cTotalLev].value/2, 0, -1), 1)

I think that should work, though it is off the top of my head, so give it a test run first.
Lawful_g is offline   #34 Reply With Quote