int npc_event_sub(struct map_session_data* sd, struct event_data* ev, const char* eventname)
{
if ( sd->npc_id != 0 )
{
//Enqueue the event trigger.
int i;
ARR_FIND( 0, MAX_EVENTQUEUE, i, sd->eventqueue[i][0] == '\0' );
if( i < MAX_EVENTQUEUE )
{
safestrncpy(sd->eventqueue[i],eventname,50); //Event enqueued.
return 0;
}
ShowWarning("npc_event: player's event queue is full, can't add event '%s' !\n", eventname);
return 1;
}
if( ev->nd->sc.option&OPTION_INVISIBLE )
{
//Disabled npc, shouldn't trigger event.
npc_event_dequeue(sd);
return 2;
}
run_script(ev->nd->u.scr.script,ev->pos,sd->bl.id,ev->nd->bl.id);
return 0;
}