Senior Member
Join Date: Jun 2014
Posts: 243
|
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 |
#1 |
Senior Member
Volunteer Data File Contributor
Join Date: Nov 2009
Posts: 1,505
|
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.
|
#2 |
Senior Member
Join Date: Jun 2014
Posts: 243
|
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 |
#3 |
Senior Member
Volunteer Data File Contributor
Join Date: Nov 2009
Posts: 1,505
|
Can you post your code? Or a link to it?
|
#4 |
Senior Member
Join Date: Jun 2014
Posts: 243
|
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. |
#5 |
Senior Member
Join Date: Jun 2014
Posts: 243
|
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 |
#6 |
Senior Member
Join Date: Jun 2014
Posts: 243
|
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 |
#7 |
Senior Member
Join Date: Jan 2007
Location: NW Arkansas
Posts: 1,336
|
Could you share your tables and scripts? Sounds like you're doing similar to what I am.....
Working on - |
#8 |
Thread Tools | |
Display Modes | |
|
|