Member
Join Date: Sep 2008
Posts: 48
|
I am trying to implement a class that grants a special ability that adds 2 to a particular type of weapon's critical threat range and simply can't figure out how to do it.
Let's assume a scimitar (wScimitar) for the sake of this discussion (I actually have a pick list for the type of weapon, and I know how to get the id from the pick list) How would you go about increasing the critical threat range of this weapon by two? |
#1 |
Member
Join Date: Sep 2008
Posts: 48
|
Nobody, huh? Bummer...
|
#2 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Critical range is stored as tags in the d20 files.
Since the improved critical feat's script happens at PreLevel, 5000, that ought to be a good timing for this script, too. The way things work behind the scenes, what's being added in this script will still take place before Improved Critical/Keen - the tags we're fooling with and those tags are all processed in the same script to calculate the final display value. First, we'll look up the critical tags that already exist on the weapon, and get the minimum tag that exists. Also, it is technically possible for a weapon to be created with no wCritMin tags - in that case, the weapon has some special reason for it (since the editor requires one to be added), so we'll exit the script. Code:
var crit as number if (tagcount[wCritMin.?] > 0) then crit = field[chosen].chosen.tagmin[wCritMin.?] else done endif ~now, we'll subtract two from the value we looked up: crit -= 2 ~and create a tag for that new value: var newcrittag as string newcrittag = "wCritMin." & crit ~Weapons are assumed to have exactly one wCritMin tag, ~so we'll delete anything that already exists, ~and then assign the new tag: perform field[chosen].chosen.delete[wCritMin.?] perform field[chosen].chosen.assignstr[newcrittag] Last edited by Mathias; July 7th, 2009 at 09:13 AM. |
#3 |
|
|