Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Savage Worlds

Notices

Reply
 
Thread Tools Display Modes
dartnet
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2007
Posts: 591

Old May 12th, 2009, 02:23 PM
Set a derived trait to have a score equal to rank (seasoned, veteran, etc)?
dartnet is offline   #1 Reply With Quote
rob
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 8,232

Old May 12th, 2009, 07:45 PM
OK. To do this will require chasing down through various timing dependencies within the data files. Let's do the analysis and see if it's possible to achieve this.

The rank is maintained within the "acRank" field on the Actor component. The problem is that the rank is calculated during the "Final" phase - see the field definition for "acRank" in "actor.str" and the corresponding Calculate script.

The reason the rank is calculated during the Final phase is because NPCs need to first calculate their estimated XP rating. This is done during the Final phase via the Eval script named "calc acFinalXP" on the Actor component.

The reason for the above is that the "resLeft" field on the Resource component is calculated during the Final phase. See the Calculate script on the field within the Resource component. This script relies on both the "resMax" and "resSpent" fields.

Searching through all uses of the "resMax" field in the data files, the latest timing where the field is assigned is at Traits/4500. This is in Eval script #1 of the "resEncumb" thing.

Searching through all uses of the "resSpent" field in the data files, the latest timing where the field is assigned is at Traits/10000. This is in Eval script #2 for both the "Attribute" and "Skill" components.

Looking at both places where the "resSpent" field is assigned at Traits/10000, they are both dependent on the bounding of the "trtUser" field, which occurs at Traits/1000. This means that the timing of these scripts can be moved to as early as Traits/1001. If we move those scripts to Traits/4500, then all of the pieces will be in place at Traits/4500.

Now we need to figure out whether that will be early enough for our needs. Looking at the "Derived" component, the final calculation of "trtFinal" occurs at a priority of Traits/6000 in Eval script #1.

This means that, if we move the above-mentioned scripts to Traits/4500, we have a window of opportunity after Traits/4500 and before Traits/6000 in which to calculate what we need. So we can safely change the timing of the Eval script that calculates the estimated XP rating for NPCs to something like Traits/5000. Then we can safely change the timing of the Calculate script on the Actor that determines "acRank" to something like Traits/5100. All of our dependencies should remain satisfied with these changes.

At this point, we have our "acRank" field properly calculated in time for use within a derived trait. We can define an Eval script on our derived trait that assigns the value of "trtBonus" as equal to "acRank". The timing for this script must be after Traits/5100 and before Traits/6000. So we can pick something like Traits/5500 and everything works exactly as we want it to.

Success! :-)
rob is offline   #2 Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 03:41 PM.


Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.