|
Zone Command Force [by Andrey Fidrya] |
|
|
|
Posted Wednesday, August 12th @ 11:39:46 PM, by George Greer in the Zones dept.
Added Jul 6, 1998. Click the link below to read it or download it.
From: Andrey Fidrya
Subject: New zone command: force mobile
Hi, All!
This snippet adds new ZONE file command: F (forces mob to perform action)
Syntax:
F action to be performed by mobile
Useful in situations like:
M 0 9501 1 9550 * Horse
M 0 9502 1 9550 * Knight
F 1 mount horse
Or:
M 0 9503 1 9550 * Evil beast
F 1 emote appeared in the middle of room!
The code part:
1. Open "db.h" and look for:
struct reset_com {
[ some text ]
int arg1; /* */
int arg2; /* Arguments to the command */
int arg3; /* */
----- Right after "int arg3", add this line:
char *sarg; /* String argument */
2. Open "db.c". Around line 1240 look for:
if (ZCMD.command == 'S' || ZCMD.command == '$') {
ZCMD.command = 'S';
break;
}
error = 0;
----- And add this piece of code right after it:
if (ZCMD.command == 'F') /* force mobile command */ {
skip_spaces(&ptr);
if (*ptr) {
tmp = *ptr;
ptr++;
skip_spaces(&ptr);
ZCMD.sarg = str_dup(ptr);
} else
error = 1;
} else
-----
----- Now look for:
case '*': /* ignore command */
last_cmd = 0;
break;
----- And add this piece of code below:
case 'F': /* force mobile to do action */
if (!mob) {
ZONE_ERROR("attempt to force-command a non-existant mob");
break;
}
command_interpreter(mob, ZCMD.sarg);
break;
-----
Done.
You can now use the "F" command in your zone files.
If this snippet was useful to you, please add:
Andrey Fidrya // RMUD (rmud.techno.ru:4000 ; rus lang only)
to your MUD's credits file. Thanks.
Andrey (andrey@alex-ua.com)
aka Zmey//RMUD
<< XP Part II [by Andy Hubbard] | Reply | View as text | Flattened | A Listing of ANSI codes [by ?] >> |
|
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.
|
|
|
|
|
|
|