PDA

View Full Version : Possible spawn_conditions bug


John Adams
10-30-2006, 12:13 AM
This is gonna get windy, so bear with me.

Following FNW's old Tutorial for creating spawn_events (found here (http://www.eqemulator.net/forums/showthread.php?t=18171&highlight=spawn_events)), I set out on the arduous journey of trying to make day/night shifts spawn *anywhere*. I tried the suggested additions from the tutorial, watched the spawns in East Waste for Korrigain, and even checked the data from Cavedude's database that had some Kithicor shifts in it. None of them yield the expected result. Here's an analysis of over 6 hours of testing...

Created 2 new NPCs - DayTest, NightTest.

Went into game, #zone load2 so I could test privately, and spawned my 2 new NPCs in their own locations, and added them to the spawn tables. I verified that #repop did in fact re-spawn my 2 new NPCs.

Added 2 spawn_conditions using the template from the tutorial, changing the zone to "load2", but leaving the other data alone.
insert into spawn_conditions (zone,id,value,onchange,name) VALUES('load2', 1, 0, 2, 'Test Day Shifts');
insert into spawn_conditions (zone,id,value,onchange,name) VALUES('load2', 2, 1, 2, 'Test Night Shifts');

I then added the spawn_events per the tutorial, again changing only the data for my test zone:
INSERT INTO spawn_events (id,zone,cond_id,name,period,next_minute,next_hour ,next_day,next_month,next_year,enabled,action,argu ment)
VALUES(1,'load2',1,'Enable Day Shift',720, 0, 6, 9, 1, 3100, 1, 0, 1);
INSERT INTO spawn_events (id,zone,cond_id,name,period,next_minute,next_hour ,next_day,next_month,next_year,enabled,action,argu ment)
VALUES(2,'load2',1,'Disable Day Shift',720, 0, 18, 9, 1, 3100, 1, 0, 0);
INSERT INTO spawn_events (id,zone,cond_id,name,period,next_minute,next_hour ,next_day,next_month,next_year,enabled,action,argu ment)
VALUES(3,'load2',2,'Enable Night Shift',720, 0, 18, 9, 1, 3100, 1, 0, 1);
INSERT INTO spawn_events (id,zone,cond_id,name,period,next_minute,next_hour ,next_day,next_month,next_year,enabled,action,argu ment)
VALUES(4,'load2',2,'Disable Night Shift',720, 0, 6, 9, 1, 3100, 1, 0, 0);
Checking my zone time when I was in, the system seems to start on Jan 1, 3100. So if I read the next_* info correctly, I should not expect to see this event take place until the 9th day(?) so I did change that - next_day = 2 for all events.

While in game, I also ran #mlog setcat SPAWNS on so I could see what's going on.

I then started the load2 zone static so it was always running.

Watching the log, I saw my day-shift NPC spawn properly. YAY! I thought we were in business. But after 720 EQ minutes, he despawned, and all hell broke loose in my perfect world. This is where the 6 hours comes in, because I was sure I had something setup wrong.

What I was seeing was the despawn of NPC-Day went ok, but the spawning of NPC-Night was prohibited by condition 2 (see log below). What happened next was the "next_hour" setting for the disable day and enable night shifts both switched to the same hour as the enable day, disable night. In other words, all 4 events are firing at the same moment (again, see failed log).

