• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Ring that provides +1 crit range to all ranged weapons

Takeda

Well-known member
It's a Magic Item my DM gave my character ... I've messed around for a few hours but it's over my head. Anyone have any suggestions on the script for it.

While worn provides +1 crit range for any ranged weapons. It's pretty epic as it stacks with Imp Crit or Keen ... but doesn't double the crit range, only adds +1.

Any help would be appreciated.
 
It's a Magic Item my DM gave my character ... I've messed around for a few hours but it's over my head. Anyone have any suggestions on the script for it.

While worn provides +1 crit range for any ranged weapons. It's pretty epic as it stacks with Imp Crit or Keen ... but doesn't double the crit range, only adds +1.

Any help would be appreciated.

Take a look at the item power KEEN for ideas.
 
Yeah I did but won't stack without a lot more knowledge I don't have ... thus this post. There are checks and balances and stuff that I've tried to account for but it just keeps erroring no matter what I try.

Also looked at the Improved Critical as well. Can't get it to work.

The character already has Improved Crit ...
 
You should be able to modify the script. You need a field/variable to store the tag value for the critical range of the weapon. Then bump it up by one. Delete the old tag and assign the new one.
 
Just copying the code from Keen or Imp. Crit isn't going to work because they're just assigning tags. You'll need to store wCritMin.? tag, decrement it by one, delete the old one and reassign the new value.

something like

Code:
doneif (field[gIsEquip].value = 0)
var crit as number

foreach pick in hero from BaseWep where "wCategory.RangeProj | wCategory.Firearm | wCategory.RangeThrow"
  crit = eachpick.tagvalue[wCritMin.?]
  crit -= 1
  perform eachpick.delete[wCritMin.?]
  perform eachpick.assignstr["wCritMin." & crit]
nexteach

This is completely untested. I think it should run either Post-Lev or Final around 10k
 
Last edited:
I think, since it's meant to lower the crit minimum, the crit variable needs to subtract one on the second line inside the foreach.
 
whoops, yeah my bad. Updating that .... *blush*

The code above has been corrected.
 
Last edited:
Just copying the code from Keen or Imp. Crit isn't going to work because they're just assigning tags. You'll need to store wCritMin.? tag, decrement it by one, delete the old one and reassign the new value.

something like

Code:
doneif (field[gIsEquip].value = 0)
var crit as number

foreach pick in hero from BaseWep where "wCategory.RangeProj | wCategory.Firearm | wCategory.RangeThrow"
  crit = eachpick.tagvalue[wCritMin.?]
  crit -= 1
  perform eachpick.delete[wCritMin.?]
  perform eachpick.assignstr["wCritMin." & crit]
nexteach

This is completely untested. I think it should run either Post-Lev or Final around 10k

Tried it but it errors a lot ... flagged red and doubles-crit range. Thanks though ... just wish I was better at this stuff.
 
Little fiddling, now get "Invalid Syntax for tag template"

I'm not 100% positive it's caused by this script but I haven't seen it before ... but I'll keep looking.

Strangely the dagger I have equipped goes to 18-20 crit range but the bow which is 19-20 with Improved Crit goes to 17-20. <sigh>
 
Didn't the "Invalid Syntax" message include a line number?

If so, count line-by-line through your script and copy exactly what that line is here - cut-and-paste, preferably, so we can see if it's an error in capitalization or spelling.
 
It doesn't give a line number ... just "Invalid Syntax for Tag template" ... nothing else.

When I run the test in Editor no errors come up.
 
When Hero Lab gives you an error message, you should be able to right-click and copy it, then paste it here - could you please do so for this message?
 
It comes up when I select the ring to be worn or unworn ... but also comes up when I change a racial template (just randomly poking around and found that) ...
 
The times you're describing the error message being reported are what you'd expect - every time you change something, Hero Lab re-runs the ring's script, and it encounters the error again, so it reports the message again.
 
Just FYI my adjustment addon has one that changes Crit Range and Crit Multiplier. Its using Final/50000 which is AFTER the Keen/Improved Crit logic runs which is when you would want to improve by one. Otherwise as you saw your going to double the value as it takes 19-20 and doubles to 17-20.

Not only are the adjustments useful but can provide a nice starting point for doing allot things like this. :)

@Takeda whenever you get errors in HL you can "Right Click" on the message and copy. Then you can paste into the posts here. Plus when the error is from a script please post the script with the errors. Its much easier for us to help if we can "see" what your script looks like.

Though in this case the error is happening when you equip the ring right? Not when you do "Test Now!"?
 
It only says: "Invalid syntax for tag template" and nothing else. <----- I did the right-click and pasted it directly ... inside the quotes.

It would seem that because it changes the crit min of the weapons the benefits of Imp Crit are applied to this modified crit range.

doneif (field[gIsEquip].value = 0)
var crit as number

foreach pick in hero from BaseWep where "wCategory.RangeProj | wCategory.Firearm | wCategory.RangeThrow"
crit = eachpick.tagvalue[wCritMin.?]
crit -= 1
perform eachpick.delete[wCritMin.?]
perform eachpick.assignstr["wCritMin." & crit]
nexteach
 
Last edited:
Ok finally got it.

Code:
doneif (field[gIsEquip].value = 0)
var crit as number
var sCrit as string

foreach pick in hero from BaseWep where "wCategory.RangeProj|wCategory.RangeThrow"
  crit = eachpick.tagvalue[wCritMin.?]
  crit -= 1
  perform eachpick.delete[wCritMin.?]
  sCrit = "wCritMin." & crit
[B]  debug sCrit[/B]
  perform eachpick.assignstr["wCritMin.17"]
nexteach
I modified the script to allow for "debugging" the value. Then I went to "Develop->Floating Info Windows->Show Debug Output". Which showed me:
Code:
**********  Start Evaluation Cycle  **********

wCritMin.18
wCritMin.-1

As I only had a single weapon "crossbow" I should not have gotten two hits. Then I remembered that "Ray" is attached to all heroes and its trying to change the crit range of the Ray weapon. Hench the -1 value.

So to fix do the following:
Code:
doneif (field[gIsEquip].value = 0)
var crit as number

foreach pick in hero from BaseWep where "wCategory.RangeProj|wCategory.RangeThrow[B] & !thingid.wRay[/B]"
  crit = eachpick.tagvalue[wCritMin.?]
  crit -= 1
  perform eachpick.delete[wCritMin.?]
  perform eachpick.assignstr["wCritMin." & crit]
nexteach

I hate to say it one additional problem your going to run into. If you have a Improved Crit Crossbow you will get an error also. As normal is 19-20 with Keen is 17-20 and you try and one more for 16-20. By default load HL does not have a 16-20 crit tag. :(

So you need to either create a weapon with a new 16-20 crit range or install my adjustment addon as I have tags from 10-20 crit range created.
 
Back
Top