Thread: SSET in SMAUG
View Single Post
Old 08-05-2002, 06:03 PM   #7
Nostrum
Member
 
Join Date: Apr 2002
Posts: 47
Nostrum is on a distinguished road
Send a message via ICQ to Nostrum
case ATCK_FYREBALL:
retcode = spell_fyreball( skill_lookup( "fyreball" ),
ch->level, ch, victim );
break;

in fight.c ln 487


if ( spell == spell_fyreball ) return "spell_fyreball";

in tables.c ln 811

if ( !str_cmp( name, "spell_fyreball" )) return spell_fyreball;

in tables.c ln 131

DECLARE_SPELL_FUN( spell_fyreball );

in mud.h ln 4250

the above are the modules and lines where the code lies. Is there a chance that my placement could have something to do with it? For instance, does SMAUG require an order to where every function is placed, and could that affect this as well? Also here is some advice i received:

The problem is you need to add ATCK_FYREBALL to the enumeration of mob attacks in mud.h. Ie, add it to this list, but before MAX_ATTACK_TYPE:

/*
* Attack types
*/
typedef enum
{
ATCK_BITE, ATCK_CLAWS, ATCK_TAIL, ATCK_STING, ATCK_PUNCH, ATCK_KICK,
ATCK_TRIP, ATCK_BASH, ATCK_STUN, ATCK_GOUGE, ATCK_BACKSTAB, ATCK_FEED,
ATCK_DRAIN, ATCK_FIREBREATH, ATCK_FROSTBREATH, ATCK_ACIDBREATH,
ATCK_LIGHTNBREATH, ATCK_GASBREATH, ATCK_POISON, ATCK_NASTYPOISON, ATCK_GAZE,
ATCK_BLINDNESS, ATCK_CAUSESERIOUS, ATCK_EARTHQUAKE, ATCK_CAUSECRITICAL,
ATCK_CURSE, ATCK_FLAMESTRIKE, ATCK_HARM, ATCK_FIREBALL, ATCK_COLORSPRAY,
ATCK_WEAKEN, ATCK_SPIRALBLAST, MAX_ATTACK_TYPE
} attack_types;

Youll notice that this list already has 32 entries... fortunately, mob attacks are an extended bitvector, meaning you are no longer limited to 32 flags.

Of course, youll also need to add "fyreball" to the attack_flags string array in build.c. The order of the above enumeration and the attack_flags string array must be preserved: thus, if you added ATCK_FYREBALL between ATCK_CURSE and ATCK_EARTHQUAKE, then you must add "fyreball" between "curse" and "earthquake".

I highly recommend that you add ATCK_FYREBALL at the very end (but still before MAX_ATTACK_TYPE): this will ensure that mobs whose attacks were saved before the change, will keep the same attacks.

There are other problems in the code you posted too.

When it loops through the room, it skips players who have wizinvis set to LEVEL_IMMORTAL (51). however, it is possible for imms to set their wizinvis to a mortal level higher than the caster (IE: caster is level 20, imm is wizinvis level 30). So you should change ">= LEVEL_IMMORTAL" to "> get_trust(ch)".

Furthermore, this code uses the act function badly... i quote:
act( AT_MAGIC, "A seering ball of flame from you,"
" engulfs $N",
ch, ch, vch , TO_CHAR );

The 4th argument of the act function is supposed to be a pointer to an object (or to NULL if the echo has nothing to do with objects). So you should change the above to
act( AT_MAGIC, "A seering ball of flame from you,"
" engulfs $N",
ch, NULL, vch , TO_CHAR );

Also, you call act twice, once with TO_CHAR as the 6th arg, and once with TO_ROOM as the 6th arg. This means the victim will see "A seering ball of flame from Bob, engulfs Joe", but they ought to see "A seering ball of flame from Bob, engulfs you".. note the YOU. this is a common error.

To correct it, use 3 acts: one with TO_CHAR as arg 6, one with TO_VICT as arg 6, and one with TO_NOTVICT as arg 6. TO_VICT will go only to the victim and TO_NOTVICT is the same as TO_ROOM except that it skips the victim. The one with TO_NOTVICT should be like the one you posted with TO_ROOM, the one with TO_VICT should replace "$N" with "you".

Hope this helps...

-thanks for the continued assistance-
Nostrum is offline   Reply With Quote