Logs -
Successful spawn of night-shift during zone startup (expected, and happy):
[10.29. - 17:41:27] [SPAWNS__MAIN] Spawn2 378216: Spawn reset, repop in 1200000 ms
[10.29. - 17:41:32] [SPAWNS__MAIN] Spawn2 378216: Timer has triggered
[10.29. - 17:41:32] [SPAWNS__MAIN] Spawn2 378216: Group 1433713 spawned Jak_NightSpawn (185001) at (-291.228, 48.029, -723.523). Grid loading delayed.
[10.29. - 17:41:32] [SPAWNS__MAIN] Spawn2 378215: Timer has triggered
[10.29. - 17:41:32] [SPAWNS__CONDITIONS] Spawn2 378215: spawning prevented by spawn condition 1
[10.29. - 17:41:32] [SPAWNS__MAIN] Spawn2 378215: Spawn reset, repop in 1200000 ms
[10.29. - 17:41:38] [SPAWNS__MAIN] Spawn2 378216: Spawn reset, repop in 1200000 ms
[10.29. - 17:43:11] [SPAWNS__CONDITIONS] Loaded spawn condition 1 with value 1 and on_change 2
[10.29. - 17:43:11] [SPAWNS__CONDITIONS] Loaded spawn condition 2 with value 1 and on_change 2
[10.29. - 17:43:11] [SPAWNS__CONDITIONS] Loaded enabled spawn event 1 on condition 1 with period 720, action 0, argument 1
[10.29. - 17:43:11] [SPAWNS__CONDITIONS] Loaded enabled spawn event 2 on condition 1 with period 720, action 0, argument 0
[10.29. - 17:43:11] [SPAWNS__CONDITIONS] Loaded enabled spawn event 3 on condition 2 with period 720, action 0, argument 1
[10.29. - 17:43:11] [SPAWNS__CONDITIONS] Loaded enabled spawn event 4 on condition 2 with period 720, action 0, argument 0
[10.29. - 17:43:11] [SPAWNS__CONDITIONS] Next event determined to be event 1
[10.29. - 17:43:11] Default weather for zone is:1
[10.29. - 17:43:12] [SPAWNS__MAIN] Spawn2 378216: Timer has triggered
[10.29. - 17:43:12] [SPAWNS__MAIN] Spawn2 378216: Group 1433713 spawned Jak_NightSpawn (185001) at (-291.228, 48.029, -723.523). Grid loading delayed.
[10.29. - 17:43:12] [SPAWNS__MAIN] Spawn2 378215: Timer has triggered
[10.29. - 17:43:12] [SPAWNS__MAIN] Spawn2 378215: Group 1433712 spawned Jak_DaySpawn (185000) at (-230.391, 52.381, -723.523). Grid loading delayed.

(not completely sure why there was a second spawning 2 mins later but both NPCs were there when I zoned in)

First despawn (20 mins later), repopped and took out the night-shift as expected as well:
[10.29. - 18:03:17] [SPAWNS__CONDITIONS] Event 1: Executing. Setting condition 1 to 1.
[10.29. - 18:03:17] [SPAWNS__CONDITIONS] Local Condition update requested for 1 with value 1, which is what we already have.
[10.29. - 18:03:17] [SPAWNS__CONDITIONS] Event 1: Will trigger again in 720 EQ minutes at 01/03/3100 18:00.
[10.29. - 18:03:17] [SPAWNS__CONDITIONS] Next event determined to be event 4
[10.29. - 18:03:17] [SPAWNS__CONDITIONS] Event 4: Executing. Setting condition 2 to 0.
[10.29. - 18:03:17] [SPAWNS__CONDITIONS] Local Condition update requested for 2 with value 0
[10.29. - 18:03:17] [SPAWNS__CONDITIONS] Zone notified that spawn condition 2 has changed from 1 to 0. Notifying all spawn points.
[10.29. - 18:03:17] [SPAWNS__CONDITIONS] Spawn2 378216: Notified that our spawn condition 2 has changed from 1 to 0. Our min value is 1.
[10.29. - 18:03:17] [SPAWNS__CONDITIONS] Spawn2 378216: Our condition is now disabled. Preforming a repop.
[10.29. - 18:03:17] [SPAWNS__MAIN] Spawn2 378216: Spawn reset, repop immediately.
[10.29. - 18:03:17] [SPAWNS__CONDITIONS] Event 4: Will trigger again in 720 EQ minutes at 01/03/3100 18:00.
[10.29. - 18:03:17] [SPAWNS__CONDITIONS] Next event determined to be event 1
[10.29. - 18:03:18] [SPAWNS__MAIN] Spawn2 378216: Timer has triggered
[10.29. - 18:03:18] [SPAWNS__CONDITIONS] Spawn2 378216: spawning prevented by spawn condition 2
[10.29. - 18:03:18] [SPAWNS__MAIN] Spawn2 378216: Spawn reset, repop in 1200000 ms

So far, so good. But here's where it went wrong. On the next event cycle, both spawn_condition values were set to 0, neither could spawn, and the rest of the night, the zone could not get the NPCs to spawn.

3 things to note: The Opcode error (might not have a thing to do with it):
[10.29. - 18:14:32] Unable to convert EQ opcode 0x6a5f to an Application opcode.
[10.29. - 18:14:32] [CLIENT__NET_ERR] Jak: Unhandled incoming opcode: [OpCode OP_Unknown (0x6a5f) Size=8]

This "mini spawn attempt @ 23 mins:
[10.29. - 18:23:18] [SPAWNS__MAIN] Spawn2 378216: Timer has triggered
[10.29. - 18:23:18] [SPAWNS__CONDITIONS] Spawn2 378216: spawning prevented by spawn condition 2
[10.29. - 18:23:18] [SPAWNS__MAIN] Spawn2 378216: Spawn reset, repop in 1200000 ms

