Guide to add a NPC and config it to work as a Shop

Socius Decennalis
Decennium
Joined
Mar 3, 2009
Messages
318
Reaction score
256
In this tutorial, I'll show you how to add "Rune Agent Flasha" into Bloody Ice and let him sell Upgrade Core(High) at 1 Alz.

***********

​


1, What do I have to know before reading this tutorial?


  • Where's client and server files?
  • How to encrypt/decrypt ENC files?
  • How to edit server's SCP files?
Why I have to know these things?

  • Cuz I don't show you how to do (search for answer).
2, Add NPC into a map:

By modifying "extra_obj.enc" and "extra_obj_msg.enc" in Client you can add a NPC :)

Here's the way.

a, Edit "extra_obj.enc"

First, with "extra_obj.enc", by adding those lines you'll add an object in to specified map.

Code:
<cabal>
    <version    index="1" />
    <extra_object world_id="1">
        <extra_stuff    id="2"    filename="Character\w1rune.ebm"    min="-17[COLOR=black]0.87[/COLOR]3,-2[COLOR=black]5.31[/COLOR]12,-2[COLOR=black]44.7[/COLOR]27"    max="2[COLOR=black]15.37[/COLOR]9,65[COLOR=black]0,17[/COLOR]2.7[COLOR=black]75[/COLOR]" />
        <extra_entity    type="1"    pos="1[COLOR=black]49[/COLOR]6[COLOR=black],0,434[/COLOR]5"    rotate="0[COLOR=black],0,0[/COLOR],0"    scale="1[COLOR=black],1,[/COLOR]1"    disable_cell_radius="1"    stuff_id="2" name="extra_npc_003" npc_id="35" npc_tag="0" npc_type="1" />
    </extra_object>
</cabal>
extra_object

  • world_id : ID of World - Map (for full list, check this out : )

extra_stuff


  • id : ID of object in current map
  • filename : 3D Model for object
  • min : ?
  • max : ?
extra_entity

  • type : Object type
    • 0 : Normal Object
    • 1 : NPC
  • filename : 3D Model for object
  • pos : NPC Position (All pos is multiplied by 100 for more accuracy)
    • 1st : X
    • 2nd : Z
    • 3rd : Y
  • rotate : NPC Rotation
    • 1st : Always = 0
    • 2nd : Degree for X axis
    • 3rd : Degree for Z axis
    • 4th : Degree for Y axis
  • scale : scaling ratio (1,1,1 for normal size)
    • 1st : X
    • 2nd : Z
    • 3rd : Y
  • disable_cell_radius : Radius of area which the object placed in (player can't cross over that area)
  • stuff_id : id of extra_stuff which this extra_entity describe about
  • name : stuff name
  • npc_id : ID of NPC
  • npc_tag : ?
  • npc_type :
    • 1 : Normal NPC
    • 7 : Shop NPC
    • Other value : Not sure
b, Edit "extra_obj_msg.enc"

File "extra_obj_msg.enc" must have some data to hold NPC name which stored in "extra_obj.enc".

Here is an example.

Code:
<cabal_msg>                    
    <version index="1"/>                
    <nation code="EU"/>                
    <extra_obj_msg>                
        <msg    id="extra_npc_003"    cont="Rune Agent Flasha"    />
    </extra_obj_msg>                
</cabal_msg>
So the thing you have to do here is adding a new <msg /> with corrected value.

msg

  • id : Same value with extra_entity > name
  • cont : Name of NPC
OK, now try to run your client. Can you see "Rune Agent Flasha" in Bloody Ice? If not, try again!

3, Modified NPC from Normal NPC to Shop NPC

Now you have to decide, which item you want to sell in that NPC. For example UCH at 1Alz, OK?

a, With "cabal.enc"

Find:

Code:
<cabal_world>
Now find: (mean Bloody Ice)

Code:
<world    id="1"    name="world1"    type="0"    map_file="world_01.mcl"
Add this new line to describe about your new NPC.

Code:
            <world_npc    id="35"    npc_name="npc[COLOR=black]01-003[/COLOR]5"    x="14"    y="43"    is_obj="0"    />
world_npc

  • id : same id in "extra_obj.enc"
  • npc_name : follow this pattern "npcXX-YYYY" where
    • XX : Map ID
    • YYYY : NPC ID
  • x : X Position
  • y : Y Position
  • is_obj:
    • 0 : Is not Object (is a NPC)
    • 1 : Is a normal Object (non-clickable)
Now add those lines to describe which items your NPC sells:

Code:
            <shop    id="35"    >
                <item    slot_id="0"    item_id="1"    option="0"    reputation_class="-19"    duration_id="0"    price="1"    />
            </shop>
shop

  • id : NPC Id

item

  • slot_id : Slot on shop screen
  • item_id : ID of item
  • option : Option of item
  • reputation_class : Honor class required to buy (-19 = no required)
  • duration_id : Item duration
  • price : Price of item
b, With "cabal_msg.enc"

Add new line to describe about NPC name likes that:

Code:
        <msg id="npc01-0035" cont="Rune Agent Flasha" />

c, With server file.


Find correct NPC data file for your map (Ex : for Bloody Ice : /etc/cabal/data/data_world/world1-npc.scp)

Open it and add a line to let server know about the NPC which id is 35 (our Rune Agent)

Add into [NpcPos] Flags Index PosX PosY Type IsRangeCheck section

Code:
28    0    35    15    43    1    1
Now add new line in this file for 1Alz UCH :)

