• 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

Advancement question

ShadowWalker

Well-known member
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,
 
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.
 
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.
 
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
 
Last edited:
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.
 
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.
 
Back
Top