Lone Wolf Development Forums EABA Powers (Scripting question)
 Register FAQ Members List Search Today's Posts Mark Forums Read

 Notices 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

Senior Member

Join Date: May 2013
Posts: 1,457

April 9th, 2019, 07:33 PM
I've started yet another project that I'm not sure if I'll make it through, but for now, I'm wondering if I could get some scripting help.

If I'm reading the rules correctly, each power costs 1 point to add to the character. After that, every point spent raises the power level by 2. So in the portal, I set the incrementer to have an interval of 2, and that's working fine. But I'm having trouble calculating the point cost.

The script I'm using is below, and this is what's happening.
I add a power. Now I'm left with 9 power points. (This is correct so far.)
Now I increment the power level. It goes from 1 to 3. (This is also correct.)
The problem is, I still have 9 power points. Going from 1 to 3 doesn't subtract a point from my resources.
After that, it works fine. Going from 3 to 5 subtracts 1 point, then 5 to 7 and so on.

I've tried different ways of coding the script, but I can't get it to work how I want.

And yes, I sometimes miss obvious things.

Code:
```    <!-- Each power that is added by the user costs 1 point
Each point spent after that buys 2 points.
-->
<eval index="1" phase="Setup" priority="5000"><![CDATA[
~we must ignore bootstrapped abilities from races and abilities added via advances
if (isuser + origin.ishero >= 2) then
var uval as number
var cost as number
uval = field[trtUser].value

cost = (uval - 1) / 2
if (cost < 1) then
cost = 1
endif

hero.child[resPP].field[resSpent].value += cost
endif
]]></eval>```
#1