Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Pathfinder Roleplaying Game
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
scibat
Member
 
Join Date: Jul 2011
Posts: 75

Old February 13th, 2014, 10:43 AM
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
The idea being that, after checking to see if two 2-handed firearms are being wielded, to alter the wClass tags on each directly. So far, while not giving an error, this code is not altering the tags of items on a character appropriately equipped. It may be a timing error ... I set the timing based on the timing of the field calculation for wClass, but I don't know for sure.

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!
scibat is offline   #1 Reply With Quote
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729

Old February 13th, 2014, 12:00 PM
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
I am pretty sure those "tags" are not set until very late. Their is a pair of "fields" that I think can be used instead that are set much earlier. I don't remember what they are called but you can look at the "Debug Fields" for a gun and equip/unequipped it to find the right ones.

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.
ShadowChemosh is offline   #2 Reply With Quote
scibat
Member
 
Join Date: Jul 2011
Posts: 75

Old February 13th, 2014, 12:15 PM
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.
scibat is offline   #3 Reply With Quote
scibat
Member
 
Join Date: Jul 2011
Posts: 75

Old February 13th, 2014, 12:52 PM
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
That too hasn't worked. I also tried it at First/5000 and likewise nothing. Is it worthwhile to try and sift through the task list to find the field and tag timings or is there an easier reference to check?
scibat is offline   #4 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old February 13th, 2014, 12:55 PM
I'd try:
Code:
debug "start"
even before the foreach. That'll tell you if your problem lies in the expression you've written for your foreach
Mathias is offline   #5 Reply With Quote
scibat
Member
 
Join Date: Jul 2011
Posts: 75

Old February 13th, 2014, 01:05 PM
Thanks, I will try that!
scibat is offline   #6 Reply With Quote
scibat
Member
 
Join Date: Jul 2011
Posts: 75

Old February 13th, 2014, 01:10 PM
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?
scibat is offline   #7 Reply With Quote
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729

Old February 13th, 2014, 01:14 PM
Quote:
Originally Posted by scibat View Post
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?
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.
ShadowChemosh is offline   #8 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old February 13th, 2014, 01:14 PM
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?
Mathias is offline   #9 Reply With Quote
scibat
Member
 
Join Date: Jul 2011
Posts: 75

Old February 13th, 2014, 01:32 PM
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
Here's the debug output:
Code:
********* Start Evaluation Cycle *********

start
Forgot to clarify: This is a Class Special attached to the Archetype. No odd bootstrap conditions or anything past the usual ClSpecWhen tag.

Last edited by scibat; February 13th, 2014 at 01:34 PM.
scibat is offline   #10 Reply With Quote
Reply


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 11:03 AM.


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