• 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

CMB/CMD for weapons...

ShadowChemosh

Well-known member
My players are very forgetful about small bonuses like if a weapon was to give a +2 bonus on CMD vs disarm attempts. So when I added a new weapon called a cutlass I wanted to remind the players about this bonus so I created and attached the following script to the new item thing.
Code:
~Final Phase 10,001
var CMDdisarm as number
~Give the weapon the correct CMB for the players to see(ie remember)
CMDdisarm = hero.child[Maneuver].field[tCMD].value + 2 + hero.child[manDisarm].field[manBonus].value

~Check to see if proficient or not and to apply the -4 penalty if not
if (tagis[Helper.Proficient] = 0) then
   CMDdisarm -= 4
endif

~Set the livname to include (+bonus)
field[livename].text = field[thingname].text & "(CMD " & CMDdisarm & " Disarm)"

So the above worked out great until I added a Masterwork or Magical weapon. Then instead of getting for example Masterwork Cutlass(CMD 23 Disarm) I got Masterwork Cutlass. :(

A unique new thingid iMagWeapon was added for the masterwork cutlass and I can't seem to find this in the editor. I assume its another of those special hidden system/HL things.

So my question is can I still get to the livename iMagWeapon somehow to change it? Is their some way of adding CMB/CMD for each weapon like the new Maneuver Type Display that was added for when taking Improved feats?

Thanks
 
Here's the code from the sawtooth sabre - it's an example of how weapon and armor scripts need to be modified to take the custom versions into consideration:

Code:
~ If we have exotic weapon proficiency for this weapon, we're Light
if (tagis[Helper.ExoticProf] <> 0) then
  perform delete[wClass.OneHanded]
  perform assign[wClass.Light]
  endif
~if we're a custom/magic weapon, we need to alter our parent, too
if (container.ishero = 0) then
  if (container.parent.tagis[Helper.ExoticProf] <> 0) then
    perform container.parent.delete[wClass.OneHanded]
    perform container.parent.assign[wClass.Light]
    endif
  endif

I recommend you look up the hero.child[manDisarm].field[manCMD].value, rather than the manBonus - manCMD includes manBonus, and there could be other things that add CMD bonuses, but since they don't add CMB bonuses, too, they don't modify manBonus.

If you do so, move your script to after Final/20000, which is when manCMD is calculated.

What's actually happening for a custom/magic weapon (or one of the specific magic weapons created in the editor) is that the pick you are adding is "iMagWeapon" - that pick looks up the weapon you have specified and retrieves information from it to set up the weapon stats. The retrieval is done very early (in the First phase, I think), since the intent is to retrieve all that information before iMagWeapon has to calculate anything with it.

While those maneuvers that display on the basics summary are available in the editor, I would not recommend creating a new one for each weapon you want to display - just seems so cluttered - you also won't be able to take the effects of Improved Disarm or other feats and effects into account without a lot of work looking up the original.
 
Here's the code from the sawtooth sabre - it's an example of how weapon and armor scripts need to be modified to take the custom versions into consideration:
Nice thanks that was the type of example I was looking for actually.

I recommend you look up the hero.child[manDisarm].field[manCMD].value, rather than the manBonus - manCMD includes manBonus, and there could be other things that add CMD bonuses, but since they don't add CMB bonuses, too, they don't modify manBonus. If you do so, move your script to after Final/20000, which is when manCMD is calculated.
Hmm ok will look at this. Though I was just trying to look for any specific manBonus to add to my total. When I was testing before I ran into problems with manCMD as I got an error message saying I was trying to use a field without a value. So I thought manCMD was only getting a value if manBonus was greater than zero. Maybe it was a timing issue as I was using 10,000 and you say I should use Final/20,000.

While those maneuvers that display on the basics summary are available in the editor, I would not recommend creating a new one for each weapon you want to display - just seems so cluttered - you also won't be able to take the effects of Improved Disarm or other feats and effects into account without a lot of work looking up the original.
I think we are on two different pages or at least I am not following what you mean. For weapons like a double weapon HL prints the different types of attacks that can be done with the weapon which nicely reminds the player of this during the game and prevents them from having to do the calc themselves. I was thinking that additional information regarding bonuses to CMD/CMB could be shown also to help remind players of any additional bonuses a weapon gives. My players are very forgetful and if they are wielding a flail and the sheet does not say(+2 to disarm) they will never remember to add it in.

For future readers here is the finished script encase anyone is interested:
Code:
~Final Phase 20,000
var CMDdisarm as number
~Give the weapon the correct CMB for the players to see(ie remember)
CMDdisarm = hero.child[Maneuver].field[tCMD].value + 2 + hero.child[manDisarm].field[manBonus].value

~Check to see if proficient or not and to apply the -4 penalty if not
if (tagis[Helper.Proficient] = 0) then
   CMDdisarm -= 4
endif

~Set the livname to include (+bonus)
field[livename].text = field[thingname].text & "(CMD " & CMDdisarm & " Disarm)"

~if we're a custom/magic weapon, we need to alter our parent, too
if (container.ishero = 0) then
  ~Add in weapon enhancment to value as it counts towards disarms
  CMDdisarm += container.parent.field[wAttBonus].value
  ~update container livename
  container.parent.field[livename].text = container.parent.field[livename].text & "(CMD " & CMDdisarm & " Disarm)"
endif
 
Hmm ok will look at this. Though I was just trying to look for any specific manBonus to add to my total. When I was testing before I ran into problems with manCMD as I got an error message saying I was trying to use a field without a value. So I thought manCMD was only getting a value if manBonus was greater than zero. Maybe it was a timing issue as I was using 10,000 and you say I should use Final/20,000.

manBonus is added to manCMD at Final/20000 - that way, you can apply a manBonus if your thing grants a bonus to both CMB and CMD, you can apply a CMB only bonus with manCMB, and you can apply a CMD only bonus with manCMD. For example, the Improved Maneuver series of feats only need to add a manBonus modifier, not both, so only one line of code is needed, and the Greater Maneuver series of feats can apply a manCMB modifier without altering the CMD.

Remember to put your script after Final/20000 if you want to use manCMD, not at Final/20000.
 
manBonus is added to manCMD at Final/20000 - that way, you can apply a manBonus if your thing grants a bonus to both CMB and CMD, you can apply a CMB only bonus with manCMB, and you can apply a CMD only bonus with manCMD. For example, the Improved Maneuver series of feats only need to add a manBonus modifier, not both, so only one line of code is needed, and the Greater Maneuver series of feats can apply a manCMB modifier without altering the CMD.

Remember to put your script after Final/20000 if you want to use manCMD, not at Final/20000.
Ahhh ok I finally get it now with a few tests I see that manCMB is still just the bonus not the total value that actually gets shown on the character sheet. :)

