Thread: d6 Star Wars
View Single Post
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old February 4th, 2014, 08:07 AM
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>
The advCost field's defvalue is what's currently defining the cost of an advancement:
Code:
 
 
<!-- Number of advancement slots consumed -->
<field
  id="advCost"
  name="Cost"
  type="static"
  defvalue="1">
  </field>
So, if you want to change advCost to depend on sklRoll, then remove the defValue, and use a script to calculate advCost. Since sklRoll isn't calcualated until Final/5000, that's not good - All of the scripts on resources that test "have we spent exactly as many of this resource as we should" start at Final/1000, so you need to get in earlier than that.

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
Finally, move that calculation of #resspent[resAdvance] to slightly after your calculation of advCost.
Mathias is online now   #81 Reply With Quote