Junior Member
Join Date: Sep 2010
Location: Sacramento, CA
Posts: 19
|
I spent a great deal of today trying to build the Samurai base class, and ran into a bit of a hitch and was wondering if I could get some help.
my first problem is with this script: ~ Find a Katana equipped in the primary hand - if we don't find it, ~ get out now. var isfound as number foreach pick in hero where "thingid.iMagWeapon" if (each.field[gIsEquip].value <> 0) then isfound = 1 endif nexteach if (isfound = 0) then done endif ~ Now find a Wakizashi in the secondary hand - if we find it, ~ we can add the 'two weapon fighting' tag to the hero, then ~ get out. foreach pick in hero where "thingid.iMagWeapon" if (each.field[wIs2nd].value <> 0) then perform hero.assign[Hero.TwoWep] done endif nexteach It works great for Two Swords as One, but I don't know how to modify it add a feat for the later versions (Imp. Two Swords as One, and Greater). The second problem I am having is with the Kiai Strike ability. I attempted to set it up in the same manner Smite Evil appears to be, but i must have buggered the script somewhere. included is a pretty finished version of the Samurai, all errors included. Thank You, mXcPotato. |
#1 |
Senior Member
Volunteer Data File Contributor
Join Date: Mar 2007
Posts: 1,245
|
Have you tested that script extensively? Looking at it off the top of my head I think it would check to see if any magic/custom weapon is equipped, not just a katana and wakizashi as you want.
|
#2 |
Junior Member
Join Date: Sep 2010
Location: Sacramento, CA
Posts: 19
|
Right, the problem is that katanas and wakizashis are masterwork versions of bastard swords and short swords respectively, and the uniqueID for that is iMagItem. if you make them as magic items, such as iKatana, then the player cannot upgrade them, and if you make them a new item, wKatana, then when you go to upgrade them using Custom/Magic Items in the Weapons tab as they become iMagItem and the scirpt fails to recognize them -_-
Is there a way to make a Magic Item in the editor that can have enchantments added to it without changing its uniqueID? Thank You, mXcPotato |
#3 |
Senior Member
Join Date: Feb 2007
Location: Nottinghamshire, United Kingdom
Posts: 1,265
|
Have you thought about adding specials called Katana and Wakasashi into the user file, then bootstrapping them onto the items. Your script could then check for the imagitem tag as well as the bootstrapped ids.
If its a Magic item but not a Katana or Wakasashi then it's false. |
#4 |
Senior Member
Volunteer Data File Contributor
Join Date: Mar 2007
Posts: 1,245
|
There is a way to look for the weapon that is linked to the iMagItem thing, I did it once... let me try and look up where...
|
#5 |
Senior Member
Volunteer Data File Contributor
Join Date: Mar 2007
Posts: 1,245
|
Err, nevermind it is simpler than I gave it credit for, just check for the appropriate IsWeapon tag on the iMagItem thing.
Like so: var isfound as number foreach pick in hero where "thingid.iMagWeapon" if (each.tagis[IsWeapon.wSwordBast] <> 0) then if (each.field[gIsEquip].value <> 0) then isfound = 1 endif endif nexteach |
#6 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Lawful_g, don't forget to use from statements in foreaches if possible, and that "each" is deprecated - "eachpick" is preferred.
Code:
var isfound as number foreach pick in hero from BaseWep where "thingid.iMagWeapon & IsWeapon.wSwordBast" if (eachpick.field[gIsEquip].value + eachpick.field[wIs2nd].value <> 0) then isfound = 1 endif nexteach |
#7 |
Junior Member
Join Date: Sep 2010
Location: Sacramento, CA
Posts: 19
|
Wow!!! Thank you guys so much for all of your help! especially with the holidays, I had to work on it for a little bit because I was actually learning it as I went' but with your help I got some code that actually worked.
Code:
~ Find a Katana equipped in the primary hand - if we don't find it, ~ get out now. var isfound as number foreach pick in hero where "thingid.iMagWeapon" if (each.field[gIsEquip].value + each.tagis[IsWeapon.wSwordBast] <> 0) then isfound = 1 endif nexteach if (isfound = 0) then done endif ~ Now find a Wakizashi in the secondary hand - if we find it, ~ we can add the 'two weapon fighting' tag to the hero, then ~ get out. foreach pick in hero where "thingid.iMagWeapon" if (each.field[gIsEquip].value + each.tagis[IsWeapon.wShortswd] <> 0) then perform hero.assign[Hero.TwoWep] done endif nexteach now is there a way I can have it add a feat instead of the "preform hero.assign[Hero.TwoWep]"? Thank You Thank You Thank You! mXcPotato |
#8 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Note that the script you've written will be fine if there's an equipped +1 longsword on the character, rather than an equipped Katana.
field[gIsEquip].value - that's whether or not the weapon is equipped in the primary hand each.tagis[IsWeapon.wSwordBast] - that will be 1 if this is a bastard sword, 0 if not. By adding them together, and checking that the total is not = 0, you're asking whether either is true. May I recommend starting with my script - that checks whether it's a bastard sword separately from checking whether it's equipped, and by looking at wIs2nd as well, it's checking if the weapon is equipped in the off hand. |
#9 |
Junior Member
Join Date: Sep 2010
Location: Sacramento, CA
Posts: 19
|
Quote:
However, when I attempt to apply your code into the mix it either achieves the same results, or fails to resolve at all (as in no Two Weapon Fighting). I thought I had it, guess I am missing something key though. I'll have to try tomorrow when I'm not so tired. Thank you for your continued help and patience, mXcPotato |
|
#10 |
|
|