Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Shadowrun stores the calculated cost in a field - trtAdvCost, and the calculations of that field's value is inbetween the if...elseif and the final line in the original script. You can replace what's there with whatever calculations are needed for your game.
|
#11 |
Member
Join Date: Apr 2014
Posts: 50
|
I had similar code but in other component:
Code:
<component id="CanAdvance" name="Can Advance" ispublic="no"> <!-- Each advancement needs its own identity tag to support denial of duplicate advancements --> <identity group="IsAdvance"/> <!-- Each advancement needs its own identity tag to restrict enhancement to existing advances --> <identity group="CanAdvance"/> <!-- All advancements need to displace themselves to the hero --> <displace target="hero">Helper.Displace</displace> <!-- Forward all advancement tags up to the containing gizmo. NOTE! Only do this when we're within an advancement gizmo and NOT the hero. --> <eval index="1" phase="Setup" priority="3000"><![CDATA[ if (tagis[Advance.Gizmo] <> 0) then perform forward[IsAdvance.?,origin] endif ]]></eval> <!-- Forward the advancement allowed tag up to the hero --> <eval index="2" phase="Setup" priority="3000"><![CDATA[ perform hero.setidentity[CanAdvance] ]]></eval> <!-- If this thing is unique, forward its identity advancement tag to the hero NOTE! This is needed to enable deny tags so we avoid adding an existing trait again. NOTE! We only need to do this for user-added things. --> <eval index="3" phase="Setup" priority="3000"><![CDATA[ if (isunique <> 0) then if (isuser <> 0) then perform hero.setidentity[IsAdvance] endif endif ]]></eval> <!-- If this is an increase, add one to the trait, and subtract one for a decrease --> <eval index="4" phase="Traits" priority="2000"><![CDATA[ ~we only worry about this on actual advances - not traits added at creation doneif (tagis[Advance.Gizmo] = 0) ~apply any appropriate increase or decrease for the linked trait ~Note: This pick is a child of the gizmo and our parent pick is the actual "Advance" ~ pick that contains the appopriate "Advance" tag, so be sure to check there. ~Note: Since the advancement is displaced to the hero, it's "parent" is *not* the ~ gizmo, so we must explicitly reference through the "origin" container. if (origin.parent.tagis[Advance.Increase] > 0) then linkage[basis].field[trtAdv].value += 1 ~linkage[basis].field[trtBonus].value += 1 elseif (origin.parent.tagis[Advance.Decrease] > 0) then linkage[basis].field[trtAdv].value -= 1 ~linkage[basis].field[trtBonus].value -= 1 endif ]]></eval> </component> |
#12 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Looks like it's just a matter of modifying script #4 in that code - add some more lines to the end after you increase trtAdv that calculate the cost.
|
#13 |
Member
Join Date: Apr 2014
Posts: 50
|
I tried to just move the script which calculate the cost to that component, but it seams that it mess up something with advancing abilities which uses other resources.
Anyway you gave me some clues how could I make it different -I'll make some test. Thanks |
#14 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Remember to consider the order scripts will execute in - in the Skeleton files, the script that adds the cost of an advancement to the resource:
Code:
<!-- Each advancement consumes its cost in accrued advances --> <eval index="1" phase="Setup" priority="5000"><![CDATA[ #resspent[resAdvance] += field[advCost].value ]]></eval> The change I'm having you make means that the calculation of the cost doesn't happen until Traits/2000 - later than Setup/5000. So, you'll also need to change the timing of the script that records the cost on the resource so that it happens after you calculate the cost, instead of before. |
#15 |
Member
Join Date: Apr 2014
Posts: 50
|
Yeah, I have made it work, but after that I realized that adding a skill in advancement (as "gain new skill") complicates things and then I've made some test with adding a new incrementer for advancement but after that I moved that incrementer to skill tab instead of advancement tab, so right now I have a skill in skill tab with two incrementers - one for creation and one for advancement - it is not related to advancement mode but right now it works.
Thanks for help. |
#16 |
|
|