> I'm currently tinkering with Circle 3bpl8 and was trying to add a
> special proc. for some items. What I wanted the proc to do is during
> combat, the item would automagically cast an offensive spell at the
> opponent. Unfortunately, all I've gotten the proc to do is to cast the
> spell when I wield/unwield the weapon in question. This has caused...well..
> some interesting side effects (namely when someone flees, and I unwield at the
> right moment, they die in another room, and get no exp/gold).
> What I'd like to know is where I should start looking to fix this minor
> annoyance and/or what I need to hack up to make this work.
>
I dont know where you'd look to fix that... actually I'm not even sure
how you got it to activate on wield/unwield without explicitly trying to,
but here's a quick hack to do what I think you want... (BTW I think it
is debatable whether or not using a special process for this is the most
efficiant way to have weapons cast spells in combat - I would/do use an
APPLY_ for this sort of thing, with the spell contained therein, and stick
it somewhere between the calculation of hitting and dammage.
--snip--
/**
* All this does is check if the weapon in question is equipped, and
* if the person using it is fighting, then it grabs value 0 (which
* is unused in weapons) as a spell number and casts it on whoever
* is fighting the person using the "magical" weapon.
**/
SPECIAL(magic_weapon)
{
struct obj_data *weapon = me;
if (!weapon->worn_by || GET_POS(weapon->worn_by != POS_FIGHTING)
return 0;
else
cast_spell(weapon->worn_by, FIGHTING(weapon->worn_by, NULL, GET_OBJ_VAL(weapon, 0), NULL);
return 1;
}
--snip--
Regards,
Sky
This archive was generated by hypermail 2b30 : 12/07/00 PST