(con't next post)

John Adams
10-30-2006, 12:14 AM
(con't)

And finally, the remainder of the log looks something like this:
[10.29. - 18:38:18] Unable to convert EQ opcode 0x6a5f to an Application opcode.
[10.29. - 18:38:18] [CLIENT__NET_ERR] Jak: Unhandled incoming opcode: [OpCode OP_Unknown (0x6a5f) Size=8]
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Event 1: Executing. Setting condition 1 to 1.
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Local Condition update requested for 1 with value 1, which is what we already have.
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Event 1: Will trigger again in 720 EQ minutes at 01/04/3100 06:00.
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Next event determined to be event 2
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Event 2: Executing. Setting condition 1 to 0.
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Local Condition update requested for 1 with value 0
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Zone notified that spawn condition 1 has changed from 1 to 0. Notifying all spawn points.
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Spawn2 378215: Notified that our spawn condition 1 has changed from 1 to 0. Our min value is 1.
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Spawn2 378215: Our condition is now disabled. Preforming a repop.
[10.29. - 18:39:19] [SPAWNS__MAIN] Spawn2 378215: Spawn reset, repop immediately.
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Event 2: Will trigger again in 720 EQ minutes at 01/04/3100 06:00.
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Next event determined to be event 3
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Event 3: Executing. Setting condition 2 to 1.
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Local Condition update requested for 2 with value 1
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Zone notified that spawn condition 2 has changed from 0 to 1. Notifying all spawn points.
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Spawn2 378216: Notified that our spawn condition 2 has changed from 0 to 1. Our min value is 1.
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Spawn2 378216: Our condition is now enabed. Preforming a repop.
[10.29. - 18:39:19] [SPAWNS__MAIN] Spawn2 378216: Spawn reset, repop immediately.
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Event 3: Will trigger again in 720 EQ minutes at 01/04/3100 06:00.
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Next event determined to be event 4
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Event 4: Executing. Setting condition 2 to 0.
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Local Condition update requested for 2 with value 0
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Zone notified that spawn condition 2 has changed from 1 to 0. Notifying all spawn points.
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Spawn2 378216: Notified that our spawn condition 2 has changed from 1 to 0. Our min value is 1.
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Spawn2 378216: Our condition is now disabled. Preforming a repop.
[10.29. - 18:39:19] [SPAWNS__MAIN] Spawn2 378216: Spawn reset, repop immediately.
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Event 4: Will trigger again in 720 EQ minutes at 01/04/3100 06:00.
[10.29. - 18:39:19] [SPAWNS__CONDITIONS] Next event determined to be event 1
[10.29. - 18:39:20] [SPAWNS__MAIN] Spawn2 378216: Timer has triggered
[10.29. - 18:39:20] [SPAWNS__CONDITIONS] Spawn2 378216: spawning prevented by spawn condition 2
[10.29. - 18:39:20] [SPAWNS__MAIN] Spawn2 378216: Spawn reset, repop in 1200000 ms
[10.29. - 18:39:20] [SPAWNS__MAIN] Spawn2 378215: Timer has triggered
[10.29. - 18:39:20] [SPAWNS__CONDITIONS] Spawn2 378215: spawning prevented by spawn condition 1
[10.29. - 18:39:20] [SPAWNS__MAIN] Spawn2 378215: Spawn reset, repop in 1200000 ms

Sorry for the length, I just wanted to provide as much detail as possible. This functionality is something many ask about, and I thought I understood. Maybe I am still missing something. Has anyone else seen a problem using this system?

Thanks in advance,
J

Striat
04-03-2007, 04:06 PM
sorry for reviving an old thread, but just to clarify for anyone else, I believe the problem you're having is that a period of 720 is used. Thats 12 hours. So, basically, your first event would work. However, it would change the next hour for the "day spawn" event to occur in the database occur at the same time as the "night spawn" event. So ultimately, your events are occuring as they should, but since ALL 4 events would then occur at 18:00, they're ultimately cancelling each other out.

Based on that, I believe the simple fix is to just change period for each event to 24 hours or 1440.

Sakrateri
07-22-2007, 10:08 PM
bumping an old one again...anyone got this working yet?

John Adams
07-23-2007, 01:46 AM
I must have missed this in my time of absence. Thanks for the bump, Sakrateri. That theory makes perfect sense. And you're right, the 720 would bump the "next spawn time" into the next cycle. Seems clear to me now. I'll have to try it. I want my night/day shifts working, dammit!