Add into [ShopLst] NpcsIdx NSetIdx ItemKind ItemOpt ReputationClass DurationIdx Price section

Code:
147    35    0    1    0    1    0    1
And that's all, restart your server, and start your client. Now you'll see NPC "Rune Agent Flasha" in Bloody Ice who sells UCH for 1 Alz :)

---------- Post added at 02:34 AM ---------- Previous post was at 02:24 AM ----------

Here's some NPC XML data which you can use to put into "extra_obj.enc".

X'Mas Tree in Bloody Ice

Code:
        <extra_stuff    id="0" filename="object\object_fx\x-mas\x-mastree05.efx" min="-17[COLOR=black]0.87[/COLOR]3,-2[COLOR=black]5.31[/COLOR]12,-2[COLOR=black]44.72[/COLOR]7" max="2[COLOR=black]15.37[/COLOR]9,6[COLOR=black]50,17[/COLOR]2.7[COLOR=black]7[/COLOR]5" />
        <extra_entity  type="0" pos="22[COLOR=black]52,-3[/COLOR]1,[COLOR=black]306[/COLOR]8" rotate="0,[COLOR=black]0,0,[/COLOR]0" scale="1[COLOR=black],1,[/COLOR]1" disable_cell_radius="2" stuff_id="0" />
Chaos Arena Entrance Sign

Code:
        <extra_stuff    id="1" filename="object\snow\f_snow_guidace.ebm" min="-1[COLOR=black]70.87[/COLOR]3,-2[COLOR=black]5.311[/COLOR]2,-24[COLOR=black]4.72[/COLOR]7" max="2[COLOR=black]15.37[/COLOR]9,6[COLOR=black]50,17[/COLOR]2.7[COLOR=black]7[/COLOR]5" />
        <extra_entity  type="1" pos="11[COLOR=black]15,[/COLOR]0,3[COLOR=black]02[/COLOR]2" rotate="0,[COLOR=black]0.70[/COLOR]71[COLOR=black]07,0[/COLOR],0[COLOR=black].70710[/COLOR]7" scale="1[COLOR=black],1,1[/COLOR]" disable_cell_radius="1" stuff_id="1" name="extra_npc_000" npc_id="31" npc_tag="0" npc_type="7" />
Rune Agent Flasha

Code:
        <extra_stuff    id="2"    filename="Character\w1rune.ebm"    min="-17[COLOR=black]0.87[/COLOR]3,-2[COLOR=black]5.31[/COLOR]12,-2[COLOR=black]44.72[/COLOR]7"    max="2[COLOR=black]15.3[/COLOR]7[COLOR=black]9,65[/COLOR]0,17[COLOR=black]2.77[/COLOR]5" />
        <extra_entity    type="1"    pos="1[COLOR=black]49[/COLOR]6[COLOR=black],0,434[/COLOR]5"    rotate="0[COLOR=black],0,0[/COLOR],0"     scale="1[COLOR=black],1,[/COLOR]1"    disable_cell_radius="1"     stuff_id="2" name="extra_npc_003" npc_id="35" npc_tag="0" npc_type="1"  />
