Hello,
I recently pieced together a push skill using mostly stuff from
act.movement.c. The skill is supposed to allow a player to shove someone out
of a room in a direction they choose, i.e. push fido n would force the mob to
move north. I have two questions regarding it: Firstly, the skill only works
in my testing when I run the mud in mini-mode, running in any other mode
crashes it. Secondly, I am having trouble getting it to check to make sure
the direction exists before pushing the character, it crashes if I try pushing
in a non-existant direction. I'd greatly appreciate any help on either
question. Here's my code (I put it in act.offensive.c):
ACMD(do_push)
{
int exit;
struct char_data *was_fighting;
int percent, prob;
struct char_data *vict;
char dir[MAX_INPUT_LENGTH];
two_arguments(argument, arg, dir);
if (!GET_SKILL(ch, SKILL_PUSH)) {
send_to_char("You better leave that sort of thing to the bouncers.\r\n",
ch);
return;
}
if ((exit = search_block(dir, dirs, FALSE)) == -1) {
send_to_char("That's not a direction.\r\n", ch);
return;
}
if (!CAN_GO(ch, exit)) {
send_to_char("There's nowhere to push someone in that direction!\r\n", ch);
return;
}
if (!(vict = get_char_room_vis(ch, arg))) {
send_to_char("Push who?\r\n", ch);
return;
}
if (vict == ch) {
send_to_char("Why not just walk there instead?\r\n", ch);
return;
}
percent = number(1, 101);
prob = GET_SKILL(ch, SKILL_PUSH);
if (percent > prob) {
act("$n unsuccessfully tries to shove $N from the room.", TRUE, ch, 0, 0,
TO_ROOM);
send_to_char("Ooops...\r\n", ch);
} else {
act("You give $N a strong shove, pushing $M from the room!", FALSE, ch, 0,
vict, TO_CHAR);
act("$n gives $N a powerful push, throwing $M bodily from the room!", TRUE,
ch, 0, 0, TO_ROOM);
act("$N gives you a powerful shove, hurling you from the room!", FALSE, vict,
0, ch, TO_CHAR);
do_simple_move(vict, exit, TRUE);
}
}
I am currently running Circlemud version 3.0 bpl11 on a Win95 Dos shell.
Thanks,
Turgantarganth
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST