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
marcopico
Junior Member
 
Join Date: Jun 2019
Location: Palermo, Italy
Posts: 15

Old July 26th, 2019, 03:38 AM
Hello everybody, I have created an Eval Script that is meant to increase the critical threat range of any weapon by 1, after the hero gets to level 11.

This is the eval script I've written (Post-attributes, 10000, 1):

Code:
if (field[xTotalLev].value >= 11) then

var threat as number
foreach pick in hero from BaseWep
  threat = eachpick.tagvalue[wCritMin.?] - 1
  perform eachpick.delete[wCritMin.?]
  perform eachpick.assignstr["wCritMin." & threat]
  nexteach

endif
The script works in terms of lowering the critical threat range by 1, but I get the "Invalid syntax for tag template" error every time I add, edit or delete any weapon in my character's sheet. How do I get rid of this error?

Moreover, I noticed another issue. If the weapon I am wielding is a keen weapon, or if I have the Improved Critical Feat, the code I have written reduces the critical threat range by 2, not by 1. Is there a way to avoid this?

Thanks for your help!

UPDATE: I managed to solve the Invalid syntax for tag template error. The reason was probably that some weapons (no idea which ones) did not have the wCritMin tag and thus were unable to execute the script.

This is the updated code (now working):

Code:
if (field[xTotalLev].value >= 11) then
  var threatrng as number
  foreach pick in hero from BaseWep where "wCritMin.?"
    threatrng = eachpick.tagvalue[wCritMin.?] - 1
    perform eachpick.delete[wCritMin.?]
    perform eachpick.assignstr["wCritMin." & threatrng]
    nexteach
endif
The only issue I haven't managed to solve yet is that in case of Improved Critical and Keen my script still improves the threat range by 2 instead of 1. I still have to solve the timing issue (see below)!

Last edited by marcopico; July 26th, 2019 at 09:41 AM.
marcopico is offline   #1 Reply With Quote
Lord Magus
Senior Member
 
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464

Old July 26th, 2019, 04:08 AM
Quote:
Originally Posted by marcopico View Post
If the weapon I am wielding is a keen weapon, or if I have the Improved Critical Feat, the code I have written reduces the critical threat range by 2, not by 1.
Try changing the timing of your script so it fires after Imp Critical or Keen multiply the threat range.
Lord Magus is offline   #2 Reply With Quote
marcopico
Junior Member
 
Join Date: Jun 2019
Location: Palermo, Italy
Posts: 15

Old July 26th, 2019, 08:56 AM
Quote:
Originally Posted by Lord Magus View Post
Try changing the timing of your script so it fires after Imp Critical or Keen multiply the threat range.
I see your point, but I don't know how to change the timing properly. What is the script (Keen and/or Improved Critical) after which I should apply my script?
marcopico is offline   #3 Reply With Quote
Lord Magus
Senior Member
 
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464

Old July 28th, 2019, 06:38 AM
Quote:
Originally Posted by marcopico View Post
What is the script (Keen and/or Improved Critical) after which I should apply my script?
In the Editor, make copies of the Improved Critical feat and the Keen weapon power, and look at the timing of their respective scripts. Set the timing of your script immediately after those two. Don't forget to delete the copies of Imp Crit and Keen after you peruse them.
Lord Magus is offline   #4 Reply With Quote
marcopico
Junior Member
 
Join Date: Jun 2019
Location: Palermo, Italy
Posts: 15

Old July 28th, 2019, 07:18 AM
Quote:
Originally Posted by Lord Magus View Post
In the Editor, make copies of the Improved Critical feat and the Keen weapon power, and look at the timing of their respective scripts. Set the timing of your script immediately after those two. Don't forget to delete the copies of Imp Crit and Keen after you peruse them.
Thank you for your support, but I still can't see how to solve this. I have checked both the Improved Critical feat and the Keen weapon power, and their only Eval Script is set as Pre-Levels 5000, with no Timing specified.

If I move my script to Pre-Levels 5001, it simply doesn't work (i.e. it does not decrease the critical threat range by 1; the range stays the same as if nothing happened). It looks like it should be set to Post-Levels (I had it at Post-Levels 10000) to make it decrease the critical threat range by 1.

I realize that when you talk about Timing you are referring to the Timing button, not the Phase menu or the Priority number, but how do I set my script's Timing so that it activates after another process (iKeen or fImprCrit) which apparently have no Timing?

