View Single Post
  #1  
Old 10-21-2021, 07:11 AM
Baltros101
Fire Beetle
 
Join Date: Oct 2021
Location: UK
Posts: 19
Default How to Add an NPC to a Zone via SQL

Hi all,

I've been trying to add Earth Elementals back to the original Steamfont zone because they don't seem to be spawning. I can use the PEQ DB Editor, but I want to write a SQL script which will add them back in quickly with less manual intervention.

So, below are my SQL scripts which successfully result in Earth Elementals spawning, pathing around and dropping loot. The strange thing is that in PEQ DB editor they still don't show up in the NPC list for old Steamfont. I can only guess that I have missed an entry in a table somewhere. Can anyone please tell me what I have missed here?

Here are the IDs for the elementals which already exist in game in the revamped Steamfont:
an_earth_elemental, lvl 9 - 448106
an_earth_elemental, lvl 10 - 448114

So, here I create a new spawngroup:
Code:
INSERT INTO spawngroup (name,spawn_limit,dist,max_x,min_x,max_y,min_y,delay,mindelay,despawn,despawn_timer,wp_spawns) VALUES ('steamfont_earth_elemental_1',0,0,0,0,0,0,0,15000,0,100,0);
Then I link the spawngroup with the elementals in the spawnentry table:
Code:
INSERT INTO spawnentry (spawngroupID,npcID,chance) VALUES (287834,448106,50),(287834,448114,50);
Next, I create the spawn points in spawn2:
Code:
INSERT INTO spawn2
(spawngroupID,zone,version,x,y,z,heading,respawntime,variance,pathgrid,path_when_zone_idle,_condition,cond_value,enabled,animation,min_expansion,max_expansion,content_flags,content_flags_disabled) 
VALUES 
(287834,'steamfont',0,-1370,1370,-108,0,600,0,182,0,0,1,1,0,0,0,NULL,NULL),
(287834,'steamfont',0,-1400,1100,-107,0,600,0,183,0,0,1,1,0,0,0,NULL,NULL),
(287834,'steamfont',0,-1300,800,-115,0,600,0,184,0,0,1,1,0,0,0,NULL,NULL);
Then fix the size so they're not huge:
Code:
UPDATE npc_types SET size=5 WHERE id=448106;
UPDATE npc_types SET size=5 WHERE id=448114;
Finally, set up some paths so they don't just stand still:
Code:
DELETE FROM grid WHERE id=182 AND zoneid=56;
INSERT INTO grid (id, zoneid, type, type2) VALUES ('182', '56', '0', '0');
DELETE FROM grid_entries WHERE gridid=182 AND zoneid=56;
INSERT INTO grid_entries (gridid, zoneid, number, x, y, z, heading, pause, centerpoint) VALUES ('182', '56', '1', '-1370', '1370', '-108', '0', '15', '0');
INSERT INTO grid_entries (gridid, zoneid, number, x, y, z, heading, pause, centerpoint) VALUES ('182', '56', '2', '-1468', '1542', '-108', '0', '15', '0');
INSERT INTO grid_entries (gridid, zoneid, number, x, y, z, heading, pause, centerpoint) VALUES ('182', '56', '3', '-1167', '1386', '-92', '0', '15', '0');
INSERT INTO grid_entries (gridid, zoneid, number, x, y, z, heading, pause, centerpoint) VALUES ('182', '56', '4', '-1613', '1202', '-108', '0', '15', '0');
INSERT INTO grid_entries (gridid, zoneid, number, x, y, z, heading, pause, centerpoint) VALUES ('182', '56', '5', '-1643', '853', '-109', '0', '0', '0');
DELETE FROM grid WHERE id=183 AND zoneid=56;
INSERT INTO grid (id, zoneid, type, type2) VALUES ('183', '56', '0', '0');
DELETE FROM grid_entries WHERE gridid=183 AND zoneid=56;
INSERT INTO grid_entries (gridid, zoneid, number, x, y, z, heading, pause, centerpoint) VALUES ('183', '56', '1', '-1400', '1100', '-107', '0', '15', '0');
INSERT INTO grid_entries (gridid, zoneid, number, x, y, z, heading, pause, centerpoint) VALUES ('183', '56', '2', '-1536', '1558', '-108', '0', '15', '0');
INSERT INTO grid_entries (gridid, zoneid, number, x, y, z, heading, pause, centerpoint) VALUES ('183', '56', '3', '-1604', '1111', '-108', '0', '15', '0');
INSERT INTO grid_entries (gridid, zoneid, number, x, y, z, heading, pause, centerpoint) VALUES ('183', '56', '4', '-1132', '1002', '-108', '0', '15', '0');
DELETE FROM grid WHERE id=184 AND zoneid=56;
INSERT INTO grid (id, zoneid, type, type2) VALUES ('184', '56', '0', '0');
DELETE FROM grid_entries WHERE gridid=184 AND zoneid=56;
INSERT INTO grid_entries (gridid, zoneid, number, x, y, z, heading, pause, centerpoint) VALUES ('184', '56', '1', '-1300', '800', '-115', '0', '15', '0');
INSERT INTO grid_entries (gridid, zoneid, number, x, y, z, heading, pause, centerpoint) VALUES ('184', '56', '2', '-1317', '357', '-82', '0', '15', '0');
INSERT INTO grid_entries (gridid, zoneid, number, x, y, z, heading, pause, centerpoint) VALUES ('184', '56', '3', '-1122', '955', '-108', '0', '15', '0');
But after all this, PEQ still doesn't include them in the dropdown list for Steamfont. Any help is much appreciated.
Reply With Quote