Lone Wolf Development Forums  

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

Notices

Reply
 
Thread Tools Display Modes
ShadowWalker
Senior Member
 
Join Date: Jun 2014
Posts: 238

Old August 22nd, 2019, 12:01 PM
I have a game system that increases the cost of increasing skills as they level.
How can I set the value of the field advCost to current value of the skill + 2.

I've added code to the advance component using
perform gizmo.findchild[none,"Advance.Gizmo"].setfocus
and
perform gizmo.child[advDetails].setfocus

to access the skill that was selected and the first seems to work. Except that all the fields are default values. It doesn't seem to matter what the phase and priority are set to, the values come back default.
It just came to me that this won't work without saving the value of the skill at the time the advancement was added, or the order they are processed in is important.

I know this has to be possible since Shadowrun works this way.

Any ideas of the direction to go in would be greatly appreciated.

Thanks,

Shadowrun: Player and GM
Pathfinder: Player and GM

Shadowrun Adjustments: http://forums.wolflair.com/showthread.php?t=60633
ShadowWalker is offline   #1 Reply With Quote
Duggan
Senior Member
Volunteer Data File Contributor
 
Join Date: Nov 2009
Posts: 1,315

Old August 22nd, 2019, 04:19 PM
How does your advancement system work? Points? If so, you just need to calculate the cost of skills with a function based on the total.
Duggan is online now   #2 Reply With Quote
ShadowWalker
Senior Member
 
Join Date: Jun 2014
Posts: 238

Old August 22nd, 2019, 05:33 PM
Each skill costs what you are going to +1.
Buying a new skills costs 1, as you are going to a 0.
going to a 1 costs 2, 2 costs 3, and so on.
I see in the advance component where it is setting the resource picks resSpent, but I've no idea where to set advCost, which itself is static, but that is easy to change.
I thought I would put code in the advance component replacing the use of advCost but when I try to access the pick that has been selected it gives me values that are the default. I tried changing the timing of when the script is run but still get default values.
I'm thinking something needs to set advCost but I'm not sure where or how to do so.
What's worse there are three pools of points that are used in advancement not 1. Different things are increase from different pools.

Shadowrun: Player and GM
Pathfinder: Player and GM

Shadowrun Adjustments: http://forums.wolflair.com/showthread.php?t=60633
ShadowWalker is offline   #3 Reply With Quote
Duggan
Senior Member
Volunteer Data File Contributor
 
Join Date: Nov 2009
Posts: 1,315

Old August 22nd, 2019, 06:30 PM
Can you post your code? Or a link to it?
Duggan is online now   #4 Reply With Quote
ShadowWalker
Senior Member
 
Join Date: Jun 2014
Posts: 238

Old August 22nd, 2019, 07:13 PM
Okay I got it sort of working.
I was missing the linkage[basis] in the first incarnation of the code.
This gets the proper values, sort of.
If I add another advancement for the same skill both advancements get the latest skill value and cost out at that new value.
So if I go from not having the skill to having it costs correctly at 1 point.
As soon as I add the second advancement it costs 4, 2 for each. instead of 3. 1 and 2 respectively.

Code:
perform gizmo.findchild[none,"Advance.Gizmo"].setfocus
doneif (state.isfocus = 0)
perform focus.linkage[basis].setfocus
if (focus.tagis[Skill.?] <> 0) then
  var value as number
  value = focus.field[trtBonus].value
  if (focus.tagis[User.Combat] = 0) then
    var resLeft as number
    resLeft = #resmax[resAdvNCSP] - #resspent[resAdvNCSP]
    if (resLeft >= value) then
      #resspent[resAdvNCSP] += value
    elseif (resLeft > 0) then
      #resspent[resAdvSP] += value - resLeft
      #resspent[resAdvNCSP] += resLeft
    else
      #resspent[resAdvSP] += value
      endif
  else
    #resspent[resAdvSP] += value
    endif
  endif

Shadowrun: Player and GM
Pathfinder: Player and GM

Shadowrun Adjustments: http://forums.wolflair.com/showthread.php?t=60633

Last edited by ShadowWalker; August 22nd, 2019 at 07:19 PM.
ShadowWalker is offline   #5 Reply With Quote
ShadowWalker
Senior Member
 
Join Date: Jun 2014
Posts: 238

Old August 23rd, 2019, 02:12 PM
I was able to get this working by using the history in the field.
In the above script I count the number of items in the history.
Compare it to the value of the field.
At the end of the script I attach a tag to the pick being advanced.
That way I can tell how many times the script has already run and I can then get the right cost.
If anyone can tell me a better way to do this please do. Thankfully the game only has 5 levels in skills. So this runs quick.

Shadowrun: Player and GM
Pathfinder: Player and GM

Shadowrun Adjustments: http://forums.wolflair.com/showthread.php?t=60633
ShadowWalker is offline   #6 Reply With Quote
ShadowWalker
Senior Member
 
Join Date: Jun 2014
Posts: 238

Old August 30th, 2019, 01:25 PM
Ok. So After much digging and guess work I figured out how to do this.
I changed advCost to derived and persistence full.
I then added a change script to advNew and advBoost in form_advance.
The change script gets called only once and calculates the cost and stores that value in the now persistent advCost field.
Within the advance component I can now use the advCost field to assign cost to the correct pool of advancement points.

Shadowrun: Player and GM
Pathfinder: Player and GM

Shadowrun Adjustments: http://forums.wolflair.com/showthread.php?t=60633
ShadowWalker is offline   #7 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 11:15 AM.


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