Thanks for all of your input. Please allow me to rephrase this:
I could utilize Navi System for custom NPCs, including show them on mini map and search result. Unlike most of you, I'm using a localized client (Chinese). So, editing decompiled LUAs is the easy way out. But that would make our players' experiences half-EN-half-CN, which is unprofessional. Yeah, I could translate them, but that's 2672 NPCs we're talking about...
So, I had to download LUBs of localized version and tried to start it there.
Luadisasm made me believe that LUB>LUA is possible with proper function/batch tool, as long as the LUB structure is as simple as navi_npc_krsak.lub.
Correct me if I'm wrong~
Time to share what I've learned during the process:
There are 4 LUAs (for NPCs ONLY, leave the function lua alone.
Now we know what to do after editing TownInfo.lub, just make sure NPC number isn't conflicted with current ones.
After that, you can find your custom NPC in the Navi search. But it won't work properly unless you modify the second file.
Say your NPC is in City Hugel, and you want it found when search "Hugel".You have to edit the second file and make sure your input located between the hugel curly blankets.
{10046,
{ "airplane", 11976, 135 },
{ "airplane", 11977, 135 },
{ "hu_fild06", 12781, 116 },
{ "hu_in01", 12817, 75 },
{ "hu_in01", 12819, 109 },
{ "hu_in01", 12821, 15 },
{ "hu_in01", 12825, 8 },
{ "hu_in01", 12827, 103 },
{ "hu_in01", 12829, 76 },
{ "hu_in01", 12831, 50 },
{ "hu_in01", 12833, 104 },
{ "hu_in01", 12836, 162 },
{ "hu_in01", 12877, 79 },
{ "hu_in01", 12883, 79 },
{ "hu_in01", 12884, 79 },
{ "hu_in01", 12908, 98 },
{ "odin_tem01", 12872, 138 },
{ "p_track01", 19493, 82 },
{ "p_track02", 19511, 82 },
{ "que_bingo", 12919, 64 },
{ "", 0, 0 }
},
You can just put it here with similar structures.
{ "airplane", --call it link or reference
11976, --link number.
135 --distance with the link (the Pythagorean theorem
},
Link data is stored in the 3rd and 4th file.
Different towns have difference references, keep in mind. So, to make it perfect, you have to calculate distance with every link..
My suggestion is replacing useless officials instead..
That's all I guess. At the end, if you can help me with LUB>LUA..Leave me a PM, please. Thank you.
========================
Original Post
I just realized how powerful the native navigation system is the other day. Ever since, I've been trying to utilize it for custom features, npcs, mobs etc.
The easy part is to add/delete icons to the mini map in the upper right cornor. Sorry, I don't play English version, I've no idea what you call it natively.
Anyway, by editing TownInfo.lub, I successfully added a custom NPC to the mini-map. And the navigation system also worked fine. I mean the system could calculate the route for you once you click corresponding NPC there.
Yet I want more.
Without further modification, you can't find the NPC in the search result. This could be a problem when you have multiple npcs crowed on a smaller place. Adding all of them to the mini-map would be a disaster.
I know that it was easy because TownInfo.lub isn't encrypted. Editing other lubs is a whole new story. And I've been told, several times that currently there are no tools for translating lub to lua.
In my ' limited' experience, luadisasm can disassemble lub files. disassembled file(navi_npc_krpri.lub) format is as follows:
I am a layman, obviously. Not only on Lua programming, I'm talking basically any programming language. So, can't translate lub to lua = can't restore this format to normal human readable lua?
I did some research, and a term caught my eyes: Table serialization/unserialization. Is it the same thing as what we are talking about?
I am a layman and I can tell the pattern here.
R1=
"airplane", 11984,101,86,"荤苞惑牢","airplane",50,66
Puting the garbled texts aside, it is exactly the same as in decompiled lua. So, with proper function/ batch tools, we can trans it, can't we?
I am a layman, obviously. Not only on Lua programming, I'm talking basically any programming language. So, can't translate lub to lua = can't restore this format to normal human readable lua?
R1=
Puting the garbled texts aside, it is exactly the same as in decompiled lua. So, with proper function/ batch tools, we can trans it, can't we?
Share this post
Link to post
Share on other sites