Senior Member
Volunteer Data File Contributor
Join Date: Aug 2009
Posts: 1,550
|
Grit is supposed to be set to 1 per character Rank. I've noticed that the Deadlands user file I'm currently using doesn't make this adjustment. I am trying to set up an Eval Script to make this adjustment automatically when the character's Rank changes. However, I can't get this to operate correctly. I am currently trying:
perform #traitadjust[trGrit,+,herofield[acRank].value,"Grit is 1 per Rank"] Phase: Final Priority: 1000 The documentation says that acRank is not available until after Final. I've tried hard-coding a number in the value field on the traitadjust macro, but it doesn't seem to work either. I can't get Grit to adjust at all. Is there a way to automate this, or should I just use the permanent adjustment screen to keep the Grit value current? |
#1 |
Senior Member
Volunteer Data File Contributor
Join Date: Aug 2009
Posts: 1,550
|
I've figured out when I can modify Grit - Priority 4000, Traits, After Derived trtFinal, Before Calc trtFinal. The problem is that according to the docs acRank is not available at this time.
|
#2 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 8,232
|
In the file "actor.str", you'll find the definition of the "acRank" field. This field has a Calculate script that determines the correct value, and it has a timing of Final/5000. Any value prior to that point in time is unreliable.
From looking at the above script, it specifies it must be after "Calc acFinalXP". The script with that name has a timing of Final/2000. This script only applies to NPCs, for which the XP must be estimated via some complex logic. That means that the value acRank will probably be valid earlier for PCs, but it will be invalid for NPCs. If you try your implementation for NPCs, I'm guessing the Grit will be wrong - probably zero. If you want everything to work correctly, the best timing for determining the Grit trait is after Final/5000. This will work for PCs *and* NPCs. Exploring this in further depth, look at the first Eval Script for the "Derived" component that is used for derived traits. It starts on line 480 in the file "traits.str". The comment above this script indicates that derived traits required a special calculation due to the need for the values depended upon to the stable. In the case of Grit, which relies on the Rank, the values depended upon are resolved even later. Consequently, your script should borrow the same basic logic when calculating the Grit. It should incorporate any Bonus, InPlay adjustment, and/or Penalty into the net calculation. Hope this helps... |
#3 |
Senior Member
Volunteer Data File Contributor
Join Date: Aug 2009
Posts: 1,550
|
Thanks, I'll check it out.
Another thing, though. The Guts skill is supposed to be modified by Grit, but it looks like that's not working right either. It's currently set to: perform #traitroll[skGuts,+,field[trtFinal].value,"Grit"] Phase: Traits Priority: 1000 Timing: Before Calc trtDisplay |
#4 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 8,232
|
The problem is a chicken-and-egg situation. Standard traits perform all their calculations during the Traits phase. However, Grit can't be reliably calculated until the Final phase, which occurs AFTER the Traits phase. Since Grit can't be reliably calculated until Final, it's not possible to apply the Grit adjustments as a bonus to Guts via the standard method.
It looks like you already recognized that issue based on your code above, since you're applying the adjustment directly to the "trtFinal" value instead of applying it to the "trtBonus" value. However, you're applying the adjustment during the Traits phase, which is BEFORE you've actually calculated the Guts in the Final phase. I recommend you simply perform the adjustment of Guts within the same script where you calculate the Grit. That way, you won't have to worry about the relative timing of those two operations - they will always occur at the same time. |
#5 |
Senior Member
Volunteer Data File Contributor
Join Date: Aug 2009
Posts: 1,550
|
Well, this one is in the user file as I received it, so I can't claim authorship of this one. Currently, Grit is assigned a base value of 1 and is never automatically adjusted, so I don't know where it's calculated, if it's calculated at all.
I'll see what I can come up with. Thanks for the rapid response! |
#6 |
Senior Member
Volunteer Data File Contributor
Join Date: Aug 2009
Posts: 1,550
|
OK, I've gotten the Rank to add to Grit:
field[trtFinal].value = field[trtBonus].value + field[trtInPlay].value + herofield[acNetPenal].value + herofield[acRank].value Phase: Final Priority: 6000 (it works at 5000, but I wanted to be sure it happened after the initial Grit calculation) I can't get the Guts modifier to show up even doing the adjustment in the same script as what's going on above. Is it what you said earlier, that modifier has already been figured? How do I get it to figure it again during Final? I've tried traitroll and traitadjust, using field[trtFinal].value, field[trtBonus].value and also being specific and using hero.childfound[trGrit].field[trtFinal].value. What am I missing? Last edited by CapedCrusader; June 5th, 2011 at 12:21 PM. |
#7 |
Senior Member
Volunteer Data File Contributor
Join Date: Aug 2009
Posts: 1,550
|
OK, for the Guts bonus, it shows up if I do it during Traits, it doesn't seem to matter what number I use between 1 and 9000.
The Rank-add to Grit only happens during Final after 5000. This makes sense, as that's when the derived values are generated. When you say "I recommend you simply perform the adjustment of Guts within the same script where you calculate the Grit.", how do I put those both into the same Eval Script but get them to fire correctly? If I set the timing to Traits, the skill bonus shows up but the Rank adjustment to Grit doesn't. If I set the timing to Final, the Rank adjustment appears but the Guts skill modifier doesn't. The code block looks like this: field[trtFinal].value = field[trtBonus].value + field[trtInPlay].value + herofield[acNetPenal].value + herofield[acRank].value perform hero.childfound[skGuts].field[trtRoll].modify[+,#traitfound[trGrit],"Grit"] or field[trtFinal].value = field[trtBonus].value + field[trtInPlay].value + herofield[acNetPenal].value + herofield[acRank].value perform hero.childfound[skGuts].field[trtRoll].modify[+,field[trtBonus].value + field[trtInPlay].value + herofield[acNetPenal].value + herofield[acRank].value,"Grit"] |
#8 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 8,232
|
Quote:
|
|
#9 |
Senior Member
Volunteer Data File Contributor
Join Date: Aug 2009
Posts: 1,550
|
OK, so I need to cheat and figure the Rank manually early enough to use it for the Guts skill modifier. Where can I access the character's XP value? I can't find where this is. My Windows search isn't locating it for some stupid reason. Here's my code block, I just need the XP value to plug into it...
var xp as number var rk as number xp = field[acFinalXP].value if (xp < 80) then rk = round(xp / 20,0,-1) else rk = 4 endif perform #traitroll[skGuts,+,rk,"Grit"] |
#10 |
|
|