Here is the tarbaby/baaz draconian weapon-stealing effect that I asked about
yesterday. I worked it out and tested it a couple of times and it does seem to
work. Note that the item does show back up in the creature's drop pile after it
disintegrates, so no worries about permanent loss.
[.nwscript] //Goes in OnDeath for the creature
void main()
{
object oKiller=(GetLastKiller());
object oWeapon=(GetLastWeaponUsed(oKiller));
int nKindOfWeapon=GetBaseItemType(oWeapon);
//Gets the NPC's Killer, the weapon used in the murder,
//and the room it was done in... er the base weapon type
int nRefSave = (ReflexSave(oKiller, 13, SAVING_THROW_TYPE_NONE, OBJECT_SELF));
//Goes ahead and requests the Reflex save, DC 13 (you could probably move this
to
//later in the If sequence, but it was easier to put it here
if (nKindOfWeapon = BASE_ITEM_CSLASHWEAPON || BASE_ITEM_CSLSHPRCWEAP ||
BASE_ITEM_CPIERCWEAPON)
{
if (nKindOfWeapon != BASE_ITEM_SHORTBOW || BASE_ITEM_LONGBOW ||
BASE_ITEM_LIGHTCROSSBOW || BASE_ITEM_HEAVYCROSSBOW)
//Finds out if the creature was killed with a Piercing/Slashing/Both weapon that
is
//NOT a ranged weapon.
{
if (nRefSave = 0)
{
ActionTakeItem(oWeapon, oKiller);
}
//If the above Reflex save was a failure, here's where the PC loses the murder
weapon.
//Don't worry though, it turns up in the creature's Dropped items (sadly, it is
removed
//from the quickslots, but if you didn't want to annoy players, why use this?
else ClearAllActions();
}
else ClearAllActions();
}
else ClearAllActions();
}[./nwscript]
Suggested Variations:
Currently this will only take Piercing, Slashing, or Piercing/Slashing weapons.
You can add other item types by looking at the other BASE_ITEM_ constants in the
constant list on the scripter.
Currently this ignores bows and crossbows, but again you can remove that or add
other ignored sub-types of weapons.
I think that putting this in the OnDamaged script and replacing GetLastKiller
with GetLastDamager would make this go off every time the creature is dealt
damage, but I haven't tried it just yet.
You could probably change the commands around to make a character that steals
all sorts of items on a successful attack, if you just wanted to have a sticky
fingered foe. Throw in the script that equips the best weapon and you could have
a fight where the monster starts out easy and soon is fighting with all the PC's
equipment.
Obviously, the reflex save of 13 is fairly easy for mid-level Reflex-high
characters, but very difficult for low level characters without a good save.
Adjust to annoyance preference.
Thanks to everyone that messaged me and convinced me to actually get around to
trying out scripting last night. Enjoy.
edit: the NWScript tags don't seem to have worked. Anyone have any advice on
why?
_________________
~Samhaine
All things are defined by names. Change the name, and you change the thing. Of
course there is a lot more to it than that, but paracosmically that is what it
boils down to... -Pratchett, Pyramids