|
Monkeys. Exploding Monkeys! [by Jason Buckler] |
|
|
|
Posted Wednesday, August 12th @ 11:31:45 PM, by George Greer in the Specials dept.
Added Feb 22, 1997. Click the link below to read it or download it.
From: Jason Buckler <doobie@ibm.net>
Subject: Exploding monkeys
I worked on this awhile back and asked for/got assistance on it. Got it
working and have been running it since. It works real well; to the point
that I scream in terror whenever I see one of the monkeys (I have them
with hidden/invis/sneak flags on for added fun. :) Code is rather
simplistic, but I'm still learning..
It's a pure-fun kinda thing, and I made the mob a monkey as it struck me
as funny at the time... He randomly steals something from you, sacrifices
it (or donate/junk - just change the code), then "explodes", leaving the
poor player with no course of
action for revenge..
Use an existing mob, or create a new one, and ASSIGNMOB() it in
spec_assign.c, and slap the code below into spec_procs.c
Thanks to Daniel and a few others for code assistance when I was working
on this, and to whoever wrote the do_sac code. See the snippet page for
the modified do_sac code that JTRHone submitted.
SPECIAL(monkey)
{
struct char_data *vict;
struct obj_data *obj, *list;
int to_take, obj_count = 0, found = 0;
ACMD(do_sac);
if ((cmd) || (GET_POS(ch) != POS_STANDING))
return FALSE;
/* Pick a victim */
for (vict = world[ch->in_room].people; vict; vict = vict->next_in_room)
if (!IS_NPC(vict) && (GET_LEVEL(vict) < LVL_IMMORT) && (!number(0,
4)))
{
if (AWAKE(vict) && (number(0, GET_LEVEL(ch)) == 0))
{
act("You gasp as you realize $n is attempting to take something
from you!", FALSE, ch, 0, vict, TO_VICT);
act("$n just tried to take something from $N!", TRUE, ch, 0, vict,
TO_NOTVICT);
return TRUE;
} else
{
/* Decide whether to take armor or object */
switch(number(0,3)) {
case 0:
case 2:
break;
case 1:
log ("in monkey - case 1");
to_take = number(0, 25);
if (GET_EQ(vict, to_take) && CAN_SEE_OBJ(ch, GET_EQ(vict,
to_take)))
{
obj = GET_EQ(vict, to_take);
act("$n has just stolen $p from $N!!",
FALSE, ch, obj, vict, TO_NOTVICT);
act("$n has just stolen $p from you!!",
FALSE, ch, obj, vict, TO_VICT);
obj_to_char(unequip_char(vict, to_take), vict);
obj_from_char(obj);
obj_to_room(obj, ch->in_room);
do_sac(ch, obj->name, 0, 0);
act("$n has just exploded into little bitty bits!",
FALSE, ch, 0, 0, TO_ROOM);
extract_char(ch);
return TRUE;
}
break;
case 3: /* object */
list = vict->carrying;
for (obj = list; obj; obj = obj->next_content) {
if (CAN_SEE_OBJ(vict, obj)) {
obj_count += 1;
found = 1;
}
}
if (found == 1) /* Ok, they're carrying something, so pick one
*/
{
to_take = number(0, obj_count);
obj_count = 0;
for (obj = list; obj; obj = obj->next_content)
{
obj_count += 1;
if (obj_count == to_take)
{
act("$n has just stolen $p from $N!!",
FALSE, ch, obj, vict, TO_NOTVICT);
act("$n has just stolen $p from you!!",
FALSE, ch, obj, vict, TO_VICT);
obj_from_char(obj);
obj_to_room(obj, ch->in_room);
do_sac(ch, obj->name, 0, 0);
act("$n has just exploded into little bitty bits!",
FALSE, ch, 0, 0, TO_ROOM);
extract_char(ch);
return TRUE;
}
}
break;
}
} /* end case 2 */
}
}
return FALSE;
}
Dazzit.
Buck
<< Mob Stacking [by PD] | Reply | View as text | Flattened | Multi Attack for Mobs [by Christian Duvall] >> |
|
Related Links |
|
|
|
CircleMUD Snippets |
|
|
Note: Not all of these snippets will work perfectly with
your version of code, so be prepared to fix one
or two bugs that may arise, and please let me know
what you needed to do to fix it. Sending a corrected
version is always welcome.
|
Finally, if you wish to use any of the snippets from this
page, you are more than welcome, just mention the
authors in your credits. If you wish to release any
of these snippets to the public on another site,
contact me FIRST.
|
|
|
|
|
|
|