![]() |
Doubling a weapon's damage dice
I'm looking to add a weapon power that would double the weapon's damage dice (like the Vital Strike feat). For instance, a dagger with the ability would go from 1d4 -> 2d4 for Medium creatures and from 3d6 -> 6d6 for Colossal creatures. I've looked through the fields and tags, but there's a lot of computation that goes on behind the scenes from what's tagged on the weapon.
Also, I'd be happy to show the damage as 1d4+1d4 (or 3d6+3d6), just would like to be able to display it on the weapon stats. |
Here's an existing thread on the subject: http://forums.wolflair.com/showthrea...ht=damage+dice
|
So I have a version of the Vital Strike feat that has an activation ability. The code in it is very similar to what your asking as it doubles the base dice value. Also note it needs some fixes because of recent changes in HL. :D
But its really not super simple. It took awhile to get it to generate the values correctly. That is the best help I can give right now. |
Mathias, that's not going to work since it changes the base damage dice of the weapon. So when it upsizes to Colossal, instead of it going from 3d6 to 6d6, it just increases along the 3d4 path.
ShadowChemosh - That is SUPER-complicated. Congrats on it! I'll have to see if I can't tweek it for my purposes. |
Since I was looking at this for a specific Magic Weapon (Manyfang dagger, Serpent Kingdoms, p. 152), I was able to take your code ShadowChemosh and tweak it below to add as Extra Damage on the weapon.
Code:
var sDice as string |
Cool. Glad it got you pointed in the right direction. :)
|
Quote:
A house rule my group intends to use is that base weapon damage increases at levels 8, 15, 22 and 29. This affects all melee (including unarmed) and ranged weapons, but not spells, or classes who have pre-defined damage, such as the monk or brawler. At each of these levels, the base damage die of the weapon is doubled. Two examples: longsword 1st level - 1d8 8th level - 2d8 15th level - 3d8 22nd level - 4d8 29th level - 5d8 falchion 1st level - 2d4 8th level - 4d4 15th level - 6d4 22nd level - 8d4 29th level - 10d4 Of course, size affecting damage die type would also need to apply. I spent the last 5 years playing 4e (using and modifying Hero Labs), but for the life of me I can't see a way to accomplish this. If this can be done as some sort of general mechanic, that would be great. Next preferred method would be creating single weapons that were cognizant of the character level to determine damage. Coming up with 5 discrete weapons (one for each level class) seems more work than worth the effort. |
Matt listed a working script above and the Vital Steike addon would provide another working script example to accomplish this.
|
Quote:
<thing id="wmLongswor" name="Longsword (modified)" description="This sword is about 3-1/2 feet in length." compset="Weapon"> <fieldval field="gWeight" value="4"/> <fieldval field="gSizeCost" value="15"/> <tag group="wClass" tag="OneHanded" name="One-Handed" abbrev="One-Handed"/> <tag group="wCritMin" tag="19" name="19" abbrev="19"/> <tag group="wCritMult" tag="2" name="2" abbrev="2"/> <tag group="wFtrGroup" tag="BladeHeavy" name="Blades, Heavy" abbrev="Blades, Heavy"/> <tag group="wMain" tag="1d8_6" name="1d8" abbrev="1d8"/> <tag group="wProfReq" tag="Simple"/> <tag group="wType" tag="S" name="Slashing" abbrev="S"/> <tag group="EquipType" tag="Metal" name="Metal" abbrev="Metal"/> <tag group="wCategory" tag="Melee" name="Melee Weapon" abbrev="Melee"/> <eval phase="UserFinal"><![CDATA[var sDice as string var nDice as number var nDieSize as number var dBreak as string ~ Pull out the number of dice nDice = mid(field[wDamageTbl].arraytext[1],0,1) ~ Pull out the die size nDieSize = mid(field[wDamageTbl].arraytext[1],2,2) ~ Check for d in damage code dBreak = mid(field[wDamageTbl].arraytext[1],1,1) ~ Increase the number of dice nDice *= 3 if (compare(dBreak,"d")=0) then sDice = nDice & "d" & nDieSize else sDice = nDice endif if (nDice <> 0) then field[wDamExtra].text = "+" & sDice endif]]></eval> </thing> Yet when the weapon is displayed, it only shows damage as "1d8" |
I am not seeing any reason it its not showing triple dice damage. I will have to wait until I get home to try it out in HL to see why its not working...
|
So looks like Matt forgot to give the timing which is very important. This has to run at Final/9999999999 to work correctly.
Once you have this working all you have to do is make the following changes: 1) Add the script to Mechanic so it runs for all characters and will adjust all weapons. 2) Change the script to do a foreach loop through all the BaseWep. HERE is a post with an example showing a foreach loop through all BaseWep. |
@ShadowChemosh
You have been extremely help, and I have the initial script working as intended by the author. I am wondering, instead of displaying the sDice as extra damage, is it possible to display it as base damage? I assume it would be applied as a modification to: if (nDice <> 0) then field[wDamExtra].text = "+" & sDice endif but every time I try replacing "wDamExtra", I run into parsing errors. I assumed it would be some variation of: if (nDice <> 0) then field[wMain].text = sDice endif Any assistance you could provide would be greatly appreciated. P.S. I am still working within the weapon definition (as opposed to the Mechanic) |
Their is two fields you will have to change so that you can get it to display correctly. These are the "Fixed" damage fields. I think its called "wFixDamage" and "wFixRanDam" fields used for setting the melee and ranged damage.
To make sure you can check the Vital Strike feat add as the very bottom of its code it sets the two fields correctly. If you don't want to use the "extra damage" field you just have to totally rebuild the full value of the dice including any pluses then. That was why Matt went the way he did as it was easier. So your code will need to figure out the dice current value and the amount of "plus". So if the weapon does 1d8+3 you will need to store that as three independent values (ie 1,8,3). This way you can multiple the "1" of 1d8+3 only by the amount of extra dice. You will also need to know which values to pull the pluses from as 1 handed vs 2-handed do different damage plus amounts so you have to pull from different sections of the damage table. Then string it all back together again so you get say 2d8+3 if you where to double the dice. For example code I recommend looking at the Vital Strike feat I did as I am doing all that. The only difference is its already doing a foreach loop. So the parts of the script doing the "eachpick" you could leave off if you are running directly on the weapon for now. |
Quote:
|
2 Attachment(s)
I got the scripting to work, when included within a weapon. Thank you so much for that assistance.
When I tried use the scripting as a Mechanic (thus affecting weapons I hadn't rebuilt), I get an error on loading: "Attempt to access field 'abValue' that does not exist for thing 'LvlDmgMult' Location: 'eval' script for Thing 'LvlDmgMult' (Eval Script '#1') near line 9 - - - Attempt to access field 'abValue' that does not exist for thing 'LvlDmgMult' Location: 'eval' script for Thing 'LvlDmgMult' (Eval Script '#1') near line 44 - - -" This repeats several times in the error display pop-up What I find strange is that I used the abValue field without any problems when the script was placed on an individual weapon. C999_Equipment.user has the sample working weapon config C999_General.user has the sample non-working mechanic config Portfolio will load with just C999_Equipment.user. I get the above errors with just C999_General.user |
I resolved the issue by removing all reference's to "field[abValue].value" and just using the defined variable "lvlcnt".
Thank you again for all your help. |
Quote:
So using a local variable is the correct answer in this case. |
All times are GMT -8. The time now is 01:21 AM. |
Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.