I also just found that MW weapons and +1 weapons actually apply their bonus to two different values on the weapon Thing. Interesting...

So again encase others are interested here is the really final working script with manCMD.

Code:
~Final Phase 20,500
var CMDdisarm as number
~Give the weapon the correct CMB for the players to see(ie remember)
CMDdisarm = hero.child[Maneuver].field[tCMD].value + 2 + hero.child[manDisarm].field[manCMB].value

~Check to see if proficient or not and to apply the -4 penalty if not
if (tagis[Helper.Proficient] = 0) then
   CMDdisarm -= 4
endif

~Set the livname to include (+bonus)
field[livename].text = field[thingname].text & "(CMD " & CMDdisarm & " Disarm)"

~if we're a custom/magic weapon, we need to alter our parent, too
if (container.ishero = 0) then
  ~Add in MW weapon enhancement to value as it counts towards disarms(this value is 0 when weapon is not MW)
  CMDdisarm += container.parent.field[wAttBonus].value
  ~Add in +1 weapon enhancement to value as it counts towards disarms(note this value is 0 when weapon is not +1 or greater)
  CMDdisarm += container.parent.field[wBonus].value
  ~update container livename
  container.parent.field[livename].text = container.parent.field[livename].text & "(CMD " & CMDdisarm & " Disarm)"
endif

Thanks again Mathias :)
 
I have more questions concerning magic weapons and figured I may as well put them in here instead of creating a whole new thread. I am trying to add the following:

Taldor Echoes of Glory said:
Pitfall: This ability can only be placed on a melee weapon. A weapon with the pitfall quality gives you a heightened danger sense. When holding a pitfall weapon, apply the weapon’s enhancement bonus to your initiative checks, Reflex saves made to avoid traps, and AC against attacks made by traps. For example, a +5 pitfall longsword gives you a +5 bonus to initiative, +5 to Reflex saves made to avoid traps, and a +5 bonus to AC against attacks made by traps. Wielding two weapons with the pitfall weapon quality only grants the bonuses from the better weapon.

