View Single Post
  #4  
Old 04-20-2008, 03:50 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

I always have a tough time remembering how each of the spawn tables interconnect, so I always use this page in the Wiki as a reference.

You basically need to find the NPC's ID in the spawnentry table, under the npcID column. That will give you the Spawn Group ID. You can then cross reference the Spawn Group ID with the spawngroupID column in the spawn2 table.

This query can help to relate the tables together:
Code:
SELECT 
	n.id, 
	n.name, 
	s2.spawngroupID, 
	sg.name, 
	s2.respawntime 
FROM 
	spawn2 s2, 
	spawngroup sg, 
	spawnentry se, 
	npc_types n 
WHERE 
	s2.spawngroupID = se.spawngroupID AND 
	s2.spawngroupID = sg.id AND 
	n.id = se.npcID AND 
	n.name LIKE '%Cazic%'
And the result:
Code:
Output from SQL command SELECT n.id, n.name, s2.spawngroupID, sg.name, s2.respawntime FROM spawn2 s2, spawngroup sg, spawnentry se, npc_types n WHERE s2.spawngroupID = se.spawngroupID AND s2.spawngroupID = sg.id AND n.id = se.npcID AND n.name LIKE '%Cazic%' ..
id	name		spawngroupID	name		respawntime 
72003	Cazic_Thule	9362		fearplane_4	281232
Hopefully that makes a little more sense.
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote