Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ summoned NPC isn't charmed (help please!)

summoned NPC isn't charmed (help please!)

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Gogoicarus   Japan  (15 posts)  Bio
Date Mon 03 Sep 2007 05:16 AM (UTC)
Message
hey, we're working on creating a kind of joke homonculus. using pieces from a pre-existing familiar summoning code as well as animate dead, we thought we had it pretty well worked out.

however, when the NPC is summoned, there is no charm applied to it. it follows the summoner but can't be ordered to do anything. this may just be a bug in our test MUD but i'm baffled.

here is the code. any help is appriciated.

----------------------------
#define MOB_VNUM_DAISY 30807
/* More daisy madness */
ch_ret spell_daisy_daisy( int sn, int level, CHAR_DATA *ch, void *vo )
{
MOB_INDEX_DATA *pMobIndex;
CHAR_DATA *mob;
SKILLTYPE *skill = get_skilltype(sn);
AFFECT_DATA af;

if ( ch->pcdata->pet != NULL )
{
send_to_char("You already have a companion.\n\r",ch);
failed_casting( skill, ch, NULL, NULL );
return rSPELL_FAILED;
}
if(ch->position == POS_FIGHTING)
{
send_to_char("You can't grow flowers while in fighting!\n\r",ch);
failed_casting( skill, ch, NULL, NULL );
return rSPELL_FAILED;
}

if ( ( pMobIndex = get_mob_index(MOB_VNUM_DAISY) ) == NULL )
{
send_to_char( "The daisy mob doesn't exist.\n\r", ch );
return rSPELL_FAILED;
}


if(ch->in_room->sector_type == SECT_INSIDE
|| ch->in_room->sector_type == SECT_WATER_SWIM
|| ch->in_room->sector_type == SECT_WATER_NOSWIM
|| ch->in_room->sector_type == SECT_AIR )
{
send_to_char("This doesn't seem like the place to grow daisies...\n\r",ch);
failed_casting( skill, ch, NULL, NULL );
return rSPELL_FAILED;
}

mob = create_mobile( pMobIndex );
char_to_room( mob, ch->in_room );
mob->level = 1;
mob->hit = mob->max_hit;
mob->damroll = ch->level / 8;
mob->hitroll = ch->level / 6;
mob->alignment = ch->alignment;

act(AT_MAGIC, "$n gardens the ground and grows a daisy!", ch, NULL, NULL, TO_ROOM);
act(AT_MAGIC, "You garden the ground and grow a daisy!", ch, NULL, NULL, TO_CHAR);

add_follower( mob, ch );
/* added some stuff to make the mob your pet */
mob->leader = ch;
ch->pcdata->pet = mob;
xSET_BIT(mob->act, ACT_PET);
xSET_BIT(mob->affected_by, AFF_CHARM);
/* end tochi additions */
af.type = sn;
af.duration = 0; //We want these to follow indefinitely ~Khtall
af.location = 0;
af.modifier = 0;
af.bitvector = meb(AFF_CHARM);
affect_to_char( mob, &af );

return rNONE;

}
---------------------

Star wars 'is a good movie.'
Top

Posted by Gohan_TheDragonball   USA  (183 posts)  Bio
Date Reply #1 on Mon 03 Sep 2007 06:26 AM (UTC)
Message
what does your add_follower function look like, because mine does everything your code is trying to do already, and mine is stock, so im assuming your doing things twice right now.


add_follower( mob, ch );
/* added some stuff to make the mob your pet */
mob->leader = ch;
ch->pcdata->pet = mob;
xSET_BIT(mob->act, ACT_PET);
xSET_BIT(mob->affected_by, AFF_CHARM);
/* end tochi additions */
af.type = sn;
af.duration = 0; //We want these to follow indefinitely ~Khtall
af.location = 0;
af.modifier = 0;
af.bitvector = meb(AFF_CHARM);
affect_to_char( mob, &af );


try just this and see if it works


xSET_BIT(mob->act, ACT_PET);
add_follower( mob, ch );
af.type = sn;
af.duration = 0; //We want these to follow indefinitely ~Khtall
af.location = 0;
af.modifier = 0;
af.bitvector = meb(AFF_CHARM);
affect_to_char( mob, &af );
Top

Posted by Darwin   USA  (125 posts)  Bio
Date Reply #2 on Mon 03 Sep 2007 10:04 PM (UTC)
Message
Quote:
af.duration = 0; //We want these to follow indefinitely ~Khtall

This should probably be -1 not 0. As soon as your mob is summoned and the check is made on its spell's duration, the spell is removed. A duration of -1 will make the spell last forever, or at least until the mob is dismissed or killed, or the player logs out.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


13,121 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.