|
Assassin mobs [by Doppleganger Software] |
|
|
|
Posted Wednesday, August 12th @ 11:23:58 PM, by George Greer in the Specials dept.
Updated Feb 18, 1997. Click the link below to read it or download it.
From: Doppleganger Software <baator@geocities.com>
Subject: [Circle] New improved Assassins
Doppleganger Software's Hired Assassins for CircleMUD
-----------------------------------------------------
** by Ryan A.J. Biggs
in structs.h
------------
Add a MOB_ASSASSIN & AFF_MARK flags and appropriate entrys in constants.c
file.
in struct char_special_data add
struct char_data *assassin;
in struct play_special_data_saved change 2 spare ints to
int as_rnum;
int as_room;
in spec_procs.c
---------------
add this entire function somewhere.
#define ASSASSIN_PRICE(as) (GET_LEVEL(as) * 100000)
SPECIAL(assassin)
{
int as_loc;
struct char_data *as, *vict;
as_loc = ch->in_room + 1;
if (CMD_IS("list")) {
send_to_char("Available assassins are:\r\n", ch);
for (as = world[as_loc].people;as;as = as->next_in_room) {
sprintf(buf, "%8d - %s\r\n", ASSASSIN_PRICE(as), GET_NAME(as));
send_to_char(buf, ch);
}
return 1;
} else if (CMD_IS("hire")) {
two_arguments(argument, buf, buf2);
if(!*buf) {
send_to_char("Hire who?\r\n", ch);
return 1;
}
if (!(as = get_char_room(buf, as_loc))) {
send_to_char("There is nobody called that!\r\n", ch);
return 1;
}
if(!IS_NPC(as)) {
send_to_char("GET THE HELL OUT OF THAT ROOM, NOW !!!\r\n", as);
sprintf(buf, "%s is in the assassin store room.\r\n", GET_NAME(as));
mudlog(buf, BRF, LVL_IMMORT, TRUE);
send_to_char("You can't hire players.\r\n", ch);
return 1;
}
if (!*buf2) {
send_to_char("Whom do want dead?\r\n", ch);
return 1;
}
if (GET_GOLD(ch) < ASSASSIN_PRICE(as)) {
send_to_char("You don't have enough gold!\r\n", ch);
return 1;
}
if ((vict = get_player_vis(as, buf2, 0))) {
GET_GOLD(ch) -= ASSASSIN_PRICE(as);
as = read_mobile(GET_MOB_RNUM(as), REAL);
char_to_room(as, ch->in_room);
SET_BIT(MOB_FLAGS(as), MOB_ASSASSIN);
SET_BIT(MOB_FLAGS(as), MOB_HUNTER);
remember(as, vict);
HUNTING(as) = vict;
ASSASSIN(vict) = as;
SET_BIT(AFF_FLAGS(vict), AFF_MARK);
send_to_char("We cannot contact you if the job succeeds or not..."
" security reasons you understand.\r\n", ch);
act("$n hires $N for a job.", FALSE, ch, 0, as, TO_ROOM);
sprintf(buf, "&+R%s hires %s to kill %s.&+w\r\n", GET_NAME(ch),
GET_NAME(as), GET_NAME(vict));
mudlog(buf, BRF, LVL_IMMORT, TRUE);
return 1;
} else {
send_to_char("The assassin can't find the mark!\r\n", ch);
return 1;
}
}
return 0;
}
in act.other.c
--------------
in do_quit after
send_to_char("Goodbye, friend.. Come back soon!\r\n", ch);
add
if (IS_AFFECTED(ch, AFF_MARK) && (ASSASSIN(ch) != NULL)) {
AS_ROOM(ch) = AS_MOB_ROOM(ch);
AS_RNUM(ch) = AS_MOB_RNUM(ch);
extract_char(ASSASSIN(ch));
}
in db.c
-------
in reset_char add
ASSASSIN(ch) = NULL;
in fight.c
----------
in damage() after
if (!IS_NPC(victim)) {
if (MOB_FLAGGED(ch, MOB_MEMORY))
forget(ch, victim);
sprintf(buf2, "%s killed by %s at %s", GET_NAME(victim),
GET_NAME(ch),
world[victim->in_room].name);
mudlog(buf2, BRF, LVL_IMMORT, TRUE);
}
add
if ((MOB_FLAGGED(ch, MOB_ASSASSIN)) && (HUNTING(ch) == victim)) {
extract_char(ch);
REMOVE_BIT(AFF_FLAGS(victim), AFF_MARK);
}
if (MOB_FLAGGED(victim, MOB_ASSASSIN))
REMOVE_BIT(AFF_FLAGS(HUNTING(victim)), AFF_MARK);
in graph.c
----------
in the function that makes the mob hunt if they have a victim set, change
the else if to what is shown below.
} else if (ch->in_room != HUNTING(ch)->in_room) {
perform_move(ch, dir, 1);
if (ch->in_room == HUNTING(ch)->in_room) {
if (!ROOM_FLAGGED(ch->in_room, ROOM_PEACEFUL)) {
do_say(ch, "You coward! I will kill you!!", 0, 0);
act("$n lunges at $N!!", FALSE, ch, 0, (HUNTING(ch)), TO_ROOM);
hit(ch, HUNTING(ch), TYPE_UNDEFINED);
} else {
if (!MOB_FLAGGED(ch, MOB_ASSASSIN))
act("$n says, 'Coward! Come out of here and fight me $N!'", FALSE, c
h, 0, (HUNTING(ch)), TO_ROOM);
}
}
return;
}
in handler.c
------------
in extract_char add
if (IS_NPC(ch)) {
if (MOB_FLAGGED(ch, MOB_ASSASSIN) && HUNTING(ch))
REMOVE_BIT(AFF_FLAGS(HUNTING(ch)), AFF_MARK);
}
in interpreter.c
----------------
at the top of nanny.c add
struct char_data *as;
before in nanny()
char_to_room(d->character, load_room);
affect_total(d->character);
act("$n has entered the game.", TRUE, d->character, 0, 0, TO_ROOM);
add
if (IS_AFFECTED(d->character, AFF_MARK)) {
as = read_mobile(AS_RNUM(d->character), REAL);
char_to_room(as, AS_ROOM(d->character));
SET_BIT(MOB_FLAGS(as), MOB_ASSASSIN);
SET_BIT(MOB_FLAGS(as), MOB_HUNTER);
remember(as, d->character);
HUNTING(as) = d->character;
ASSASSIN(d->character) = as;
}
in utils.h
----------
add
#define ASSASSIN(ch) ((ch)->char_specials.assassin)
#define AS_ROOM(ch) ((ch)->player_specials->saved.as_room)
#define AS_RNUM(ch) ((ch)->player_specials->saved.as_rnum)
#define AS_MOB_ROOM(ch) (ASSASSIN(ch)->in_room)
#define AS_MOB_RNUM(ch) (ASSASSIN(ch)->nr)
I am just going to clear up 2 things. The Graph.c code is in the
function hunt_victim. Just replace your hunt_victim with this one,
as I can't remember where the code changes.
void hunt_victim(struct char_data * ch)
{
ACMD(do_say);
extern struct char_data *character_list;
int dir;
byte found;
struct char_data *tmp;
if (!ch || !HUNTING(ch))
return;
if (GET_POS(ch) <= POS_FIGHTING)
return;
/* make sure the char still exists */
for (found = 0, tmp = character_list; tmp && !found; tmp = tmp->next)
if (HUNTING(ch) == tmp)
found = 1;
if (!found) {
do_say(ch, "Damn! My prey is gone!!", 0, 0);
HUNTING(ch) = 0;
return;
}
dir = find_first_step(ch->in_room, HUNTING(ch)->in_room);
if ((dir < 0) && (ch->in_room != HUNTING(ch)->in_room)) {
act("$n says, 'Damn! I lost $N!!'", FALSE, ch, 0, (HUNTING(ch)), TO_ROOM);
HUNTING(ch) = 0;
return;
} else if (ch->in_room != HUNTING(ch)->in_room) {
perform_move(ch, dir, 1);
if (ch->in_room == HUNTING(ch)->in_room) {
if (!ROOM_FLAGGED(ch->in_room, ROOM_PEACEFUL)) {
do_say(ch, "You coward! I will kill you!!", 0, 0);
act("$n lunges at $N!!", FALSE, ch, 0, (HUNTING(ch)), TO_ROOM);
hit(ch, HUNTING(ch), TYPE_UNDEFINED);
} else {
if (!MOB_FLAGGED(ch, MOB_ASSASSIN))
act("$n says, 'Coward! Come out of here and fight me $N!'", FALSE, c
h, 0, (HUNTING(ch)), TO_ROOM);
}
}
return;
}
}
Also, you will need to add in a SPECIAL(assassin) in the ASSIGNROOM part
of spec_assign.c and assign a room. If you haven't already, you will
need to add in mob hunting into the mobact.c file. You will also have to
assign a "hire" in interpreter.c as a do_not_here command. About adding
the HUNTING to mobact, find this line:
/* Mob Movement */
change the statements to:
if (HUNTING(ch))
hunt_victim(ch);
else if (!MOB_FLAGGED(ch, MOB_SENTINEL) && (GET_POS(ch) == POS_STANDING) &&
((door = number(0, 18)) < NUM_OF_DIRS) && CAN_GO(ch, door) &&
!ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB | ROOM_DAMAGE))
{
perform_move(ch, door, 1);
}
Also, make sure you have this declaration somewhere in the file.
void hunt_victim(struct char_data * ch);
Usage: Assign the assassin to any room. The vnum IMMEDIATELY after that
room is a room that should have no exits. It will contain all the mobs
that can be hired. For example, if the assassin hiring room is 3001.
The room 3002 will have no exits and contain all the mobs that can be
hired. If you have any problems, please e-mail me and I can probably
find the problem.
<< Attribute Command [by Nashak] | Reply | View as text | Threaded | Autoassist Code [by Josh B.] >> |
|
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.
|
|
|
|
|
|
|