Page 1 of 1

How to spawn an npc.

Posted: Fri Dec 18, 2015 2:29 pm
by kasaga
I was making some attempts at spawning a npc by adding to the npc_list table though adding a new number to it with status 0 and simply copying all data from a existing npc such as flags etc, they do not appear on screen even with a restart of the zone server. Also it seems really high id numbers such as taking a normal npc turning it to hex setting the most significant bits 0x1 to 0x2 then converting back to decimal gave me 33,xxx,xxx which crashes it on restart.

How do I add a npc, such as a explorer moogle? I understand that its name would become NPC if I used a custom name without editing a dat file.

INSERT INTO `npc_list` VALUES ('17064934', 'Moogle', 'Moogle', '128', '-308.00', '0', '-478.863', '1', '40', '40', '0', '0', '0', '0', '3', 0x0000520000000000000000000000000000000000, '0', 'Null');

Re: How to spawn an npc.

Posted: Fri Dec 18, 2015 7:20 pm
by kjLotus
kasaga wrote:'Null'
there's a difference between 'Null' and null, and that's probably the issue

Re: How to spawn an npc.

Posted: Fri Dec 18, 2015 8:42 pm
by kasaga
Nope that one didn't do it, I was hoping it was just me not typing null right but I tried with lower case, 0, TOAU, this was my last query and npc didnt show up when i logged in.

INSERT INTO `npc_list` VALUES ('18286721', 'Moogle', 'Moogle', '128', '-308.00', '0', '-478.863', '1', '40', '40', '0', '0', '0', '0', '3', 0x0000520000000000000000000000000000000000, '0', 'null');

Reloaded the map server still no go.

Re: How to spawn an npc.

Posted: Fri Dec 18, 2015 8:46 pm
by kjLotus
there is still a difference between 'null' and null

just to be clear, it's not a string, so it shouldn't have any quotes

Re: How to spawn an npc.

Posted: Fri Dec 18, 2015 9:46 pm
by kasaga
Tried it without the quotes too got nothin, im baffled here unless I input something worng.
edit: meant to type 17064934 as the id there. still no go.

Re: How to spawn an npc.

Posted: Fri Dec 18, 2015 10:54 pm
by TeoTwawki
Are you editing the live database or the file, and if editing the file re importing it after? Are those positional coordinates where you can actually see the new NPC? Is the NPC ID valid for the zone? Are you restarting map server after change?

(There are only 1023 valid NPC "slots" per zone, out of 4095 entity "slots" per zone, the first is always a dud and beyond the 1st 1024 are non mob/npc types, such as player pets leaving you 1023 you can mess with. The ID of 17064934 tells me that should be zone 70)

tl;dr
lots of ways to get it wrong. :)

Re: How to spawn an npc.

Posted: Sat Dec 19, 2015 12:07 pm
by kasaga
At first I added it live, this time I tried adding it with the server shut down.

I believe my original number to be within range but i lowered it down the highest ID for 70 seems to be 206/1023 total for npcs so I picked a lower one than my first number but higher than whats listed on the master npc list xml file (id207). I changed it to 17064602.

Thanks very much, I now have a npc sitting in front of me, it works. Now i can fool with flags and stuff and see whats what.

Re: How to spawn an npc.

Posted: Mon Dec 21, 2015 1:50 am
by TeoTwawki
kasaga wrote:At first I added it live, this time I tried adding it with the server shut down.
Yeah you can't actually change the NPC list while its running. It only reads on startup and we don't currently have a way to make it reload all of a zones non-player entities.