• 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

Samurai Class?

mxcpotato

Member
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.
 

Attachments

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.
 
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
 
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.
 
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...
 
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
 
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
 
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

Thank you guys again for the help!
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
 
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.
 
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.

Yeah, it seems to do the exact same thing my first one did and count any magic weapon. _-_

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
 
one method you could try was rather than searching for what the katana is equivalent to, create a new weapon in the editor with the appropriate qualities, label it exotic (since it requires exotic prof. according to the DMG), and use the elven courtblade as an example of how to make it still use feats labeled for bastard swords.

then in the script you can look for the specific weapon using picks on hero rather than using the complicated look for magic item script.

a little extra effort perhaps, but it makes the complicated stuff simpler.

Edit: had some time so I created the katana and wakizashi, file attached :)
item IDs for them are wKatana and wWakizashi respectively

secondary edit: realized magic weapons cannot be modified, and changed them to regular weapon classes with a +1 attack roll modifier instead.
 

Attachments

Last edited:
After spending some time on this I have come to the conclusion that the statement:
Code:
foreach pick in hero from BaseWep where "thingid.iMagWeapon & IsWeapon.wSwordBast"

While valid, isn't working because the thingid.iMagWeapon tag is taking precedence over the IsWeapon.wSwordBast tag. I believe this is the case because even when I change the code to:
Code:
foreach pick in hero from BaseWep where "thingid.wSwordBast"
Which is a valid thingid on both a regular Bastard Sword and on the Magic/Masterworked version, it still ceases to function on the item as soon as you add the "thingid.iMagWeapon" tag by making it through the Custom/Magic Item option.

I have also tried:
Code:
foreach pick in hero from BaseWep where "thingid.iMagWeapon & thingid.wSwordBast"
which once again ceases to fuction at all on either type of wepon. Any help on why or what I may be missing would help

