- Posts: 345
- Thank you received: 73
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
[1] When the event is created, you add the object of the type you want./* the event object for the sniff event */
struct sniff_event_obj {
struct char_data *ch;
byte type;
};
EVENTFUNC(sniff_event)
{
[2] struct sniff_event_obj *seo = (struct sniff_event_obj *) event_obj;
struct char_data *ch, *victim;
ch = seo->ch;
GET_CHAR_SNIFF(ch) = NULL;
if (type == SNIFF_COLD)
act("$n sniffs loudly.", FALSE, ch, NULL, NULL, TO_ROOM);
else
act("$n sniffs some cocaine.", FALSE, ch, NULL, NULL, TO_ROOM);
act("You sniff.", FALSE, ch, NULL, NULL, TO_CHAR);
if (--seo->severity <= 0) {
/* we're done with sniffing */
free(event_obj);
}
else
return PULSE_SNIFF;
}
ACMD(do_sniff)
{
struct sniff_event_obj *sniff;
[1] CREATE(sniff, struct sniff_event_obj, 1);
sniff->ch = ch;
sniff->severity = 5;
if (GET_CLASS(ch) != CLASS_THIEF)
sniff->type = SNIFF_COLD;
else
sniff->type = SNIFF_COCAINE;
GET_CHAR_SNIFF(ch) = event_create(sniff_event, sniff, PULSE_SNIFF);
send_to_char(OK, ch);
}
Please Log in or Create an account to join the conversation.
tbaMUD © 2024