PDA

View Full Version : Grit/Rank adjustment


CapedCrusader
June 4th, 2011, 09:36 PM
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?

CapedCrusader
June 4th, 2011, 09:46 PM
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.

rob
June 4th, 2011, 10:09 PM
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...

CapedCrusader
June 4th, 2011, 10:14 PM
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

rob
June 4th, 2011, 10:26 PM
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.

CapedCrusader
June 4th, 2011, 10:43 PM
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!

CapedCrusader
June 4th, 2011, 11:55 PM
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?

CapedCrusader
June 7th, 2011, 08:57 PM
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"]

rob
June 9th, 2011, 11:15 AM
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.

Please ignore that suggestion. I completely spaced on the fact that the two operations need to occur at different timings. You definitely need two separate scripts, one for each operation and scheduled at the appropriate timing. Sorry for the confusion. :(

CapedCrusader
June 9th, 2011, 12:26 PM
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"]

rob
June 9th, 2011, 12:41 PM
The XP value is calculated in a script on the actor/hero, so you'll find that in the file "actor.str". Go to line 572. The first step of the script provides you with the shortcut you need to "cheat" - just pull the value from the resource. Unfortunately, if you check the timing of where the resource is calculated, it's also after when you need the value. So that means you'll need to replicate the logic of the refLeft calculation to properly "cheat". You'll find that script in "miscellaneous.str" on line 312.

Please note, however, that by cheating like this, you are essentially creating a house of cards due to chicken-and-egg problems. The adjustment will flat-out not work for NPCs. Plus, you are exposed to potential issues with timing for PCs as well that happen to rely on the established timing. The only way to properly solve this is to re-assess all the timings for the involved scripts. You can look through the timing report that Hero Lab generates to do this, but be aware that it will require a fair amount of thought to solve this properly.

Hope this helps. Please note that I jump on a plane in a few hours and will not be around again until Tuesday next week at the earliest. However, if you happen to be at PaizoCon this weekend, you can chase me down in the dealer room there and we can discuss this in more detail.

CapedCrusader
June 9th, 2011, 12:51 PM
::grin:: This is starting to sound like it's more trouble than it's worth for just a Guts skill adjustment.