Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Tutorial] How to make your own NPCs :]

Newbie Spellweaver
Joined
Jan 4, 2006
Messages
46
Reaction score
8
Well so I decided I'll post this, while I've been playing around with it so...

What you need:
1. KalOnline server =p
2. KalOnline client
3. pk password
4. dat encrypter/decrypter

all these things can be found elsewhere so I'll leave the searching to you, this guide is about something different.

Step 1 : Serverside setup

OK, so all NPCs are stored on the server in MainSvr/Config/InitNPC.txt. The syntax for a NPC looks like this:

(gennpc (index I) (country C) (kind K) (shape S) [(html H)/(quest Q Q2)] (teleport TM TX TY TZ) (map M) (xy X Y Z) (dir DX DY))

I = unique index of the NPC. try to make it far away from the original Kal npcs, because it might happen that new NPCs will be added and you don't want conflicts do you.
C = 252 for international version
K = here will be determined what hypertext .dat files will be called from html parameter. Inix has it divided into some classes but hence I can't read korean, I can't translate it very well :] but that doesn't matter, for a basic NPC just use 0
S = this is the model that will be used for the NPC. There are various numbers from 1-33 so you can try out how your NPC will come out (a village guard or a tomb stone? ^^)
H = this is optional. It's a link to the conversation file in Data/HyperText/e/e.pk in the client. You can either put the last non zero numbers from the name of the file there or the complete number. The filename and structure of the dat will be discussed later in this guide.
Q, Q2 = optional too - you can have either a quest NPC or a normal NPC. The first number links to the Quest.txt on the server, where you have quests defined. The second one I'm not sure, you can play with it and let me know :] So leave it at 1 by default.
TM,TX,TY,TZ = here you can specify the coordinates for your NPC to teleport you, if you call the correct function for him.
M = map where the NPC is spawned. There are a few maps and you can check this from the coordinates of your character in the database, or just referencing from other NPCs already defined. But just fyi, 0 is the outside area :]
X,Y,Z, DX,DY = coordinates and direction. Just type in /coordinates ingame and you can get your coordinates :] for direction are mostly used the X and Y coordinates, but when you want your NPC to look other way, just play around with them

OK so now we have a NPC set up in a server and it doesn't show any errors. So on to the next step.

Step 2 : Clientside setup

Of course a NPC will be seen by the player even if the client doesn't contain its name and other things. But it will show as NULL and you can't talk to it. So we will make a patch for the client.

Extract the files in config.pk and e.pk somewhere. First we will add the NPCs name in the client. This is stored in the message-e.dat. Decrypt it, open it in notepad and find the part which contains the npc names. Add a row at the end of that part that looks like this:

( npcname I "My New NPC")

I = the unique ID you specified on the server earlier.

Close the dat, save it, encrypt it again and put it back into the config.pk.

Next we will add the custom dialogue/html for our NPC, so we can talk to it :] These files are stored in e.pk so we need to extract that. There you can see lots of files that are named

sKNNNNN.dat

K = kind, so when you made an NPC with kind parameter 0, the file will be named s0...
NNNNN = a unique number for the given dialogue. This you have added in the html parameter in the server. if it's for example 700, the file will be named s000700.dat (kind 0 ofc).

Now the syntax for the file is:

Code:
(filechk file_ver (country_type ENG) (filename sKNNNNN))
(background
	(font 12) 
	(wrap 270)
	(link system ( param ( width 270) ( height 255) ( style title edge system vscroll) ( caption "Caption") ( layout script) ))
)

( frame ( font 12)

	( line "text text text")
	( line "blablabla")
        ( line "")

	( link ( text "[Enter Store] Let's go shopping") ( param load "store" S))
	( link ( text "Tell me something more") ( param load "sKNNNNN" ))
        ( link ( text "Teleport me somewhere") ( param load "teleportNPC1" ))
	( link close ( text "[End Talking] Bye Bye"))
)

Now watch out for the things you can change here. You can change a lot :] From the layout itself to what's being said and what's being done.

Caption is a caption of the dialog window ofc :]
You can add lines with text with the (line "xxx")
(param load "store" S) = S is the number if the store. Stores are defined in macro.dat and are not covered in this guide, but you can figure it out ;]
(param load "sKNNNNN") loads a different dialogue window which (a sKNNNNN.dat file) so you can make a large conversation this way :]
(param load "teleportNPC1") = teleports you to the coordinates you specified on the server.
(link close ... closes the dialogue :]

Save this file with the correct filename, encrypt it and put it into the e.pk.

And if you haven't made some mistake (or if I haven't done something wrong :>), you should have your own NPC spawned into kalworld :]

If there are any mistakes in this guide, please correct me, as I'm also a human and humans make errors =P