Lady Yekaterina

Code:
        <extra_stuff    id="3"    filename="Character\w1agent.ebm"   min="-17[COLOR=black]0.87[/COLOR]3,-2[COLOR=black]5.31[/COLOR]12,-2[COLOR=black]44.72[/COLOR]7"     max="2[COLOR=black]15.3[/COLOR]7[COLOR=black]9,65[/COLOR]0,17[COLOR=black]2.77[/COLOR]5" />
        <extra_entity    type="1"    pos="2[COLOR=black]338,12[/COLOR]7,1[COLOR=black]63[/COLOR]3"    rotate="[COLOR=black]0,1,0,0[/COLOR]"    scale="1[COLOR=black],1[/COLOR],1"    disable_cell_radius="1"    stuff_id="3" name="extra_npc_001" npc_id="32" npc_tag="0" npc_type="7"/>
X'Mas Tree in Desert Scream

Code:
        <extra_stuff    id="0" filename="object\object_fx\x-mas\x-mastree05.efx" min="-1[COLOR=black]70.87[/COLOR]3,-2[COLOR=black]5.31[/COLOR]12,-2[COLOR=black]44.7[/COLOR]27" max="21[COLOR=black]5.37[/COLOR]9,6[COLOR=black]50,1[/COLOR]72[COLOR=black].77[/COLOR]5" />        
        <extra_entity  type="0" pos="8[COLOR=black]52[/COLOR]4,-1,2[COLOR=black]31[/COLOR]40" rotate="0[COLOR=black],0,0,[/COLOR]0" scale="1,1,1" disable_cell_radius="2" stuff_id="0" />
X'Mas Tree in Green Despair

Code:
        <extra_stuff    id="0" filename="object\object_fx\x-mas\x-mastree05.efx" min="-1[COLOR=black]70.873[/COLOR],-[COLOR=black]25.31[/COLOR]1[COLOR=black]2,-[/COLOR]2[COLOR=black]44.7[/COLOR]27" max="2[COLOR=black]15.37[/COLOR]9,6[COLOR=black]50,17[/COLOR]2.7[COLOR=black]7[/COLOR]5" />        
        <extra_entity  type="0" pos="2[COLOR=black]08[/COLOR]24,0,[COLOR=black]424[/COLOR]0" rotate="0,[COLOR=black]0,0,[/COLOR]0" scale="[COLOR=black]1,1,[/COLOR]1" disable_cell_radius="2" stuff_id="0" />
Event Girl - Yul

Code:
        <extra_stuff    id="1"    filename="Character\w29etc17.EBM"    min="-17[COLOR=black]0.87[/COLOR]3,-2[COLOR=black]5.31[/COLOR]12,-24[COLOR=black]4.72[/COLOR]7"    max="2[COLOR=black]15.3[/COLOR]7[COLOR=black]9,65[/COLOR]0,1[COLOR=black]72.77[/COLOR]5" />
        <extra_entity    type="1"    pos="1[COLOR=black]950[/COLOR]5,0,[COLOR=black]56[/COLOR]61"    rotate="0[COLOR=black],0,0[/COLOR],0"    scale="1[COLOR=black],1,1[/COLOR]"    disable_cell_radius="1"    stuff_id="1" name="extra_npc_002" npc_id="49" npc_tag="0" npc_type="7" />
That's all :)


--------

Added on Monday March 29th 2010

--------

For ppl who got problem with synchronizing client/server files. I made a tool (temporary) called "Cabal Enc Tool" :D

It will help you convert data of ENC to SCP and vice versa.

Here's its screenshot and a little of guide for using it.

trungnt88 - Guide to add a NPC and config it to work as a Shop - RaGEZONE Forums

​

