How to spawn an npc.

Post Reply
kasaga
Posts: 14
Joined: Sun Feb 24, 2013 12:31 pm

How to spawn an npc.

Post by kasaga » Fri Dec 18, 2015 2:29 pm

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');

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: How to spawn an npc.

Post by kjLotus » Fri Dec 18, 2015 7:20 pm

kasaga wrote:'Null'
there's a difference between 'Null' and null, and that's probably the issue

kasaga
Posts: 14
Joined: Sun Feb 24, 2013 12:31 pm

Re: How to spawn an npc.

Post by kasaga » Fri Dec 18, 2015 8:42 pm

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.

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: How to spawn an npc.

Post by kjLotus » Fri Dec 18, 2015 8:46 pm

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

kasaga
Posts: 14
Joined: Sun Feb 24, 2013 12:31 pm

Re: How to spawn an npc.

Post by kasaga » Fri Dec 18, 2015 9:46 pm

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.

User avatar
TeoTwawki
Developer
Posts: 527
Joined: Mon Jul 15, 2013 9:50 pm

Re: How to spawn an npc.

Post by TeoTwawki » Fri Dec 18, 2015 10:54 pm

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. :)
Hi, I run The Demiurge server.


Image
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
PLS USE [ code ] CODE TAGS [ /code ] WHEN POSTING CODE
DO NOT PRIVATE MESSAGE ME ABOUT BUGS

kasaga
Posts: 14
Joined: Sun Feb 24, 2013 12:31 pm

Re: How to spawn an npc.

Post by kasaga » Sat Dec 19, 2015 12:07 pm

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.

User avatar
TeoTwawki
Developer
Posts: 527
Joined: Mon Jul 15, 2013 9:50 pm

Re: How to spawn an npc.

Post by TeoTwawki » Mon Dec 21, 2015 1:50 am

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.
Hi, I run The Demiurge server.


Image
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
PLS USE [ code ] CODE TAGS [ /code ] WHEN POSTING CODE
DO NOT PRIVATE MESSAGE ME ABOUT BUGS

Post Reply