View Single Post
  #2  
Old 08-12-2020, 03:48 PM
Thalix's Avatar
Thalix
Sarnak
 
Join Date: Sep 2016
Posts: 91
Default

The whole thing is database-driven. There is a table npc_types which defines the NPC, their level, race, strength, etc. And there is a table spawn2 that defines where, with what probability the NPCs from npc_types spawn.

With the following SQL query you can see how the tables are linked and how to query which NPC spawns in a zone.
Code:
SET @myZone = NULL;
SET @myNpcName = NULL;
SET @myNpcID = NULL; 

SET @myZone = 'misty';


SELECT   nt.id as npcID, nt.name, nt.level, nt.hp, s2.respawntime, 
         s2.spawngroupID as spawngorupID, s2.pathgrid, s2.zone, s2.x, s2.y, s2.z
FROM     npc_types nt 
         LEFT JOIN spawnentry se ON se.npcID = nt.id 
         LEFT JOIN spawngroup sg ON se.spawngroupID = sg.id 
         LEFT JOIN spawn2 s2 ON s2.spawngroupID = sg.id 
WHERE    (s2.zone = @myZone OR @myZone IS NULL)
         AND (nt.name LIKE @myNpcName OR @myNpcName IS NULL)
         AND (nt.id = @myNpcID OR @myNpcID IS NULL)        
GROUP BY name, level ,respawntime  
ORDER BY name, level, respawntime ASC
LIMIT    500;
Because of your request: you probably want to shorten the respawn time of the spiders in Misty.

You can find all of the very extensive and complex C++ code at GitHub:
https://github.com/EQEmu/Server

The code which handles spawning can be found here:
https://github.com/EQEmu/Server/blob...one/spawn2.cpp

You can get even more information yourself from the project's GitBook. Everything is well documented there:
https://eqemu.gitbook.io/server/

Have fun in the wonderful (and incredibly complex) world of EQEmu
Reply With Quote