[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Summoning Mobs
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Summoning Mobs

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


Posted by Kain   USA  (43 posts)  [Biography] bio
Date Wed 03 Jul 2002 11:02 PM (UTC)
Message
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
[Go to top] top

Posted by Neves   USA  (78 posts)  [Biography] bio
Date Reply #1 on Wed 03 Jul 2002 11:19 PM (UTC)
Message
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
[Go to top] top

Posted by Chris L   USA  (57 posts)  [Biography] bio
Date Reply #2 on Thu 04 Jul 2002 08:23 PM (UTC)
Message
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 ___?
[Go to top] top

Posted by Kain   USA  (43 posts)  [Biography] bio
Date Reply #3 on Thu 04 Jul 2002 11:47 PM (UTC)
Message
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
[Go to top] top

Posted by Chris L   USA  (57 posts)  [Biography] bio
Date Reply #4 on Fri 05 Jul 2002 04:47 AM (UTC)

Amended on Fri 05 Jul 2002 04:49 AM (UTC) by Chris L

Message
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
[Go to top] top

Posted by Dark_Trunks   Australia  (27 posts)  [Biography] bio
Date Reply #5 on Fri 05 Jul 2002 03:20 PM (UTC)
Message
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.
[Go to top] top

Posted by Chris L   USA  (57 posts)  [Biography] bio
Date Reply #6 on Fri 05 Jul 2002 05:57 PM (UTC)
Message
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?
[Go to top] top

Posted by Kain   USA  (43 posts)  [Biography] bio
Date Reply #7 on Sun 07 Jul 2002 09:32 PM (UTC)
Message
Thanks Chris L., I appreciate the work
[Go to top] top

Posted by Kain   USA  (43 posts)  [Biography] bio
Date Reply #8 on Sun 07 Jul 2002 10:32 PM (UTC)
Message
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
[Go to top] top

Posted by Kain   USA  (43 posts)  [Biography] bio
Date Reply #9 on Sun 07 Jul 2002 10:59 PM (UTC)
Message
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?
[Go to top] top

Posted by Chris L   USA  (57 posts)  [Biography] bio
Date Reply #10 on Tue 09 Jul 2002 (UTC)

Amended on Tue 09 Jul 2002 12:01 AM (UTC) by Chris L

Message
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
[Go to top] top

Posted by Kain   USA  (43 posts)  [Biography] bio
Date Reply #11 on Tue 09 Jul 2002 11:42 PM (UTC)
Message
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
[Go to top] top

Posted by Chris L   USA  (57 posts)  [Biography] bio
Date Reply #12 on Wed 10 Jul 2002 01:40 AM (UTC)
Message
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?
[Go to top] top

Posted by Kain   USA  (43 posts)  [Biography] bio
Date Reply #13 on Wed 10 Jul 2002 02:15 AM (UTC)
Message
Excellent, thank you
[Go to top] 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.


8,016 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]