Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - D&D 5th Edition SRD

Notices

Reply
 
Thread Tools Display Modes
Freewolf
Junior Member
 
Join Date: Jul 2017
Posts: 18

Old January 13th, 2018, 08:24 AM
So I am creating some new feats.

I plugged in this code to allow the feat to provide proficieny in Investigation, or double proficiency if already proficient.

Interesting thing that happens is when i select the feat it applies double proficiency just fine, but the Investigation with double proficieny now appears twice both in the program and the print out.

Why is that??

Code:
doneif (tagis[Helper.ShowSpec] = 0)
doneif (tagis[Helper.Disable] <> 0)

if (hero.tagis[ProfSkill.skInvestig] <> 0) then
       perform hero.assign[ProfDouble.skInvestig]
else
       perform hero.childfound[skInvestig].assign[Helper.Proficient]
endif
Freewolf is offline   #1 Reply With Quote
dungeonguru
Senior Member
 
Join Date: May 2016
Location: Louisville, KY
Posts: 310

Old January 14th, 2018, 03:20 AM
It likely has to deal with timing, would have to see all the scripts being applied on the hero to be sure.

Have you looked at the UA article Feats for Skills code? The feat Acrobat has some code in there that does exactly what you want for Acrobatics, but doesn't leave a second copy on the sheet. Should be easily modified for whatever skill you want.

The code runs Post-Level at 15500, which is after Helper.Proficient tags are assigned on most abilities (around 10000) but before the proficiency & double proficiency tags are pushed (around 16000 if I remember).

Code:
doneif (tagis[Helper.ShowSpec] = 0)
doneif (tagis[Helper.Disable] <> 0)

foreach pick in hero from BaseSkill where "thingid.skAcrobat"
     if (eachpick.tagis[Helper.Proficient] = 0) then 
          perform eachpick.assign[Helper.Proficient]
     elseif (eachpick.tagis[Helper.Proficient] <> 0) then
          perform eachpick.assign[Helper.ProfDouble]
     endif
nexteach

DM'ing since 1984's red box. Pretending to slay dragons for a long time before.
SELF-CERTIFIED OLD COOT
The mirror doesn't lie.

Links for Community files:
Changelog for 5e Community Files
Open Issues for 5e Community Files


LW Products: Hero Labs Classic
Other Tools: CC3+, Inspiration Pad Pro
dungeonguru is offline   #2 Reply With Quote
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,246

Old January 14th, 2018, 09:21 AM
Quote:
Originally Posted by dungeonguru View Post
Code:
doneif (tagis[Helper.ShowSpec] = 0)
doneif (tagis[Helper.Disable] <> 0)

foreach pick in hero from BaseSkill where "thingid.skAcrobat"
     if (eachpick.tagis[Helper.Proficient] = 0) then 
          perform eachpick.assign[Helper.Proficient]
     elseif (eachpick.tagis[Helper.Proficient] <> 0) then
          perform eachpick.assign[Helper.ProfDouble]
     endif
nexteach
Unless I miss something in 5e were you can have multiple instances of Acrobatic skill the foreach is allot of overhead. It will work the way you have it coded. Most likely you won't even notice any issues unless you have a higher level character running dozens of these scripts or several dozens at once.

The above could be done with almost no CPU usage by using a FOCUS instead.
Code:
doneif (tagis[Helper.ShowSpec] = 0)
doneif (tagis[Helper.Disable] <> 0)

perform hero.childfound[skAcrobat].setfocus
doneif (state.isfocus = 0)
if (focus.tagis[Helper.Proficient] = 0) then 
      perform focus.assign[Helper.Proficient]
elseif (focus.tagis[Helper.Proficient] <> 0) then
      perform focus.assign[Helper.ProfDouble]
endif
If you plan to use the above logic dozens of times for different feats, traits and abilities I would recommend turning it into a procedure. Then you can call the logic easily from all over.

Procedure Logic:
Code:
<procedure id="5CSkProfDo" context="pick"><![CDATA[
  var v_SkillID as string

  ~ Make a Target.? skill id to be used in the find chile
  v_SkillID = "Target." & v_SkillID

  ~ Set focus to the skill id passed in
  perform hero.findchild[BaseSkill,v_SkillID].setfocus
  doneif (state.isfocus = 0)
  
  ~ If not proficient then make skill proficient
  if (focus.tagis[Helper.Proficient] = 0) then 
    perform focus.assign[Helper.Proficient]
        
  ~..Else if already proficient make double proficient
  elseif (focus.tagis[Helper.Proficient] <> 0) then
    perform focus.assign[Helper.ProfDouble]
  endif
]]></procedure>
Then this is all that anyone would need to do to now reuse the above logic:
Code:
doneif (tagis[Helper.ShowSpec] = 0)
doneif (tagis[Helper.Disable] <> 0)

