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;
}
--------------------- |