I apologise if I'm doing something wrong and looking incredibly numb
marcopico is offline   #5 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old July 28th, 2019, 07:29 AM
The phase and priority is what he's actually referring to - that determines the order a script is run in, relative to all other scripts - the whole set of Phase, Priority and Timing is generally lumped under "Timing". The "Timing" button is tools to help you determine which order to run it in - the option to name scripts, and to record the names of other scripts that it must be before or after, to help you keep track of what depends on what.
Mathias is offline   #6 Reply With Quote
marcopico
Junior Member
 
Join Date: Jun 2019
Location: Palermo, Italy
Posts: 15

Old July 28th, 2019, 07:37 AM
Quote:
Originally Posted by Mathias View Post
The phase and priority is what he's actually referring to - that determines the order a script is run in, relative to all other scripts - the whole set of Phase, Priority and Timing is generally lumped under "Timing". The "Timing" button is tools to help you determine which order to run it in - the option to name scripts, and to record the names of other scripts that it must be before or after, to help you keep track of what depends on what.
Alright, so why does my script fail to run correctly if I set the phase and priority as I wrote earlier?

Improved Critical: Pre-Levels 5000
Keen: Pre-Levels 5000
My script: Pre-Levels 5001

This combination does not seem to work at all: there are no changes at all to the critical threat range.

Improved Critical: Pre-Levels 5000
Keen: Pre-Levels 5000
My script: Post-Levels 10000

This combination decreases the critical threat range by 1 (e.g. 18-20 becomes 17-20), but if I apply the keen and/or improved critical effect the threat range becomes 13-20 (it should be 14-20 instead: 15-20 because of keen, decreased by 1 because of my script).

Anyway, thanks for helping me understand what the Timing button does :-)
marcopico is offline   #7 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old July 28th, 2019, 07:39 AM
As an example that may help, here's the "Out for Blood" Dare for gunslingers/swashbucklers, which improves the critical threat range of the specified weapons by 1:


Code:
    <eval phase="Final" priority="2000"><![CDATA[
      doneif (tagis[Helper.SpcDisable] <> 0)
      doneif (field[abilActive].value = 0)

      var searchexpr as string

      ~until we get an official answer, each class can build its own list,
      ~and if we're a gunslinger/swashbuckler, we'll look for all weapons
      ~that qualify for either
      if (#levelcount[Gunsling] <> 0) then
        searchexpr = "wCategory.Firearm"
        endif
      if (#levelcount[Swashbuck] <> 0) then
        searchexpr = splice(searchexpr,"((((wClass.Light | wClass.OneHanded) & wType.P) | (Custom.fSlshStrik)) & wCategory.Melee & !wGroup.Natural)"," | ")
        endif

      doneif (empty(searchexpr) <> 0)

      foreach pick in hero from BaseWep where searchexpr
        ~our current interpretation is that this effect does not stack with
        ~keen or improved critical
        if (eachpick.tagexpr[Helper.Keen | Broadcast.ImpCrit] = 0) then
          if (eachpick.tagis[wCritMin.?] <> 0) then
            var critvalue as number
            critvalue = eachpick.tagvalue[wCritMin.?]
            perform eachpick.delete[wCritMin.?]
            critvalue -= 1
            perform eachpick.assignstr["wCritMin." & critvalue]
            endif
          endif
        nexteach]]>
      <after name="AddReq.Grit checks trkLeft"/>
      </eval>
Mathias is offline   #8 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old July 28th, 2019, 07:42 AM
Ok, didn't realize the issue was stacking with keen - let me find something more specific to that.
Mathias is offline   #9 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old July 28th, 2019, 07:45 AM
Here's the Rapier Mastery ability from the Inspired Blade shashbuckler archetype:


Code:
    <eval phase="PostAttr" priority="10000" index="2"><![CDATA[
      ~ only run the rest for the first copy
      doneif (tagis[Helper.FirstCopy] = 0)

      ~ If we're not shown, just get out now
      doneif (tagis[Helper.ShowSpec] = 0)

      ~ If we're disabled, do nothing
      doneif (tagis[Helper.SpcDisable] <> 0)

      foreach pick in hero from BaseWep where "IsWeapon.wRapier"
        perform eachpick.assign[Broadcast.CritMult]
        perform eachpick.assign[Helper.CritExpan]
         nexteach]]></eval>

The Helper.CritExpan tag is specifically designed to trigger an improvement that is applied after Keen is applied.
Mathias 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 10:22 PM.


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