Summoning Mobs

Posted by Kain on Wed 03 Jul 2002 11:02 PM — 14 posts, 46,706 views.

USA #0
Hi all,

Does anyone know if anyone has written any code for summoning mobs to assist the summoner in battle or for other tasks?

If not, I am trying to (at least in my head first) figure out a good way to do this. My initial thoughts were to code (either a command or spell) something similar to the 'minvoke' wizard command. But I was kind of stuck as to how to make sure that the mob would attack another mob/pc and not the summoner.
So then...I thought this may have to be some kind of mobprog-hard coded spell-hybrid to be able to get this done.

As you may have figured out, I'm new to SMAUG (and MUD coding in general). Can anyone point me in a good direction or tell me if what I'm trying to do is even possible?

Thanks fot the time
USA #1
Probably the best way would be to make a spell where the Mob is summoned and then either protects the caster so if they get hit afterwards the mob joins in, or make it so the spell is casted at a target and the Mob will then attack the target and just put in a check to make sure the target isn't the caster or a non deadly char.

-Mark Calloway
USA #2
would just having the mob aff by charm like pets work? if so it will not be hard to make a spell that would create different monsters/animals or whatever to be the players pet or just a charmed mob that would like disappear after the charm wears off.. if charm would work say so and i can show u a way to set up a spell for it.. can always have players just order ____ kill ___?
USA #3
Thank you both for the good suggestions. Chris L, I think I will take you up on your offer. I'm still new at coding for Smaug, so it sounds like your suggestion is fairly easy to implement.

