|
Object Surprise! Mob appears and attacks player! [by John Melvin III] |
|
|
|
Posted Saturday, August 28th @ 07:28:46 AM, by George Greer in the Objects dept.
John Melvin III writes,
"This is the first snippet that I have contributed (it's an
extremely simple one too), and my coding skills byte
(pun intended). Anyway, I came up with this when I was
thinking of a fun thing to do with my Tomb of the
Undead zone I was building and came up with this."
WHAT IT DOES:
When a player opens the object this spec proc is on, it loads a mob which essentially bashes the player, attacks, and the object can no longer open or close (to prevent repeating this incessantly for exp).
WHAT YOU NEED:
1 cup - MUD
1 teaspoon - Your own prefences
1 liter - spec_procs.c
Here's the snippet:
SPECIAL(coffin) /* My code was for one of three vampires would jump out and attack the opener of the coffin. Feel free to change the spec proc name as it might not suit you if you're planning to have your beastly fido jump out and maul the player */
{
int vnum = 0;
struct obj_data *obj = (struct obj_data *) me;
struct char_data *mob;
ACMD(do_hit);
if (CMD_IS("open")) {
if (!str_cmp("coffin", obj->name)) {
GET_OBJ_VAL(obj, 1) = 0;
vnum = real_mobile(number(2300, 2302)); /* This is just to have it random pick between the three vampires using their vnums. You should probably change it to the vnum (or random vnums) you want it to load. */
mob = read_mobile(vnum, REAL);
act("As you open the coffin, $N jumps out and tackles you to the ground!", FALSE, ch, 0, mob,TO_CHAR);
act("As $n opens the coffin, $N jumps out and tackles $m to the ground!", FALSE, ch, 0, mob,TO_ROOM);
act("Going into a blood frenzy, $E attacks you!", FALSE, ch, 0, mob,TO_CHAR);
act("Going into a blood frenzy, $E attacks $m!", FALSE, ch, 0, mob,TO_ROOM); /* Ahh, flavor text. */
GET_POS(ch) = POS_SITTING; /* Bash, essentially. */
WAIT_STATE(ch, PULSE_VIOLENCE * 2); /* Please allow 2 to 3 tics for delivery. */
char_to_room(mob, ch->in_room);
do_hit(mob, GET_NAME(ch), 0, 0); // Start the mob fighting the player. Hiiiiyyaaa! */
return TRUE;
}
}
return FALSE;
}
Let stand, uncovered for 1 compile or until severely charred.
- John Melvin III
"Hamsters can fly, they just have trouble reaching the conrols without a booster seat!"
<< FTP Uploads 1999/08/05 | Reply | View as text | Flattened | Adding exits to bpl15 [by Peter Ajamian] >> |
|
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.
|
|
|
|
|
|
|