var v_SkillID as string
v_SkillID = "skAcrobat"
call 5CSkProfDo
The really nice benefit is if any logic needs to be fixed in applying Proficiency tags you only have to update ONE place. That one fix will apply itself to anything in the Pack or individual .user files. Cutting code maintenance time down is a life saver in the long run.

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; January 14th, 2018 at 11:40 AM. Reason: fixed scripting typoes...
ShadowChemosh is offline   #3 Reply With Quote
dungeonguru
Senior Member
 
Join Date: May 2016
Location: Louisville, KY
Posts: 310

Old January 14th, 2018, 10:29 AM
ShadowChemosh,

I'm trying your procedure code out and getting a generic error on the line:

"Invalid ID specified for component" on the line

Code:
  hero.findchild["BaseSkill",v_SkillID].setfocus
Same happens when I try the focus method

Code:
hero.childfound[skAcrobat].setfocus
except the error states "unspecified error parsing script"

Something with 5e maybe doesn't like focusing on skills?

DM'ing since 1984's red box. Pretending to slay dragons for a long time before.
SELF-CERTIFIED OLD COOT
The mirror doesn't lie.

Links for Community files:
Changelog for 5e Community Files
Open Issues for 5e Community Files


LW Products: Hero Labs Classic
Other Tools: CC3+, Inspiration Pad Pro
dungeonguru is offline   #4 Reply With Quote
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,246

Old January 14th, 2018, 11:38 AM
Quote:
Originally Posted by dungeonguru View Post
ShadowChemosh,

I'm trying your procedure code out and getting a generic error on the line:

"Invalid ID specified for component" on the line

Code:
  hero.findchild["BaseSkill",v_SkillID].setfocus
Same happens when I try the focus method

Code:
hero.childfound[skAcrobat].setfocus
except the error states "unspecified error parsing script"

Something with 5e maybe doesn't like focusing on skills?
Oppss I was a little distracted while writting this.

This:
Code:
  hero.findchild["BaseSkill",v_SkillID].setfocus
Should be this:
Code:
  
perform hero.findchild[BaseSkill,v_SkillID].setfocus
The component should not have quotes and it needs "perform".

Similiar this:
Code:
hero.childfound[skAcrobat].setfocus
should be:
Code:
perform hero.childfound[skAcrobat].setfocus
setfocus is a "perform" type action like working with tags. Sorry!

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   #5 Reply With Quote
dungeonguru
Senior Member
 
Join Date: May 2016
Location: Louisville, KY
Posts: 310

Old January 14th, 2018, 12:43 PM
Quote:
Originally Posted by ShadowChemosh View Post
Oppss I was a little distracted while writting this.


setfocus is a "perform" type action like working with tags. Sorry!
Ah, so more things I'm reading on the hlkitwiki are starting to make sense. Thanks for the valuable lesson, I'll try to get the procedure into the community files and swap out where the other inefficient code is used in the UA Feats for Skills article.

Also, some clarification for Freewolf on timing on running double proficiency:

At Post-Levels 15000, the script "Assign Helper.Proficient based on ProfSkill tags on Hero" kicks off, which translates the ProfSkill tags over to a proficiency.

At Post-Levels 20000, the scrip "Calc skProfBon" looks at the Helper.Proficient and the proficiency bonus of the hero to calc out the final proficiency modifier.

So technically, assigning the Helper.ProfDouble tag has to happen after you know that the Helper.Proficient is or is not present at post-levels 15000 and before the proficiency is calculated at 20000.

DM'ing since 1984's red box. Pretending to slay dragons for a long time before.
SELF-CERTIFIED OLD COOT
The mirror doesn't lie.

Links for Community files:
Changelog for 5e Community Files
Open Issues for 5e Community Files


LW Products: Hero Labs Classic
Other Tools: CC3+, Inspiration Pad Pro

Last edited by dungeonguru; January 14th, 2018 at 12:47 PM. Reason: Deleted a line that was confusing
dungeonguru is offline   #6 Reply With Quote
Enforcer84
Senior Member
 
Join Date: Oct 2011
Location: Corvallis
Posts: 235

Old January 16th, 2018, 03:24 PM
I want to thank all three of you for this. Adding that procedure to my notes!
Enforcer84 is offline   #7 Reply With Quote
Freewolf
Junior Member
 
Join Date: Jul 2017
Posts: 18

Old January 17th, 2018, 07:24 PM
Thanks for the help gents.

Been out of pocket last week with trying to pack up and move.

I do not understand the whole Procedure aspect yet. I did copy the code from the UA Feats originally. I tried the FOCUS code you offered Shadow, but investigation still shows up twice, however this time only one has the double proficiency to it.

I have tried the post-levels at 15500 and 17000 with the same result.



I am attaching an image of what I have.
Freewolf is offline   #8 Reply With Quote
Reply

Thread Tools
Display Modes

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 08:02 PM.


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