Thanks again
USA #4
sorry bout size agian
k heres a monster summoning snippet i wrote. started from a hack of animate dead but got out
of hand =(
works by letting caster summon certain mobs, and i think it would be easier makin 1 spell that will summon like 5-10 monsters then making a bunch of little spells, will prob need a help file to list all diff ones or can add it to the 'you cannont summon that' line
-open mud.h
- after
DECLARE_SPELL_FUN( spell_sacral_divinity );
- add
DECLARE_SPELL_FUN( spell_monster_summoning );
-after
#define MOB_VNUM_ANIMATED_CORPSE 5
-add
#define MOB_VNUM_MONSTER 69 /* unused right? =) */
-open tables.c
-after
if ( spell == spell_sacral_divinity ) return "spell_sacral_divinity";
-add
if ( spell == spell_monster_summoning ) return "spell_monster_summoning";
-after
if ( !str_cmp( name, "spell_sacral_divinity" )) return spell_sacral_divinity;
-add
if ( !str_cmp( name, "spell_monster_summoning" )) return spell_monster_summoning;
-open magic.c
-before
ch_ret spell_summon( int sn, int level, CHAR_DATA *ch, void *vo )
-add
/* monster summoning by keshmori */
ch_ret spell_monster_summoning( int sn, int level, CHAR_DATA *ch, void *vo )
{
MOB_INDEX_DATA *pMobIndex;
CHAR_DATA *mob;
AFFECT_DATA af;
char buf[MAX_STRING_LENGTH];

if ( target_name[0] == '\0' )
{
send_to_char( "What would you like to summon?\n\r", ch );
return rSPELL_FAILED;
}
if ( ( pMobIndex = get_mob_index(MOB_VNUM_MONSTER) ) == NULL )
{
send_to_char( "The monster does not exist! tell someone.\n\r", ch );
return rSPELL_FAILED;
}

mob = create_mobile( pMobIndex ); /* makes mob */
char_to_room( mob, ch->in_room );
if ( !str_cmp( target_name, "golem" ) )
{
sprintf(buf, "%s golem stone", ch->name);
STRFREE(mob->name);
mob->name = STRALLOC(buf);

sprintf(buf, "the golem of %s", ch->name);
STRFREE(mob->short_descr);
mob->short_descr = STRALLOC(buf);

sprintf(buf, "A stone golem stands here unmoving with a mark on its forehead reading %s.\n\r", ch->name);
STRFREE(mob->long_descr);
mob->long_descr = STRALLOC(buf);
/*can add own mob additions here*/
}
/* this is a dummy one to show more in detail how to make own monster options and customize this spell lil more */
else if ( !str_cmp( target_name, "elephant" ) ) /* keyword for c 'monster summoning' elephant */
{
sprintf(buf, "%s pink large elephant", ch->name); /* mobs keywords */
STRFREE(mob->name); /* gets rid of old name */
mob->name = STRALLOC(buf); /* replaces with ur name from buf above */

sprintf(buf, "the large pink elephant of %s", ch->name); /* what seen when fights or talks etc */
STRFREE(mob->short_descr);
mob->short_descr = STRALLOC(buf);

sprintf(buf, "A pink elephant stands here stomping around %s.\n\r", ch->name); /* room name */
STRFREE(mob->long_descr);
mob->long_descr = STRALLOC(buf);
mob->damroll = number_fuzzy(ch->damroll + 2); /* can change attributes to mobs to make specific to whatever monster is being summoned --chris */
mob->level = number_fuzzy(ch->level); /* can make dependant on the caster too */
mob->hit = mob->max_hit = number_fuzzy(ch->hit / 2); /* have hp = maxhp and this sets it to half of casters hp */
mob->mana = mob->max_mana = 0; /* mobs dont need mana */
}
/* end dummy monster */
else
{
send_to_char( "You cannont summon that.\n\r", ch );
return rSPELL_FAILED;
}
act(AT_DGREY, "$n summons $T!", ch, NULL, pMobIndex->short_descr, TO_ROOM);
act(AT_DGREY, "You summon $T!", ch, NULL, pMobIndex->short_descr, TO_CHAR);
/* for aff_charm on the monster, then summoner can order it to do whatever */
add_follower( mob, ch );
af.type = sn;
af.duration = (number_fuzzy( (ch->level + 1) / 4 ) + 1) * DUR_CONV; /* might wanna make longer or shorter */
af.location = 0;
af.modifier = 0;
af.bitvector = meb(AFF_CHARM);
affect_to_char( mob, &af );
return rNONE;
}
-then compile and log on, once on using immy type the following
sset create skill monster summoning
slookup 'monster summoning'
-after sn: will have a number, put that in for sn in the following
sset sn type spell
sset sn code spell_monster_summoning
sset sn wearoff !Monster Summoning!
sset sn mana 25
sset sn beats 12
sset save skill table
aa limbo.are
mcreate 69 monster
-these customizeable, just for default stats, might wanna change more/less whatever
mset 69 hitdie 1d1+500
mset 69 damdie 1d30+20
mset 69 level 20
mset 69 armor 0
mpedit 69 add rand 100
emote disappears in a whisp of white light.
/s
aa none
foldarea limbo.are
c 'monster summoning' elephant
-end
tell me if works or if get errors or whatever
Amended on Fri 05 Jul 2002 04:49 AM by Chris L
Australia #5
I have been working on a similar task with the difference that the mob summoned is actually a clone of the caster and I want the 'clone' to dissapear after the fight, or after 4 fighting rounds.

I've had no trouble with the 'summoning' part its the disappearing thats driving me up the wall. The following errors occur:
If the 4 rounds are up, the mud crashes.
If the clone kills the mob theres about a one in ten chance that it wont dissapear.
If the clone or the caster kills the mob and the clone does disappear, everything gets really unstable and it crashes in seemingly random places. The most notable thing though is that the caster's name gets changed to a '0'.

If anyones got any tips that'd be great, but I'm not too worried about it - if I cant fix it I've got a backup plan.
USA #6
what do u use for making mob disappear atm that crashes? i assume it isnt a mpprog like one i just demonstrated? perhaps you want set mob normal charm for like 5 hours or so then set it in fight.c in death module for if the mob who killed the guy was (ur vnum) then do some nunmber_range for the 1-5 chance if passes can remove the charm bit and have mpprog like one i showed, then the mob will disappear?
USA #7
Thanks Chris L., I appreciate the work
USA #8
Hi Chris L,

Everything seems to be fine, except perhaps in limbo.are

About every 5 seconds, the phrase from the code:

disappears in a whisp of white light

displays to the screen. I'm not that familiar (yet) with Limbo.are, so is this something that should be happening?

Thanks again
USA #9
Hi,

Nevermind, it looks like it keeps saying that because it is set on random 100.

The code works great, thanks again...


Here's a quick question though: Is there a reason you created it in Limbo rather than somewhere else?
USA #10
the rand 100 prog for the mob is so that once the charm wares off the mob it will emote that then goto a storage room to just spam whatever else is in that room =) since charmed mobs wont execute progs
its just way of getting rid of it, i have that mob in limbo because its a area everyone has, u should stay out of room 3 or else yeh u would get spammed, but without it then once charm wares off the mob will just stand there and wont be able to be ordered, plus the line that declared the mob as number 69 is in limbo.are if u want to change area in u have to make mob then change the vnum in mud.h
Amended on Tue 09 Jul 2002 12:01 AM by Chris L
USA #11
Hi,

2 more questions if you don't mind:

1. How do I make the mob say breath fire? Would it be something like mob->spec_func = breath_fire?

2. Would it be possible in the code to put a check in to make sure that the caster can only have 1 summoned monster at a time? I'm not asking for the actual code, I just want to make sure it can be done (semi-easily).

Thanks
USA #12
yeh the fire breathing can just mset (mob) spec firebreath or something or can add a mpprog that uses c 'fire breath' $r and for the 1 at time thing can make the summoned monsters pets, and have check if player already owns a pet for level.. that work?
USA #13
Excellent, thank you