Thread: Removing NPCs
View Single Post
  #4  
Old 08-13-2015, 07:58 PM
Shendare
Dragon
 
Join Date: Apr 2009
Location: California
Posts: 814
Default

Ahh, bulk removal/deactivation of a bunch of npc_types by certain criteria, and the spawns associated with them. Gotcha. I'd likely go about it like this:

1. Remove the spawnentry records for the npc_types that fit the criteria.

Quote:
DELETE * FROM spawnentry WHERE npcid IN (SELECT id FROM npc_types WHERE race=130);
2. Delete any spawngroups that are now empty:

Quote:
DELETE FROM spawngroup WHERE (SELECT COUNT(*) FROM spawnentry WHERE spawnentry.spawngroupid=spawngroup.id)=0;
I'd also look for references to the doomed npc_types in other tables to be cleared out similarly to the first query before deleting the npc_types altogether.
Reply With Quote