• 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

Increasing Threat range by 1...

Pezmerga

Well-known member
The Tome of Secrets Swashbuckler has an ability called find the mark, which increases the threat range of a weapon finessable weapon by 1. It currently does not show up, is it possible to customly implement this? I see the Keen quality just uses a tag and so does Improved Critical..So I cannot see how the actual coding works.
 
this is the existing code...

Code:
  ~Post-levels 10,000
~if we're not shown, just get out now
doneif (tagis[Helper.ShowSpec] = 0)
 
foreach thing in BaseWep where "wClass.Light | Helper.Finesse"
  perform eachthing.amendthing[description,eachthing.field[descript].text & "{br}{br}{b}Addition from Find the Mark{/b}: Threat Range Increased by 1"]
  nexteach

~foreach pick in hero where "wClass.Light | Helper.Finesse"
~ each.field[wCrit].value -= 5
~perform eachpick.assign[Broadcast.ImpCrit]
~  nexteach
 
Its not currently possible to implement a only 1 improvement to the threat range. Or if it is I have no idea how to get it to work. :)
 
Its not currently possible to implement a only 1 improvement to the threat range. Or if it is I have no idea how to get it to work. :)

Ah ok, was starting to think that was the case. I know some of my other custom classes have features that currently can not be implemented on HL! :)
 
Ah ok, was starting to think that was the case. I know some of my other custom classes have features that currently can not be implemented on HL! :)

The Keep/IC scripts fiddle with tagnames[wCritMin.?] directly.

You will need to modify timing to go after Keen/IC fire off.

Something like:
Code:
  <thing id="ipwCritMin" name="wCritMin change" compset="ItemPower" uniqueness="
unique">
    <tag group="PowerType" tag="Weapon" name="Weapon" abbrev="Weapon"/>
    <eval phase="Final" priority="50000"><![CDATA[var critmin as number
critmin = container.parent.tagnames[wCritMin.?,""] -1

if (critmin = 18) then
     perform container.parent.assign[wCritMin.18]
     perform container.parent.delete[wCritMin.19]
endif]]></eval>
    </thing>

