View Single Post
  #1  
Old 02-19-2015, 04:37 PM
Bohbo
Hill Giant
 
Join Date: Dec 2012
Posts: 116
Default Removing Spawns from a specific zone based on npc_types criteria (Advice - Not crit)

I wanted to do some zone cleanups of certain mobs.

I was trying to come up with an elegant way of dealing with it. My question is about my method and what I need to delete and what should be left behind.

Code:
SELECT * 
FROM spawn2
JOIN spawngroup ON spawngroup.id = spawn2.spawngroupID 
JOIN spawnentry ON spawngroup.id = spawnentry.spawngroupID
JOIN npc_types ON spawnentry.npcID = npc_types.id
WHERE spawn2.zone LIKE 'gfaydark' AND npc_types.name LIKE '%bat%'
Give me all the spawn2 locations I want and i can do the same for spawnentries (not sure how to combine the two).

Code:
SELECT * 
FROM spawnentry
JOIN npc_types ON spawnentry.npcID = npc_types.id
JOIN spawngroup ON spawnentry.spawngroupID = spawngroup.id
JOIN spawn2 ON spawn2.spawngroupID = spawngroup.id
WHERE spawn2.zone LIKE 'gfaydark' AND npc_types.name LIKE '%bat%'
I can do the same for spawngroupid. My quest has to do with what exactly should i delete just the spawn2 and the spawnentry? The spawngroup COULD include other animals or named is there a way to account for that? Like combine the two statements above, change select * to delete and then check to see if the spawngroupid is shared and if not delete it? I am not sure the best way to bulk remove spawns meeting a certain criteria on the npc_types table.
Reply With Quote