1, ENC data here
2, Click to convert from ENC (text in #1) to SCP (fill #3 and #4 before click this)
3, NPC Id (must be integer, ex 4,5,7,35,...)
4, Item Index Start (value of 1st row of 1st column in SCP which will be generated)
5, Click to convert from SCP (text in #7) to ENC (no need to fill #3, #4)
6, SCP data column name
7, SCP data here

Get it here :

Note : You must have .Net Framework 2.0 in order to use this.


--------

Added on Monday April 5th 2010

--------

If you have problem with determining SlotIdx (position of item in NPC Shop), you can check this out :

trungnt88 - Guide to add a NPC and config it to work as a Shop - RaGEZONE Forums
 
Last edited:
Nice :)
I have one question.If i edited extra_obj.enc then i login my server, show me clientt est soft error message..What is the problem....? :)

I want to edited Lady Yekaterina Agent Shop...only object ,not npc :D sry my bad english :D
 
Last edited:
Nice guide, i like it.

Nice :)
I have one question.If i edited extra_obj.enc then i login my server, show me clientt est soft error message..What is the problem....? :)

I want to edited Lady Yekaterina Agent Shop...only object ,not npc :D sry my bad english :D

If you are using the patchtool ont he server try using the enc packer that comes with balq's tools or Yamachi's COZip. I have had some very strange results with phantom*'s code and i have never figured out why.
 
Hmm. I have a question.

I get an error when buying from the shop with the Upgrade core. I have entered exactly what you have put in your guide and I get a client error 161 and I have to re-login again.

What else could I be doing wrong??

Here is my error log from WorldSvr:

Code:
[Mon Mar 29 2010 11:22:19.160531 72731536]: [##ERROR##] OnCSCItemBuyings(): invalid pNpcsData. charIdx(16), worldIdx(1), iNpcsIdx(35)
[Mon Mar 29 2010 11:22:19.160644 72731536]: [##ERROR##] 'OnCSCItemBuyings' fail (Proc/Inventory.cpp:3231)
[Mon Mar 29 2010 11:22:19.160691 72731536]: [##ERROR##] UsrMap Fail : MainCmd(161) Ret(290C9F:41:3231) Addr(192.x.x.x)
[Mon Mar 29 2010 11:22:19.169830 1126512]: sock 11=> close by finish waiting(192.x.x.x)
[Mon Mar 29 2010 11:22:19.171362 1126512]: 1.close user 11 [9DC6C98] (192.x.x.x)
 
Ok here is what I have. Tell me if im doing something wrong because I cannot see it ;-)

Code:
[B]World1-npc.scp:[/B]
24	0	29	160	195	7	0
25	0	30	59	68	7	0
26	0	50	0	0	1	0
28   	0 	35       15      43      1       1

140	50	36	8	50	3	0	250000
141	50	37	12	30	3	0	24000
142	35	38	91	0	-19	0	600

[B]Cabal ENC:[/B]
<shop    id="35"    >
<item	slot_id="0"	item_id="91"	option="0" reputation_class="-19"	duration_id="0"	price="600"	/>
</shop>

What doesn't match here??
 
@Daman2009

Slot ID must be the same in two position:

Code:
142    35    [COLOR=Red][SIZE=5]38[/SIZE][/COLOR]    91    0    -19    0    600
<item slot_id="0" item_id="91" option="0" reputation_class="-19" duration_id="0" price="600" />
 
@All :


For ppl who got problem with synchronizing client/server files. I made a tool (temporary) called "Cabal Enc Tool" :D

It will help you convert data of ENC to SCP and vice versa.

See 1st post for more details.
 
Last edited:
@All :


For ppl who got problem with synchronizing client/server files. I made a tool (temporary) called "Cabal Enc Tool" :D

It will help you convert data of ENC to SCP and vice versa.

See 1st post for more details.

Great tool, but still no worky for me :-(

Also, Why doesn't extra_obj_msg.enc work for naming the flasha NPC and lady whatever her name is???

I found that I had these nps's set up in Cabal.enc too. Im gonna remove them maybe there is a conflict??
 
Great tool, but still no worky for me :-(

Also, Why doesn't extra_obj_msg.enc work for naming the flasha NPC and lady whatever her name is???

I found that I had these nps's set up in Cabal.enc too. Im gonna remove them maybe there is a conflict??

NPC Name was stored in "cabal_msg.enc" check 1st post for detail.

About your problem, I can't find why it happened :(

--------

Added on Monday April 5th 2010

--------

If you have problem with determining SlotIdx (position of item in NPC Shop), you can check this out :

trungnt88 - Guide to add a NPC and config it to work as a Shop - RaGEZONE Forums

---

1st post has been updated too.
 
Last edited by a moderator:
I buy stuffs from the shop. It gives Error Code 6.

Am I doing it right?


Code:
[b]cabal.enc[/b]
			<shop	id="35"	>
                <item	slot_id="0"	item_id="9"	option="0"	reputation_class="-19"	duration_id="0"	price="250000"	/>
                <item	slot_id="1"	item_id="10"	option="0"	reputation_class="-19"	duration_id="0"	price="500000"	/>
                <item	slot_id="2"	item_id="1"	option="0"	reputation_class="-19"	duration_id="0"	price="1000000"	/>
                <item	slot_id="3"	item_id="1214"	option="0"	reputation_class="-19"	duration_id="0"	price="5000000"	/>
                <item	slot_id="5"	item_id="310"	option="0"	reputation_class="-19"	duration_id="0"	price="10000000"	/>
                <item	slot_id="6"	item_id="311"	option="0"	reputation_class="-19"	duration_id="0"	price="500000000"	/>
                <item	slot_id="16"	item_id="637"	option="0"	reputation_class="-19"	duration_id="0"	price="25000000"	/>
                <item	slot_id="17"	item_id="638"	option="0"	reputation_class="-19"	duration_id="0"	price="50000000"	/>
                <item	slot_id="18"	item_id="639"	option="0"	reputation_class="-19"	duration_id="0"	price="100000000"	/>
                <item	slot_id="19"	item_id="1216"	option="0"	reputation_class="-19"	duration_id="0"	price="500000000"	/>
                <item	slot_id="21"	item_id="313"	option="0"	reputation_class="-19"	duration_id="0"	price="10000000"	/>
                <item	slot_id="22"	item_id="314"	option="0"	reputation_class="-19"	duration_id="0"	price="500000000"	/>
                <item	slot_id="32"	item_id="1209"	option="0"	reputation_class="-19"	duration_id="0"	price="500000000"	/>
                <item	slot_id="35"	item_id="1210"	option="0"	reputation_class="-19"	duration_id="0"	price="500000000"	/>
                <item	slot_id="38"	item_id="1208"	option="0"	reputation_class="-19"	duration_id="0"	price="500000000"	/>
            </shop>

[b]World1-npc.scp:[/b]
115	35	0	9	0	-19	0	250000
116	35	1	10	0	-19	0	500000
117	35	2	1	0	-19	0	1000000
118	35	3	1214	0	-19	0	5000000
119	35	5	310	0	-19	0	10000000
120	35	6	311	0	-19	0	500000000
121	35	16	637	0	-19	0	25000000
122	35	17	638	0	-19	0	50000000
123	35	18	639	0	-19	0	100000000
124	35	19	1216	0	-19	0	500000000
125	35	21	313	0	-19	0	10000000
126	35	22	314	0	-19	0	500000000
127	35	32	1209	0	-19	0	500000000
128	35	35	1210	0	-19	0	500000000
129	35	38	1208	0	-19	0	500000000
 

Attachments

  • Cabal(Ver22-100522-2232-0000) - Guide to add a NPC and config it to work as a Shop - RaGEZONE Forums
    Cabal(Ver22-100522-2232-0000).webp
    197.7 KB · Views: 984
By setting "Price" = 0 you can hide item from the shop but in memory (or smt like that) it's still there. So you must double check the value in "slot_id" (both client and server side) and ensure that there isn't any duplicated values.
 
question how to put name this npc in game cos all npc new not have name in game


thanks
 
Last edited:
i'm also having disconnection issue but only when buying ACCOUNT BINDING ITEMS like costumes and pets in the NPC but with non-account binding item like astral bikes and cores no disconnection is there a fix for this or is there a way to DELETE the ACCOUNT BINDING attribute of an item??? oh btw just want to ask what's the maximum price of item in npc? because i have an item that sells for 10 billion alz but the price in the store dont display correctly it display something like 1,457,xxx,xxx only.
 
Last edited:
Back