The only caveat (since I'm not sure how to assign a tag from a string) is that you will need a huge if-then-else-endif chain to do all possible things (I just coded 19->18 for a Longsword in this test)
 
Last edited:
...
The only caveat (since I'm not sure how to assign a tag from a string) is that you will need a huge if-then-else-endif chain to do all possible things (I just coded 19->18 for a Longsword in this test)
Awesome risner. So building on that logic here is how to assign a String value. This is quick adjustment I created that can control the Crit by the counter.
Code:
~ If we're not enabled, get out now
doneif (field[pIsOn].value = 0)
~if nothing's been chosen, get out now
doneif (field[pChosen].ischosen = 0)
var sCrit as String
var nCrit as number
~ Remove all crit tags
perform field[pChosen].chosen.delete[wCritMin.?]
~ Calc numeric crit by taking 20 and subtracking the counter
nCrit = 20 - field[pAdjust].value
~ Create the Crit string value
sCrit = "wCritMin." & nCrit
~ Assign the string to the weapon
perform field[pChosen].chosen.assignstr[sCrit]

Here is the full XML:
Code:
  <thing id="pS2wCritRa" name="Weapon: Crit Range" compset="InPlay">
    <fieldval field="pMaximum" value="19"/>
    <fieldval field="pMinimum" value="1"/>
    <tag group="Adjustment" tag="YourWep"/>
    <eval phase="Final" priority="50000"><![CDATA[~ If we're not enabled, get out now
doneif (field[pIsOn].value = 0)
~if nothing's been chosen, get out now
doneif (field[pChosen].ischosen = 0)
var sCrit as String
var nCrit as number
~ Remove all crit tags
perform field[pChosen].chosen.delete[wCritMin.?]
~ Calc numeric crit by taking 20 and subtracking the counter
nCrit = 20 - field[pAdjust].value
~ Create the Crit string value
sCrit = "wCritMin." & nCrit
~ Assign the string to the weapon
perform field[pChosen].chosen.assignstr[sCrit]]]></eval>
    </thing>

The only issue is that not all Crit ranges are in HL. Seems like only 20-18, but it looks like if you create a new weapon you can define NEW crit value tags in the editor. Yep just tested this and you can create the other tags in the editor under weapons. Then just set the weapons to not be selectable and as a helper object.

Hope that helps.
 
Last edited:
Not really sure how you guys are getting this to work (I'm not that familiar with XML)...mind posting a datafile with that code in an ability?
 
I have an adjustments file with this and other stuff I have plans to release to the community soon.

Otherwise the first bit of code is what goes into an Eval Scripts for a Adjustment in the editor.

In the editor go to Adjustment tab and do a New(Blank). Give it a name and unique ID. Then do the following:

* Show Menu = "Current Weapons"
* Minimum adjustment = "1"
* Maximum adjustment = "19"

For the Eval Scripts enter the following at Phase: Final Phase; Priority: 50000
Code:
~ If we're not enabled, get out now
doneif (field[pIsOn].value = 0)
~if nothing's been chosen, get out now
doneif (field[pChosen].ischosen = 0)
var sCrit as String
var nCrit as number
~ Remove all crit tags
perform field[pChosen].chosen.delete[wCritMin.?]
~ Calc numeric crit by taking 20 and subtracking the counter
nCrit = 20 - field[pAdjust].value
~ Create the Crit string value
sCrit = "wCritMin." & nCrit
~ Assign the string to the weapon
perform field[pChosen].chosen.assignstr[sCrit]
Though without new Tags you will only be able to set 19,18,17 crit ranges only. The .user file I release to the community will be able to do many more.
 
I have an adjustments file with this and other stuff I have plans to release to the community soon.

Otherwise the first bit of code is what goes into an Eval Scripts for a Adjustment in the editor.

In the editor go to Adjustment tab and do a New(Blank). Give it a name and unique ID. Then do the following:

* Show Menu = "Current Weapons"
* Minimum adjustment = "1"
* Maximum adjustment = "19"

For the Eval Scripts enter the following at Phase: Final Phase; Priority: 50000
Code:
~ If we're not enabled, get out now
doneif (field[pIsOn].value = 0)
~if nothing's been chosen, get out now
doneif (field[pChosen].ischosen = 0)
var sCrit as String
var nCrit as number
~ Remove all crit tags
perform field[pChosen].chosen.delete[wCritMin.?]
~ Calc numeric crit by taking 20 and subtracking the counter
nCrit = 20 - field[pAdjust].value
~ Create the Crit string value
sCrit = "wCritMin." & nCrit
~ Assign the string to the weapon
perform field[pChosen].chosen.assignstr[sCrit]
Though without new Tags you will only be able to set 19,18,17 crit ranges only. The .user file I release to the community will be able to do many more.

So I really can't alter the class special to do this, just use an adjustment?
Either way thanks though! At least it will print out correctly now :)

edit: Just realized when modifying a rapier and then adding keen, it doesnt play nice. It wants to double this value too. not sure if you can do much about that.
 
Last edited:
So I really can't alter the class special to do this, just use an adjustment?
Either way thanks though! At least it will print out correctly now :)

edit: Just realized when modifying a rapier and then adding keen, it doesnt play nice. It wants to double this value too. not sure if you can do much about that.
Well I scripted an adjustment to demonstrate how the script can work. To make it work specifically for your class ability you will need to modify it to figure out a weapons starting value based on the weapon instead of 20 and then lower it by one.
 
Well I scripted an adjustment to demonstrate how the script can work. To make it work specifically for your class ability you will need to modify it to figure out a weapons starting value based on the weapon instead of 20 and then lower it by one.

Well I am trying to get it to work with a rapier.
With Find the mark it should crit from 17-20
add in keen and it should be 14-20...
I can either get it to say 15-20 or 13-20 because of it wanting to double the crit range. Ive tried raising the starting value 1 and lowering it by 1. If I lower it it says 11-20 crit range.
 
keen and it should be 14-20...

You have to back out Keen helper and do keen yourself. Here is code that says 14 on a rapier, but untested on anything else:
Code:
  <thing id="ipwCritMin" name="wCritMin change" compset="ItemPower" uniqueness="
unique">
    <comment>Test Code, not in production but works.</comment>
    <usesource source="test" parent="UserParent" name="Test Code"/>
    <tag group="wCritMin" tag="17"/>
    <tag group="PowerType" tag="Weapon" name="Weapon" abbrev="Weapon"/>
    <tag group="wCritMin" tag="16"/>
    <tag group="wCritMin" tag="14"/>
    <tag group="wCritMin" tag="15"/>
    <eval phase="Final" priority="50000"><![CDATA[var critmin as number
critmin = container.parent.tagnames[wCritMin.?,""] -1

var keen as number
keen = container.parent.tagis[Helper.Keen]
if (keen > 0) then
     perform container.parent.delete[Helper.Keen]
endif

if (critmin = 19) then
     if (keen > 0) then
          perform container.parent.assign[wCritMin.18]
     else
          perform container.parent.assign[wCritMin.19]
     endif
     perform container.parent.delete[wCritMin.20]
endif
if (critmin = 18) then
     if (keen > 0) then
          perform container.parent.assign[wCritMin.16]
     else
          perform container.parent.assign[wCritMin.18]
     endif
     perform container.parent.delete[wCritMin.19]
endif
if (critmin = 17) then
     if (keen > 0) then
          perform container.parent.assign[wCritMin.14]
     else
          perform container.parent.assign[wCritMin.17]
     endif
     perform container.parent.delete[wCritMin.18]
endif]]></eval>
    </thing>

You will also want to account for Improved Critical, I didn't in this code. Broadcast.ImpCrit is the tag.
 
Back
Top