Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Authoring Kit

Notices

Reply
 
Thread Tools Display Modes
Ozob
Junior Member
 
Join Date: Jul 2015
Posts: 8

Old July 19th, 2015, 01:06 PM
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.
Ozob is offline   #1 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old July 19th, 2015, 04:09 PM
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.
Mathias is online now   #2 Reply With Quote
Ozob
Junior Member
 
Join Date: Jul 2015
Posts: 8

Old July 19th, 2015, 05:26 PM
So in that case, would you use a common resource component? Or would you move it out to separate components?
Ozob is offline   #3 Reply With Quote
Ozob
Junior Member
 
Join Date: Jul 2015
Posts: 8

Old July 20th, 2015, 05:42 AM
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 by Ozob; July 20th, 2015 at 05:44 AM.
Ozob is offline   #4 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old July 20th, 2015, 07:37 AM
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.
Mathias is online now   #5 Reply With Quote
Ozob
Junior Member
 
Join Date: Jul 2015
Posts: 8

Old July 20th, 2015, 10:54 AM
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!
Ozob is offline   #6 Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 08:39 PM.


Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.