Hi all,
Below are 2 functions for good and bad guards which I'd like to
add to my mud. A Mob with goodguard special is meant to assist any mob
who has an alignment of > 0, and any player with alignment of > 0 who is
fighting a mob with alignment < 0. badguard does the opposite. I think
both functions are correct, flame away if their not, but I need some help
filling in the sections enclose by **[...]**. Any help would be greatly
appreciated.
SPECIAL(goodguard)
{
struct char_data *tch, *assist, *attack;
if (cmd || !AWAKE(ch) || FIGHTING(ch))
return FALSE;
for (tch = world[ch->in_room].people; tch; tch = tch->next_in_room) {
if (CAN_SEE(ch, tch) && FIGHTING(tch)) {
if ((GET_ALIGNMENT(tch) > 0) && (IS_NPC(tch))) {
assist = tch;
attack = **[person fighting assist]**;
act("$n screams 'PROTECT THE INNOCENT! BANZAI!'", FALSE, ch, 0, 0, TO_ROOM);
hit(ch, attack, TYPE_UNDEFINED);
return (TRUE);
break;
}
if ((GET_ALIGNMENT(tch) < 0) && (IS_NPC(tch))) {
attack = tch;
if (GET_ALIGNMENT(**[person fighting attack]**) > 0) {
assist = **[person fighting attack]**;
act("$n screams 'PROTECT THE INNOCENT! BANZAI!'", FALSE, ch, 0, 0, TO_ROOM);
hit(ch, attack, TYPE_UNDEFINED);
return (TRUE);
break;
}
}
}
}
return (FALSE);
}
SPECIAL(badguard)
{
struct char_data *tch, *assist, *attack;
if (cmd || !AWAKE(ch) || FIGHTING(ch))
return FALSE;
for (tch = world[ch->in_room].people; tch; tch = tch->next_in_room) {
if (CAN_SEE(ch, tch) && FIGHTING(tch)) {
if ((GET_ALIGNMENT(tch) < 0) && (IS_NPC(tch))) {
assist = tch;
attack = **[person fighting assist]**;
act("$n screams 'PROTECT THE INNOCENT! BANZAI!'", FALSE, ch, 0, 0, TO_ROOM);
hit(ch, attack, TYPE_UNDEFINED);
return (TRUE);
break;
}
if ((GET_ALIGNMENT(tch) > 0) && (IS_NPC(tch))) {
attack = tch;
if (GET_ALIGNMENT(**[person fighting attack]**) < 0) {
assist = **[person fighting attack]**;
act("$n screams 'PROTECT THE INNOCENT! BANZAI!'", FALSE, ch, 0, 0, TO_ROOM);
hit(ch, attack, TYPE_UNDEFINED);
return (TRUE);
break;
}
}
}
}
return (FALSE);
}
Thanks in advance
Fionn
This archive was generated by hypermail 2b30 : 12/18/00 PST