cya next time
 
Your omega
Loyal Member
Joined
Aug 22, 2006
Messages
1,495
Reaction score
24
could you mayby upload your swordcrypt becuase mine gets an error every time ><
 
Newbie Spellweaver
Joined
Sep 11, 2006
Messages
7
Reaction score
0
I dont know why.. after i add the new npc in message-e.dat it shows all my other npcs NULL <.<
 
Newbie Spellweaver
Joined
Aug 28, 2006
Messages
14
Reaction score
0
FU** Me too :D I can't find ecripters ... decripters pl someone link us :)
 
Newbie Spellweaver
Joined
Aug 28, 2006
Messages
14
Reaction score
0
^^ You don't remember when you installing pk? ;DD
 
Newbie Spellweaver
Joined
Sep 10, 2006
Messages
19
Reaction score
0
JKSYEHAB#9052

PW for config.pk and e.pk
 
Newbie Spellweaver
Joined
Sep 6, 2006
Messages
7
Reaction score
0
Hi,

How would you go about editing items in a npc? Or even more cool making a item npc.... I don't see where the actual client side info is. I see a load "store" 22)) im assuming the 22 has something to do with it. But I can't seem to find the file. Anyone know? :)
 
Newbie Spellweaver
Joined
Sep 10, 2006
Messages
19
Reaction score
0
Open macro.dat and look for (store (key 22) index ....
This is the code line which defines the items in the shop. Add all the Item Index to this line which you want the NPC to sell.

@enCore
No idea about Cryptit i never had that tool, im using swordcrypt for dat files of config.pk and Dat-Editor (dookie´s) for e.pk dat files.

Link to my post where i expalined it more detailed:
http://forum.ragezone.com/kal-online/i-am-mad-cus-srvr-175765.html#post1611106
 
Last edited:
Newbie Spellweaver
Joined
Sep 6, 2006
Messages
7
Reaction score
0
Open macro.dat and look for (store (key 22) index ....
This is the code line which defines the items in the shop. Add all the Item Index to this line which you want the NPC to sell.

@enCore
No idea about Cryptit i never had that tool, im using swordcrypt for dat files of config.pk and Dat-Editor (dookie
 
Junior Spellweaver
Joined
Sep 16, 2006
Messages
162
Reaction score
0
thank you very much for that guide puppi but i got 1 question how can i add that i must get a special item for the npc , example i want to add that i must collect 10 of these "Event Island Items" and if i give them to the npc i get a reward some1 knew how i can add that?

edit: just to show what i mean ^^ :
 
Last edited:
Newbie Spellweaver
Joined
Sep 11, 2006
Messages
7
Reaction score
0
Ok so i made my own teleport npc with my own text .. but when i press teleport it wont do it ... what do i have to put in ( param load "" )) i`ve put the index of the npc, the who line of the npc, only the coordinates where it teleports from initnpc.txt.. nothing works can some1 tell me please what do i have to put there? please

this is from e.pk
Code:
(filechk file_ver (country_type ENG) (filename s000300))
(background
 (font 12) 
 (wrap 270)
 (link system ( param ( width 270) ( height 255) ( style title edge system vscroll) ( caption "Caption") ( layout script) ))
)
( frame ( font 12)
 ( line "I am the Teleport NPC to Dungeon 1")
 ( line "Do you want to go there ?")
        ( line "")
 
        ( link ( text "Teleport me to Dungeon 1") ( param load "Teleport NPC" ))
 ( link close ( text "[End Talking] I want to leave"))
)

and this is from initnpc.txt
Code:
(gennpc (index 601) (country 252) (kind 0) (shape 5) (html 300) (teleport 2 50179 34100 20476) (map 0) (xy 232651 295588 45300) (dir 235916 233677))

Or did i do something wrong with something else?
 
Initiate Mage
Joined
Sep 15, 2006
Messages
2
Reaction score
0
I think you have to go into your quest file, not sure I have to check.
 
Newbie Spellweaver
Joined
Sep 10, 2006
Messages
19
Reaction score
0
( param load "teleportNPC1")

(teleport 0 282580 237244 18371)
 
Newbie Spellweaver
Joined
Sep 11, 2006
Messages
7
Reaction score
0
i dont know where to put those coords .. but i put teleportNPC1 in param load but it simply wont work .. wth am i doing wrong?

maybe i have to put a certain html and kind?
 
Last edited:
Newbie Spellweaver
Joined
Jan 4, 2006
Messages
46
Reaction score
8
i dont know where to put those coords ..
InitNPC.txt

(gennpc (index 601) (country 252) (kind 0) (shape 5) (html 300) (teleport 2 50179 34100 20476) (map 0) (xy 232651 295588 45300) (dir 235916 233677))
 
Back
Top