Issue Information
-
#002223
-
1 - Low
-
Working as Intended
Issue Confirmations
-
Yes (0)No (0)
0
npc dialogue causes 'event queue full' errors
Posted by Hercules Bot on 13 September 2008 - 10:06 AM
Originally posted by theultramage
http://www.eathena.w...er&showbug=2223
When the special OnPC/NPC events get executed, they process simultaneously and globally. This means that when such an event occurs (say, OnPCDieEvent when you get killed), all npcs on the server that have an OnPCDieEvent label are looked up, and attempt to execute one by one:
The issue here is that the event queue for these events is only 2 entries long! (this is a value inherited from ancient jathena). So if you have more than 2 npcs with the same event somewhere on your server, triggering this event while talking to a npc raises an error condition
The only workaround so far is to increase the MAX_EVENTQUEUE parameter to as high as the max. amount of npcs that share a npc event.
PS: a tweak to let you see exactly which npcs are causing this:
http://www.eathena.w...er&showbug=2223
When the special OnPC/NPC events get executed, they process simultaneously and globally. This means that when such an event occurs (say, OnPCDieEvent when you get killed), all npcs on the server that have an OnPCDieEvent label are looked up, and attempt to execute one by one:
CODE
if(rid) // a player may only have 1 script running at the same time
npc_event_sub(map_id2sd(rid),ev,key.str);
else
run_script(ev->nd->u.scr.script,ev->pos,rid,ev->nd->bl.id);
But if you already have a npc conversation open at this point, all of them get force-queued instead. A simple example would be a npc with an OnPCLogoutEvent, duplicated 5 times.npc_event_sub(map_id2sd(rid),ev,key.str);
else
run_script(ev->nd->u.scr.script,ev->pos,rid,ev->nd->bl.id);
The issue here is that the event queue for these events is only 2 entries long! (this is a value inherited from ancient jathena). So if you have more than 2 npcs with the same event somewhere on your server, triggering this event while talking to a npc raises an error condition
CODE
[03:02:34][Warning]: npc_event: player's event queue is full, can't add event '%s' !
The only workaround so far is to increase the MAX_EVENTQUEUE parameter to as high as the max. amount of npcs that share a npc event.
PS: a tweak to let you see exactly which npcs are causing this:
CODE
=== npc.c
==================================================================
--- npc.c (revision 13205)
+++ npc.c (local)
@@ -641,7 +641,13 @@
if( i < MAX_EVENTQUEUE )
safestrncpy(sd->eventqueue[i],eventname,50); //Event enqueued.
else
- ShowWarning("npc_event: player's event queue is full, can't add event '%s' !\n", eventname);
+ {
+ ShowWarning("npc_event: event queue of player '%s' is full, can't add event '%s' !\n", sd->status.name, eventname);
+ ShowDebug("Dumping event queue for player '%s':", sd->status.name);
+ for( i = 0; i < MAX_EVENTQUEUE; ++i )
+ ShowMessage(" \"%s\"", sd->eventqueue[i]);
+ ShowMessage("\n");
+ }
return 1;
}
==================================================================
--- npc.c (revision 13205)
+++ npc.c (local)
@@ -641,7 +641,13 @@
if( i < MAX_EVENTQUEUE )
safestrncpy(sd->eventqueue[i],eventname,50); //Event enqueued.
else
- ShowWarning("npc_event: player's event queue is full, can't add event '%s' !\n", eventname);
+ {
+ ShowWarning("npc_event: event queue of player '%s' is full, can't add event '%s' !\n", sd->status.name, eventname);
+ ShowDebug("Dumping event queue for player '%s':", sd->status.name);
+ for( i = 0; i < MAX_EVENTQUEUE; ++i )
+ ShowMessage(" \"%s\"", sd->eventqueue[i]);
+ ShowMessage("\n");
+ }
return 1;
}