Its giving me all sorts of issues. I figure the only thing I can script for is the Initiative check which I thought would be easy. The first issue is that gIsEquip turns out only works when you put the weapon in the primary(ie 1st) hand and not when its in the off-hand. How does one figure out if the weapon is in the off-hand(2nd) is checked marked? I assumed gIsEquip would have a value of 1 as the weapon is equipped, but that is not the case.

The next issue is I thought I could read through all the weapons on the hero and see how many are Pitfall weapons(thingid.ipPcPitfal) and then figure out which one has the greatest Plus. The problem is I can't seem to figure out how to know what magic properties are on a weapon. Their is iCustSumm, but that brings me to the next problem.

It appears one can NOT compare strings in the HL scripting language IF function? If I create a string variable called X and make it have a value of "Shadow" and then try and compare it to another string variable holding "Day" the IF statement always comes out TRUE. Heck if I compare X with the number 1 it comes out TRUE also.

With this in mind I am assuming their is no such function like "Scan" that allows one to scan a string for a set of characters? So that pretty much leaves out iCustSumm as being any use. While on the subject of IF statements can one do AND/OR in HL's IF statements?

So to sum up I would like to know how/when a weapon is equipped in the off-hand. Could also like to know if its possible to figure out which magical property has been applied to a weapon.

Thanks
 
The off-hand is field[wIs2nd].value

The script making those modifications should go on the magic item power, rather than something external. Is the bonus type it applies a stacking type? If so, the stacking will be handled by Hero Lab. If not, you could have the item power tell a central Ability what it's value is (if its value is greater than the central thing's value), and then have the central Ability apply the bonuses.
 
Ahhh thanks that helped point me in the right direction. I created a new Maneuver Type and used it to hold the variables as I only want to apply the Biggest bonus if two different weapons are equipped.

I have less control of things than in my normal programming so I appreciate the nudge in the right direction Mathias.

Thanks
 
In my opinion, an Ability (created on the Ability tab in the editor) is more appropriate than a new maneuver type. You should bootstrap it from the item power, and make sure to make it unique so that only one copy ends up being added no matter how many times the item power appears on the character.
 
I couldn't figure out how to make an ability unique. And using a maneuver did the work for me of not only unique, but always adding to the hero. Plus it had all sort of nice Bonus Types already part of the Thing. :)

How exactly does one make an ability that is bootstrapped unique occurrence?
 
Between the Unique Id and the Summary in the editor is a selector that lets you select the uniqueness of a thing - you can choose between "No", "Unique", and "Add Once". Choose "Unique" for this ability.
 
In my opinion, an Ability (created on the Ability tab in the editor) is more appropriate than a new maneuver type. You should bootstrap it from the item power, and make sure to make it unique so that only one copy ends up being added no matter how many times the item power appears on the character.
So I had some extra time and went back to change this Item Power ability to use an Ability instead of a maneuver type. I am bootstrapping on a new ability to the Item Power, but when I create a magic weapon with the Item Power the Bootstrapped Ability is not coming along. Or at least I can't find it on the hero or access it from a script.

I double checked the xChannel ability to see if had anything special when bootstrapping, but I didn't notice anything. Is their something special I am missing that is required for an Item Power to bootstrap an Ability?

Thanks
 
So I had some extra time and went back to change this Item Power ability to use an Ability instead of a maneuver type. I am bootstrapping on a new ability to the Item Power, but when I create a magic weapon with the Item Power the Bootstrapped Ability is not coming along. Or at least I can't find it on the hero or access it from a script.

I double checked the xChannel ability to see if had anything special when bootstrapping, but I didn't notice anything. Is their something special I am missing that is required for an Item Power to bootstrap an Ability?

Thanks
Bump as this has fallen to the 2nd page and I assume Mathias you just missed this.

Thanks
 
Okay, it looks like item powers can't have bootstraps.

Is it going to be common enough that a character has two pitfall weapons that you need to calculate the bonus for the user? Since the bonus is so situational, it's not something that you're going to apply to any of the stats on the character - it's only going to be presented as information, so just put the details of the power in the description/summary text for the item power.
 
Okay, it looks like item powers can't have bootstraps.

Is it going to be common enough that a character has two pitfall weapons that you need to calculate the bonus for the user? Since the bonus is so situational, it's not something that you're going to apply to any of the stats on the character - it's only going to be presented as information, so just put the details of the power in the description/summary text for the item power.
No problem. I just wanted to make sure I was not missing something. I have it working just fine using a Maneuver as the common place instead of a Bootstrapped ability. I was just trying to get the more 'proper' way of doing things to work.

Thanks
 
Back
Top