Member
Join Date: Jul 2011
Posts: 75
|
I am in the middle of coding a class ability that is supposed to allow this gunslinger archetype to use two two-handed firearms as per conventional two-handed fighting with the Two-Weapon Fighting feat under certain circumstances. Essentially, it would make the main hand gun the equivalent of a One-Handed weapon and the off-hand gun a Light weapon.
My idea to try to accomplish this was with the following code snippet: Code:
Pre-levels/5000 foreach pick in hero from BaseWep where "wProfReq.Firearm2" if (eachpick.tagis[Hero.MainHand] + eachpick.tagis[Hero.OffHand] = 2) then perform hero.assign[Hero.TwoWep] if (eachpick.tagis[Hero.MainHand] = 1) then perform eachpick.delete[wClass.TwoHanded] perform eachpick.assign[wClass.OneHanded] endif if (eachpick.tagis[Hero.OffHand] = 1) then perform eachpick.delete[wClass.TwoHanded] perform eachpick.assign[wClass.OneHanded] if (eachpick.field[gSizeMod].value = 0) then perform eachpick.delete[wClass.OneHanded] perform eachpick.assign[wClass.Light] endif endif endif nexteach At the *worst*, I could simply add bonuses with the right weapon equipped configuration to make up for the penalties, but if anyone can find the error in this more elegant solution, please let me know! Thank you! |
#1 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
It may very well being a timing issue as you have allot of different values being checked pretty early. I would add "debug" statements and then go to "Develop->Display Debug Output". (Note I am not near HL but I think that is the right name.)
Code:
foreach pick in hero from BaseWep where "wProfReq.Firearm2" debug "In Foreach Loop" debug "Hero.MainHand " & eachpick.tagis[Hero.MainHand] debug "Hero.OffHand " & eachpick.tagis[Hero.OffHand] if (eachpick.tagis[Hero.MainHand] + eachpick.tagis[Hero.OffHand] = 2) then perform hero.assign[Hero.TwoWep] if (eachpick.tagis[Hero.MainHand] = 1) then perform eachpick.delete[wClass.TwoHanded] perform eachpick.assign[wClass.OneHanded] endif if (eachpick.tagis[Hero.OffHand] = 1) then perform eachpick.delete[wClass.TwoHanded] perform eachpick.assign[wClass.OneHanded] if (eachpick.field[gSizeMod].value = 0) then perform eachpick.delete[wClass.OneHanded] perform eachpick.assign[wClass.Light] endif endif endif nexteach The above debug statements will help you narrow down your timing and issues. 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. |
#2 |
Member
Join Date: Jul 2011
Posts: 75
|
Thanks for the info! I'll check it out and see what I can figure. I'm with you that I feel this is probably a timing error. I'll run the debugs and see what it tells me.
|
#3 |
Member
Join Date: Jul 2011
Posts: 75
|
Update: adding the debug tags and having debug output turned on did, well, nothing. The Debug Output field remains empty, which is puzzling.
Looking at fields, I then tried this: Code:
Pre-levels/5000 foreach pick in hero from BaseWep where "wProfReq.Firearm2" if (eachpick.field[gIsEquip].value = 1) then if (eachpick.field[wMenuEquip].value = 1) then perform eachpick.delete[wClass.TwoHanded] perform eachpick.assign[wClass.OneHanded] endif if (eachpick.field[wMenuEquip].value = 2) then perform eachpick.delete[wClass.TwoHanded] perform eachpick.assign[wClass.OneHanded] if (eachpick.field[gSizeMod].value = 0) then perform eachpick.delete[wClass.OneHanded] perform eachpick.assign[wClass.Light] endif endif endif |
#4 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
I'd try:
Code:
debug "start" |
#5 |
Member
Join Date: Jul 2011
Posts: 75
|
Thanks, I will try that!
|
#6 |
Member
Join Date: Jul 2011
Posts: 75
|
OK, I don't know what is wrong (or right), but even debug "start" generate no debug output in the Debug Output window. Or should I feel dumb and am looking in the wrong place for the debug info?
|
#7 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
Guess need to ask what "Thing" is this script attached too as it sounds like its not getting onto the hero. If this is on a Class/Archetype are you adding that Class/Archetype to the character? Sorry if that is a dumb question but its very strange that your not even getting "Start". That means the script is not firing at all.
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 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
There's no code before what you've posted?
To see the debug output, Develop...Floating Info Windows...Show Debug Output You've added this archetype to your test character, and verified that the class special you're working on shows up on the Gunslinger tab? |
#9 |
Member
Join Date: Jul 2011
Posts: 75
|
Yep on all counts. I created a test character, added the class and Archetype, and the ability did add at the right level.
There actually is two lines of code ahead of the 'debug "start"'. Moving the debug to there finally generates some output, but it isn't much. Here is the full code, as well as the debug output. Important to note that the first if/then script bit works exactly as intended. Code:
debug "start" ~ If we're not shown, just get out now doneif (tagis[Helper.ShowSpec] = 0) if (hero.childlives[gSaddRack] <> 0) then hero.child[gSaddRack].field[usrCandid2].text = "component.BaseWep & wProfReq.Firearm2" endif foreach pick in hero from BaseWep where "wProfReq.Firearm2" debug "In Foreach Loop" debug "gIsEquip " & eachpick.field[gIsEquip].value debug "wMenuEquip " & eachpick.field[wMenuEquip].value if (eachpick.field[gIsEquip].value = 1) then if (eachpick.field[wMenuEquip].value = 1) then perform eachpick.delete[wClass.TwoHanded] perform eachpick.assign[wClass.OneHanded] endif if (eachpick.field[wMenuEquip].value = 2) then perform eachpick.delete[wClass.TwoHanded] perform eachpick.assign[wClass.OneHanded] if (eachpick.field[gSizeMod].value = 0) then perform eachpick.delete[wClass.OneHanded] perform eachpick.assign[wClass.Light] endif endif endif nexteach Code:
********* Start Evaluation Cycle ********* start Last edited by scibat; February 13th, 2014 at 01:34 PM. |
#10 |
|
|