Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,207
|
Here's the piece of code (in advancement.core) that places the final advance cost on the resource that's storing all the advancement costs:
Code:
<!-- Each advancement consumes its cost in accrued advances --> <eval index="1" phase="Setup" priority="5000"><![CDATA[ #resspent[resAdvance] += field[advCost].value ]]></eval> Code:
<!-- Number of advancement slots consumed --> <field id="advCost" name="Cost" type="static" defvalue="1"> </field> My recommendation: move the calculation of sklRoll to slightly after Calc trtFinal. Then, add a new script in the CanAdvance component in advancement.core to calculate advCost. Now, that needs some complex code in order to deal with the gizmo, so here's a simple example: Code:
if (tagis[Advance.Increase] <> 0) then origin.parent.field[advCost].value = linkage[basis].field[sklRoll].value * some multiplier elseif (tagis[Advance.AddNew] <> 0) then origin.parent.field[advCost].value = the cost of gaining level 1 in something endif |
#81 |
Member
Join Date: Oct 2013
Posts: 30
|
Thanks! That helps point me in the right direction. I think I have already done a few changes to how and where advCost gets calculated, so hopefully combining that with your suggestions will get me closer
|
#82 |
Member
Join Date: Oct 2013
Posts: 30
|
A couple of clarifications
Should the type for "advCost" be "static" or "derived" In the CanAdvance component in advancement core, should the script be an "Eval" or a "Calculate"? Right now I have advCost set to be "derived" and have an Eval Script. It didn't seem to be recognizing the Advance.Increase tag so I'm using Advance.Gizmo. I still have the problem of it recalculating the cost when I add a new advancement. I'll double check the ordering of my scripts again. Code:
<eval index="5" phase="Traits" priority="5500"><![CDATA[ if (tagis[Advance.Gizmo]<> 0) then origin.parent.field[advCost].value = round(linkage[basis].field[sklRoll].value/3, 0, -1) debug "NEW advCost: " & origin.parent.field[advCost].value debug "NEW sklRoll: " & linkage[basis].field[sklRoll].value elseif (tagis[Advance.AddNew] <> 0) then origin.parent.field[advCost].value = 1 endif ]]></eval> |
#83 |
Member
Join Date: Oct 2013
Posts: 30
|
Here is what the code in "trtFinal" currently looks like:
Code:
<!-- Final value for the trait --> <field id="trtFinal" name="Final Value" type="derived"> <!-- Calculate the final value from the three distinct pieces --> <calculate phase="Traits" priority="3000" name="Calc trtFinal"><![CDATA[ ~Note! If you change this calculation, you may need to change the similar ~ calculation in the "Derived" component. if (tagis[component.Attribute] = 1) then @value = field[trtTemplat].value + field[trtUser].value + field[trtInPlay].value ~Brent changed calculation ~@value = field[trtMinimum].value + field[trtUser].value + field[trtInPlay].value ~@value = field[trtUser].value + field[trtInPlay].value else @value = field[trtUser].value + field[trtBonus].value + field[trtInPlay].value + field[trtTemplat].value endif if (compare(field[trtAbbrev].text,"Barg")=0) then debug "Calculate in Final Value " & field[trtAbbrev].text & ": " & @value endif ]]></calculate> </field> Code:
Creation date: Creation date: ********** Start Evaluation Cycle ********** AdvTarget: 0 AdvReal: 20140125 AdvNote:s AdvTarget: 0 AdvReal: 20140125 AdvNote:s Eval 1 in thing resAdvance Advancing Gizmo from CanAdvance0 Advancing Gizmo from CanAdvance0 Eval 4 for CanAdvance Eval 4 for CanAdvance Calculate in Final Value Barg: 2 Calculate in Final Value Barg: 1 Calculate in Final Value Barg: 0 Calculate in Final Value Barg: 0 Calculate in sklRoll field Barg0 Calculate2 in sklRoll field Barg11 Calculate in sklRoll field Barg0 Calculate2 in sklRoll field Barg10 Calculate in sklRoll field Barg0 NOT IN HERO - sklRoll Calculate2 in sklRoll field Barg0 Calculate in sklRoll field Barg0 NOT IN HERO - sklRoll Calculate2 in sklRoll field Barg0 NEW advCost: 3 NEW sklRoll: 11 NEW advCost: 3 NEW sklRoll: 11 Eval 1 in thing advBSkill AdvCost4: 3 AdvCost5: 3 Eval 1 End in thing advBSkill Eval 1 in thing advBSkill AdvCost4: 3 AdvCost5: 3 Eval 1 End in thing advBSkill res Max(afterMove): 54 Eval 3 in sklRoll field phase Traits 11 Eval 3 in sklRoll field phase Traits 10 Eval 3 in sklRoll field phase Traits 0 NOT IN HERO Eval 3 in sklRoll field phase Traits 0 NOT IN HERO AdvCost*: 3 AdvCost*: 3 field[livename]: Bargain field[livename]: Bargain Eval 4 in sklRoll field phase Traits Bargain11 Eval 4 in sklRoll field phase Traits Bargain: Droids10 Eval 4 in sklRoll field phase Traits Bargain0 Eval 4 in sklRoll field phase Traits Bargain0 Finalize in Add Item |
#84 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,207
|
Static fields may not be changed during use - they're set by the game system and then never changed again - you want a different advCost in each case, so you need a derived field.
Calculate and eval scripts are pretty much the same thing. Just that calculate scripts are attached to a specific field, and their designed purpose is to calculate the value of that field. They normally shouldn't be used to change anything other than that field. |
#85 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,207
|
Check around post 102 or so of this thread: http://forums.wolflair.com/showthrea...dvCost&page=10 for an existing discussion of this issue.
|
#86 |
Member
Join Date: Oct 2013
Posts: 30
|
Thanks, I'll take a look at that
|
#87 |
Member
Join Date: Oct 2013
Posts: 30
|
Another question
My Advancement is linked to a Skill, and that Skill is linked to an Attribute From within my Advancement Gizmo, is there any way to get to a field in the Attribute. I'd like to get to it at the point below where it says "debug "In Gizmo" I believe linkage[basis] would get me access to the Skill fields but not the attribute fields Code:
<!-- Net final roll that includes the value of the linked attribute --> <field id="sklRoll" name="Net Skill Roll" type="derived"> <calculate phase="Traits" priority="5000" name="Calc sklRoll"> <after name="Calc trtFinal"/><![CDATA[ ~only access the linkage if the skill is directly on the hero; if not, it is ~likely within an advancement gizmo and no linkage will exist there if (compare(field[trtAbbrev].text,"Barg")=0) then debug "Calculate in sklRoll field " & field[trtAbbrev].text & @value endif if (container.ishero <> 0) then @value = field[trtFinal].value + linkage[attribute].field[trtFinal].value + linkage[attribute].field[trtRacial].value + field[trtRacial].value else debug "NOT IN HERO - sklRoll" if (tagis[Advance.Gizmo] <> 0) then debug "In Gizmo " & origin.parent.field[advOrder].value endif endif if (compare(field[trtAbbrev].text,"Barg")=0) then debug "Calculate2 in sklRoll field " & field[trtAbbrev].text & @value endif ]]></calculate> </field> <!-- Each skill is associated with a specific attribute that must be identified --> <linkage linkage="attribute" optional="no"/> <linkage linkage="skill" optional="yes"/> |
#88 |
Senior Member
Volunteer Data File Author
Join Date: Feb 2009
Posts: 173
|
Have you tried something like:
Code:
if (origin.parent.isgizmo <> 0) then var thisid as string thisid = "Skill." & idstring debug "In Gizmo " & origin.parent.gizmo.firstchild[thisid].linkage[attribute].field[trtFinal].value endif Last edited by Kairos; February 5th, 2014 at 06:51 PM. |
#89 |
Member
Join Date: Oct 2013
Posts: 30
|
I ended up adding an additional field to the Skill and storing the value I was looking for in there, but I'll give your suggestion a try too, just to see if it works
|
#90 |
Thread Tools | |
Display Modes | |
|
|