Re: [newbie] another error with weapon spells with bpl21

From: Mike Stilson (
Date: 06/29/02

On Sat, Jun 29, 2002 at 07:47:52PM +0200, Peter d wrote:
>>Well, the "hit" variable was used (I think I put it in some comments in
>>the snippet) because of the way I implemented multi-hits.  I only wanted
>>the weapon to go off once per round when there was one or more
>>successful hits.
>I too am using multihit for players, and multihit for mobs..
>any suggestions on how to make it happen the way you did it?
>hit = FALSE; did not work anyways..

If you do like I originally had, it was a for(i=num_hits(ch); i; i--)
loop.  Make sure the call to weapon_spell() is outside the loop.
Make sure to define hit=FALSE in the definitions, hit=TRUE only in the
section where ch does hit the victim.

>what kind of annoying problems would that be? so that i won't be surprised
>when i get them :)

The two most annoying to me were:
1: You can't just delete a spell using just that snippet code.
   You need to add some code like (It's been a while, so this may be off
   a li'l bit.):
        if(!(number = atoi(arg)) {
          OLC_OBJ(d)->wpn_spells[OLC_VAL(d)].spell = 0;
          OLC_OBJ(d)->wpn_spells[OLC_VAL(d)].percent = 0;
          OLC_OBJ(d)->wpn_spells[OLC_VAL(d)].level = 0;
        } else { .... rest of code }

        Now if you enter 0 for the spellnum it'll delete that spell.

2: It didn't handle 'helpful' spells like cure serious.  It took I think
2 or 3 supporting functions to handle those nice & neatly.

3: (Yeah, I know I said 2) if you have ranged combat, it's going to take
lots and lots of checking, tweaking, and twiddling to fit them in nicely
with however you implemented it.

>is it easy to implement the weapon spells into stat and identify?
piece of cake.

in stat/ident just check for obj->wpn_spells[0].spell != 0
then just a quick loop from 0 -> MAX_WPN_SPELLS until spell == 0 again,
#define wsp obj->wpn_spells[counter]
        send_to_char(ch, "Casts %s at level %d, %d%% of the time.\r\n",
                spell_info[wsp.spell], wsp.level, wsp.percent);
#undef wsp

I'm still thinking of finding my last version before I rewrote combat
altogether (went to speed/initiative based combat, and handling weapon
spells became a little bit more of a nightmare.)


   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT