Junior Member
Join Date: Aug 2011
Posts: 7
|
I'm trying to create a new weapon ability that will adjust the category of the weapon it's applied to. Two handed weapons become one handed, one-handed weapons become light weapons, and light weapons.... well, too bad. Anyway, not being exceptionally gifted at coding (understatement), I tried something like this:
Code:
if (container.tagis[wClass.TwoHanded] <> 0) then perform container.delete[wClass.TwoHanded] perform container.assign[wClass.OneHanded] if (container.tagis[wClass.OneHanded] <> 0) then perform container.delete[wClass.OneHanded] perform container.assign[wClass.Light] |
#1 |
Senior Member
Join Date: Jul 2010
Posts: 3,147
|
Your script is basically fine, but I suspect your timing may be wrong.
Try this code at Pre-levels/1000 Code:
if (container.tagis[wClass.TwoHanded] <> 0) then perform container.delete[wClass.TwoHanded] perform container.assign[wClass.OneHanded] elseif (container.tagis[wClass.OneHanded] <> 0) then perform container.delete[wClass.OneHanded] perform container.assign[wClass.Light] endif |
#2 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
Assuming what posted is exactly what your trying to use the main issue is you don't have endif statements. Also what timing are you using? Early in the Pre-Levels phase is the timing I'd try first.
Also in like 3.6 of HL a new feature was added to make this a little easier. Basically tagreplace does the same actions of delete and assign but all in one step. Also my advice is to add "COMMENTS" to your scripts. You do this by having a "~" in front of text. Everyone hates adding comments but god it makes code easier to read for yourself when you come back to stuff in a day or week or even a month. Code:
~ Check the magic container Thing to see if we are a Two-Handed weapon ~ if we are then make us a One-Handed weapon instead if (container.tagis[wClass.TwoHanded] <> 0) then container.tagreplace[wClass.TwoHanded,wClass.OneHanded] endif ~ Check the magic container Thing to see if we are a one-Handed weapon ~ if we are then make us a Light weapon instead if (container.tagis[wClass.OneHanded] <> 0) then container.tagreplace[wClass.TwoHanded,wClass.Light] endif Hero Lab Resources: Pathfinder - d20pfsrd and Pathfinder Pack Setup 3.5 D&D (d20) - Community Server Setup 5E D&D - Community Server Setup Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources. Created by the community for the community - Realm Works kickstarter backer (Alpha Wolf) and Beta tester.- d20 HL package volunteer editor. |
#3 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,217
|
ShadowChemosh - you want elseif, not a second if statement. Currently, if it's a two-handed weapon, the first if will succeed and turn it into a one-handed weapon, and then the second if will be tested - it'll suceed, so it'll become a light weapon.
|
#4 |
Senior Member
Join Date: Jul 2010
Posts: 3,147
|
|
#5 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
Quote:
Yep your totally correct on that one. May bad.. Of course this is a good lessen in why you should always TEST your script. Hero Lab Resources: Pathfinder - d20pfsrd and Pathfinder Pack Setup 3.5 D&D (d20) - Community Server Setup 5E D&D - Community Server Setup Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources. Created by the community for the community - Realm Works kickstarter backer (Alpha Wolf) and Beta tester.- d20 HL package volunteer editor. Last edited by ShadowChemosh; May 23rd, 2012 at 04:08 PM. |
|
#6 |
Junior Member
Join Date: Aug 2011
Posts: 7
|
Ah, thanks so much, guys. The responses were very helpful. Nice to find out about the tagreplace command. SC's code worked perfectly, once I added the perform command and the elseif statement to it.
I was also able to add the fragile condition (yes, all by my little lonesome; aren't I all grown up now), however I'm having some difficulty finding the proper tag to require that these be masterwork weapons. Any suggestions? |
#7 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
Quote:
So what I have done and this *sort of* works is to look at the field[wAttBonus] and see if its 1. That is the field that gets set when the weapon is Masterwork. While the field[wBonus] gets set when magical. Now of course here is the kicker that is possible for scripts to set those values when the item is NOT MW or magical. So like I said this *sort of* works. I am all ears if anyone has found a better way. Hero Lab Resources: Pathfinder - d20pfsrd and Pathfinder Pack Setup 3.5 D&D (d20) - Community Server Setup 5E D&D - Community Server Setup Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources. Created by the community for the community - Realm Works kickstarter backer (Alpha Wolf) and Beta tester.- d20 HL package volunteer editor. |
|
#8 |
|
|