• 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

Question on Resource Pools

Ozob

Member
So I am trying to enter a new data file for AMP Year 1.

One of the concepts is that you have really three resource pools.
SP - Skill points
LP - Loyalty points
BP - Bonus points

So when you purchase a skill, it can come from SPs normally, but if you run out, you can use BPs as well.

Here is the code I was using:
~First is cost of 2
if (field[trtUser].value > 8) then
if (#resleft[resCP] < 2) then
hero.child[resBP].field[resSpent].value += (field[trtUser].value * 2) - 8
else
hero.child[resCP].field[resSpent].value += (field[trtUser].value * 2) - 8
endif
~Here are skills costing 1
else
if (#resleft[resCP] < 1) then
hero.child[resBP].field[resSpent].value += field[trtUser].value
else
hero.child[resCP].field[resSpent].value += field[trtUser].value
endif
endif


The behavior is that it always pulls out of the BP pool.

So the first question is why is the macro always testing to 0?

The second question is more complicated. I came to the realization that it is just calculating the value and not incrementing the resource variable. So is there a way to track values based on how I spend points? I realize my code does not do that, but I'm still considering how to implement it.
 
What I did in cases like this in Shadowrun was to put a script on the resource itself - SP calculates how many points it has, and then if it has excess, shunts the excess over to BP.
 
So in that case, would you use a common resource component? Or would you move it out to separate components?
 
Thanks for the tip! I was able to make it work with the following eval scripts placed in the Actor component:

<!-- If they have spent more CP than they have, translate it to BP -->
<eval index="1" phase="Traits" priority="11000"><![CDATA[
if (hero.child[resCP].field[resMax].value - hero.child[resCP].field[resSpent].value < 0) then
hero.child[resBP].field[resSpent].value += (hero.child[resCP].field[resSpent].value - hero.child[resCP].field[resMax].value)
hero.child[resCP].field[resSpent].value = hero.child[resCP].field[resMax].value
endif
]]></eval>

<!-- Now do the same for LP and BP -->
<eval index="2" phase="Traits" priority="11100"><![CDATA[
if (hero.child[resLP].field[resMax].value - hero.child[resLP].field[resSpent].value < 0) then
hero.child[resBP].field[resSpent].value += (hero.child[resLP].field[resSpent].value - hero.child[resLP].field[resMax].value)
hero.child[resLP].field[resSpent].value = hero.child[resLP].field[resMax].value
endif
]]></eval>


Both now properly translate to BP after they have spent the appropriate resource. Thanks for the help. I wanted to put this here so if people are searching they can find what the eventual solution was.
 
Last edited:
I would put those scripts on the CP and LP resources themselves, which are in thing_miscellaneous.dat, rather than on actor scripts. This is a script related to a particular thing, and in my experience, I like to have all the scripts related to a particular thing in one place, on that thing, so they're easier to find many months from now when I run into a bug in that thing.
 
Ah good thinking. I'm used to game programming where I want scripts relating to how an object works to be called as methods of that object. Moved and thank you. I'm sure a few months from now I'll be thanking you!
 
Back
Top