Jump to content

  •  

Bug Tracker Migration

June 3rd
Good news everyone! The staff has decided that it is time to slowly kill off this Bug Tracker. We will begin the process of slowly migrating from this Bug Tracker over to our Github Issues which can be found here: https://github.com/HerculesWS/Hercules/issues

Over the next couple of days, I will be closing off any opportunity to create new reports. However, I still will keep the opportunity to reply to existing Bug Reports. Doing this will allow us to slowly fix any bug reports we have listed here so that we can easily migrate over to our Issue Tracker.

Update - June 7th 2015: Creating new bug posts has been disabled. Please use our https://github.com/HerculesWS/Hercules/issues tracker to post bugs. Users are still able to reply to existing bug posts.

- Administration

Issue Information

Issue Confirmations

  • Yes (0)No (0)
Photo

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:
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.

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;
    }

Originally posted by Ind
nonono, the workaround is actually having a single place to your event, they're all run at once anyway. I see no benefit in having them split all over the place.