NPC ID DB Format vs NPC ID Lua Format

Korietsu
Posts: 12
Joined: Tue Apr 29, 2014 1:12 pm

NPC ID DB Format vs NPC ID Lua Format

Post by Korietsu » Tue May 27, 2014 7:28 pm

I'm trying to troubleshoot some items in Ru'Aun Gardens as none of the Blue teleport NPC's are working. Is there any way to map the NPC_List in the DB to the NPC ID requirements in the lua? It appears all the teleports are off along with the blue/yellow doors. I'd like to author a change, but can't due to whatever obfuscation is going on.

Thanks

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

Re: NPC ID DB Format vs NPC ID Lua Format

Post by kjLotus » Tue May 27, 2014 8:13 pm

mob and npc IDs tend to follow this format: lowest order 3 bytes are their "short id", next 3 bytes is the zoneid, and the highest 2 is usually just 1

for example, rune of release in lebros cavern is 215. to translate that, lebros cavern is zoneid 63, so convert both those to hex (so 0xD7 for the npc id, 0x3F for lebros cavern). then they're 3 bytes each, so 0D7 and 03F, and crunch them together to get 0x03F0D7. then, put that 1 on the front to get 0x103F0D7. then convert that back to decimal and we get 17035479, which is the long ID for rune of release in lebros cavern

npc_list USED to have the long id, and that one got changed to short ID and nothing else did. in my opinion, they should all be short ID, but meh.. effort~

Korietsu
Posts: 12
Joined: Tue Apr 29, 2014 1:12 pm

Re: NPC ID DB Format vs NPC ID Lua Format

Post by Korietsu » Tue May 27, 2014 11:44 pm

kjLotus wrote:mob and npc IDs tend to follow this format: lowest order 3 bytes are their "short id", next 3 bytes is the zoneid, and the highest 2 is usually just 1

for example, rune of release in lebros cavern is 215. to translate that, lebros cavern is zoneid 63, so convert both those to hex (so 0xD7 for the npc id, 0x3F for lebros cavern). then they're 3 bytes each, so 0D7 and 03F, and crunch them together to get 0x03F0D7. then, put that 1 on the front to get 0x103F0D7. then convert that back to decimal and we get 17035479, which is the long ID for rune of release in lebros cavern

npc_list USED to have the long id, and that one got changed to short ID and nothing else did. in my opinion, they should all be short ID, but meh.. effort~
Thanks for the information. I've been tearing out my hair trying to fix the sky blue teleports on my test server. Is there any way to look up the specific portal ID's as well? Neither zone.lua or pincerstone.lua is well commented.

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

Re: NPC ID DB Format vs NPC ID Lua Format

Post by kjLotus » Tue May 27, 2014 11:46 pm

use POLUtils to get the entity list for a zone

Korietsu
Posts: 12
Joined: Tue Apr 29, 2014 1:12 pm

Re: NPC ID DB Format vs NPC ID Lua Format

Post by Korietsu » Wed May 28, 2014 3:17 pm

So, I've found the issue. Jut one last question, is there any way I can get the specific event ID's mapped? e.g. in zone.lua for the area, the portals call on stepping in the region player:startEvent(0x000A);etc.

Is there a listing of those for each zone?

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

Re: NPC ID DB Format vs NPC ID Lua Format

Post by kjLotus » Wed May 28, 2014 4:09 pm

https://wiki.dspt.info/index.php/Event_IDs MIGHT have them (it checks them all based by which NPCs are referenced in each cutscene, but not every cutscene references any NPCs)

if it's not in there, you just have to guess or capture it from a retail server

Korietsu
Posts: 12
Joined: Tue Apr 29, 2014 1:12 pm

Re: NPC ID DB Format vs NPC ID Lua Format

Post by Korietsu » Wed May 28, 2014 4:12 pm

kjLotus wrote:https://wiki.dspt.info/index.php/Event_IDs MIGHT have them (it checks them all based by which NPCs are referenced in each cutscene, but not every cutscene references any NPCs)

if it's not in there, you just have to guess or capture it from a retail server

Time to guess then. I've already found the first one. Not referenced at all in event_ID's.

Is it going to be worthwhile to comment the code for everyone? Is it common practice?

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

Re: NPC ID DB Format vs NPC ID Lua Format

Post by kjLotus » Wed May 28, 2014 4:17 pm

i dunno, i usually don't really comment anything unless it's really out there (pretty easy to see what's going on just by reading it, especially with scripts)

Korietsu
Posts: 12
Joined: Tue Apr 29, 2014 1:12 pm

Re: NPC ID DB Format vs NPC ID Lua Format

Post by Korietsu » Mon Jun 02, 2014 6:05 pm

kjLotus wrote:i dunno, i usually don't really comment anything unless it's really out there (pretty easy to see what's going on just by reading it, especially with scripts)
I've updated and posted the commits to github. Added in some comments to make it easier to debug in the future.

Thanks for the help.

User avatar
Signature
Posts: 126
Joined: Fri May 02, 2014 3:44 am

Re: NPC ID DB Format vs NPC ID Lua Format

Post by Signature » Tue Jul 08, 2014 1:34 pm

Since this is a related question, figured i'd ask here.

how does the npc look work?
For example i'm trying to add an npc who's id I found and easily converted to shortid, but i'm having a lil bit of a hard time trying to figure out how to make her look like shes supposed to,

what is the breakdown of this?
0x0000D20800000000000000000000000000000000

Post Reply