Attached is a copy of my file for the class as well as a second level samurai with regular Bastard Sword/ Shortsword and Masterwork version of each. you can see how it works. in my .user file i went with this code:
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.wSwordBast"
if (eachpick.field[gIsEquip].value + eachpick.field[wIs2nd].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.wShortswd"
if (eachpick.field[gIsEquip].value + eachpick.field[wIs2nd].value <> 0) then
perform hero.assign[Hero.TwoWep]
done
endif
nexteach

Sorry for such a lengthy post, just trying to clarify my findings.

Thank You,
mXcPotato
 

Attachments

@Bluepheonix

Thank you for doing this, I had already done it but reading your post made me think of something, so i tried reimplementation of my own wKatana & wWakizashi, and found something else interesting.
If you just buy the Katana & Wakizashi as normal weapons (assuming base lvl2 Samurai, no stat alterations) then each weapon will be at +3(+2 BaB, +1mw). However if you attempt to make a magic item out of it by going to Magic,Custom & Masterwork Items, and stop after choosing either of them, you'll see that the attack bonus is only +2.

Also even when replacing the thingIDs in my previous script with the new ones, it ceases to work if they become magic, Unless i also have the mundane equivalents equip as well.

Then in the script you can look for the specific weapon using picks on hero rather than using the complicated look for magic item script.

^How do I do this?
 
Is there a way to use "perform hero.assign[]" to add a feat? I looked on the Wiki to no avail, and perform hero.assign[Feat.ImpTwoWep] doesn't work.

I need to go about it this way because it has to go at the bottom of the same script i've been posting to grant Imp TWF, and Greater TWF.

Good news is i figured out how to apply Kiai smite. yay!

Thank You,
mXcPotato
 
Is there a way to use "perform hero.assign[]" to add a feat?

Assign adds tags, not feats.

Feats can only be bootstrapped, and you can't add feats via scripts.

You could add a bootstrap to the feat in the ability and script the disabling of the feat (FtHide) and then script unhiding it when you want it unhidden.
 
Or you could bootstrap the feat and give it a condition that looks for a User tag on the hero. Only if this condition is fulfilled (i.e the tag is present) will the feat be bootstrapped. The just write an eval script that assigns that User tag or not as appropriate.
 
Or you could bootstrap the feat and give it a condition that looks for a User tag on the hero. Only if this condition is fulfilled (i.e the tag is present) will the feat be bootstrapped. The just write an eval script that assigns that User tag or not as appropriate.

I've got hours in trying this.
Can you post an example?

If I do anything that scripts adding the tag to the hero, it is always done later than the bootstrap. So it never gets bootstrapped.
 
Alright, got it. I don't think bootstrapping the feat on and off is the best way to do this, although it could be done that way. I'd rather follow your original approach of applying the Hero.TwoWep tag.

It was mostly a timing issue, at First 100 when you were running the script I don't think the iMagWeapon thing had taken any information from it's gizmo. So even though you were asking if it was a bastard sword, the info hadn't been pulled yet.

Here is the code, I tested it a bit but run it through it's paces yourself. Replace the current Eval Script for Two Swords as One with this. I would recommend you set the phase and priotity at Pre-Levels 10000

~ Search through all base weapons for anything that is a Magical Weapon or a Bastard Sword

var bastard as number

foreach pick in hero from BaseWep where "thingid.iMagWeapon|IsWeapon.wSwordBast"
~ Are we a bastard sword? (automatically yes for normal bastard swords, but may be yes or no for magical weapons)
if (eachpick.tagis[IsWeapon.wSwordBast] <> 0) then
~ Are we equipped in either hand?
if (eachpick.field[gIsEquip].value + eachpick.field[wIs2nd].value <> 0) then
bastard = 1
endif
endif
nexteach

~ Now find the same for short swords.

var shorty as number

foreach pick in hero from BaseWep where "thingid.iMagWeapon|thingid.wShortswd"
if (eachpick.tagis[IsWeapon.wShortswd] <> 0) then
~ Are we equipped in either hand?
if (eachpick.field[gIsEquip].value + eachpick.field[wIs2nd].value <> 0) then
shorty = 1
endif
endif
nexteach

~ If we have any number of bastard swords equipped bastard will be 1, and if we have any number of short swords equipped shorty should be 1. If we have both short swords and bastard swords equipped they will be 2 when added, and we should apply the two weapon fighting tag.
if (bastard + shorty = 2) then
perform hero.assign[Hero.TwoWep]
endif
 
Bootstrap conditions are important though, so it'd be instructive to tell you about them here. I noticed that your 8th level "Improved Initiative" Class Ability has bootstrapped the Improved Initiative feat. Well without a bootstrap condition that feat and it's effects will be present on a 1st level Samurai (I see a similar issue with the Improved and Greater Two Swords as One).

Go the Improved Initiative Class Ability, click on the Bootstrap button. To the right of the feat, there are 3 buttons, click on Conditions. This is where you can set rules for the bootstrap, if everything checks out then the bootstrap will go through, otherwise it won't.

Unfortunately, this "Tag Expression" window does not take kindly to the usual scripting... in fact I haven't quite figured it out myself. So far I know you can check for tags on the hero and the value of a field (maybe on the hero, maybe on the item itself?)

The most common condition is a certain number of class levels. You can do that by running the below at First 500:

count:Classes.WHATEVER >= SOMENUMBER

Where Whatever is the name of the class in question (not the name of the Class Level or the Class Helper, add a level of the class in question and look at the tags on the hero) and Somenumber is the minimum level before the thing should be bootstrapped. So in the example of your Improved Initiative Feat the bootstrap condition would be

count:Classes.Samurai >= 8

If you did want to do the above two weapon fighting thing via bootstrapping the feat rather than assigning the tag you could. You would have to make a new User tag and stick it on the class ability. You can make new User tags by scrolling to the bottom of most panels in the editor, clicking on the User Tags 'Edit' button, and then 'New Tag' at the top. Keep in mind that a tag must be on something for HL to know it exists, if you remove it from the last thing it is on (or delete that thing) HL will erase it the next time it loads, which will screw up any scripts you have written relying on the now disappeared User tag.

For example you could make a tag called User.Winner on the Two Swords as One ability. Then you would want to move the phase and priority of the previous post's code up to maybe First 1000. Otherwise the code would be the same except instead of "perform hero.assign[Hero.TwoWep]" it would be "perform hero.assign[User.Winner]". Then the class ability would bootstrap fTwoWep with a condition at about First 10000 saying:

count:User.Winner >= 1

Fascinating, no?
 
Back
Top