Guide to add a NPC and config it to work as a Shop
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="-170.873,-25.3112,-244.727" max="215.379,650,172.775" />
<extra_entity type="1" pos="1496,0,4345" rotate="0,0,0,0" scale="1,1,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
extra_stuff
- id : ID of object in current map
- filename : 3D Model for object
- min : ?
- max : ?
extra_entity
- type : Object type
- filename : 3D Model for object
- pos : NPC Position (All pos is multiplied by 100 for more accuracy)
- 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)
- 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:
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="npc01-0035" x="14" y="43" is_obj="0" />
world_npc
- id : same id in "extra_obj.enc"
- npc_name : follow this pattern "npcXX-YYYY" where
- 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
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
Now add new line in this file for 1Alz UCH :)
Add into [ShopLst] NpcsIdx NSetIdx ItemKind ItemOpt ReputationClass DurationIdx Price section
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="-170.873,-25.3112,-244.727" max="215.379,650,172.775" />
<extra_entity type="0" pos="2252,-31,3068" rotate="0,0,0,0" scale="1,1,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="-170.873,-25.3112,-244.727" max="215.379,650,172.775" />
<extra_entity type="1" pos="1115,0,3022" rotate="0,0.707107,0,0.707107" scale="1,1,1" 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="-170.873,-25.3112,-244.727" max="215.379,650,172.775" />
<extra_entity type="1" pos="1496,0,4345" rotate="0,0,0,0" scale="1,1,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="-170.873,-25.3112,-244.727" max="215.379,650,172.775" />
<extra_entity type="1" pos="2338,127,1633" rotate="0,1,0,0" scale="1,1,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="-170.873,-25.3112,-244.727" max="215.379,650,172.775" />
<extra_entity type="0" pos="8524,-1,23140" rotate="0,0,0,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="-170.873,-25.3112,-244.727" max="215.379,650,172.775" />
<extra_entity type="0" pos="20824,0,4240" rotate="0,0,0,0" scale="1,1,1" disable_cell_radius="2" stuff_id="0" />
Event Girl - Yul
Code:
<extra_stuff id="1" filename="Character\w29etc17.EBM" min="-170.873,-25.3112,-244.727" max="215.379,650,172.775" />
<extra_entity type="1" pos="19505,0,5661" rotate="0,0,0,0" scale="1,1,1" 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.
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 : http://www.mediafire.com/?1dhgjl20ddz
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 :
Re: Guide to add a NPC and config it to work as a Shop
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
Re: Guide to add a NPC and config it to work as a Shop
Nice guide, i like it.
Quote:
Originally Posted by
mophisto
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.
Re: Guide to add a NPC and config it to work as a Shop
same guide in adding warp points in dungeon.
Re: Guide to add a NPC and config it to work as a Shop
@All:
+ If you have problem with ENC, please use Balq's tool : http://forum.ragezone.com/f459/playe...ml#post5330232
@mophisto
+ If you want to add NPC as an object so you skip from "3, Modified NPC from Normal NPC to Shop NPC" that's all :D
Re: Guide to add a NPC and config it to work as a Shop
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)
Re: Guide to add a NPC and config it to work as a Shop
@Daman2009 : Please ensure that client and server data is matched.
Re: Guide to add a NPC and config it to work as a Shop
Ok here is what I have. Tell me if im doing something wrong because I cannot see it ;-)
Code:
World1-npc.scp:
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
Cabal ENC:
<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??
Re: Guide to add a NPC and config it to work as a Shop
@Daman2009
Slot ID must be the same in two position:
Code:
142 35 38 91 0 -19 0 600
Quote:
<item slot_id="0" item_id="91" option="0" reputation_class="-19" duration_id="0" price="600" />
Re: Guide to add a NPC and config it to work as a Shop
Yeah sorry, I noticed this already but still d/c!
Re: Guide to add a NPC and config it to work as a Shop
@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.
Re: Guide to add a NPC and config it to work as a Shop
Quote:
Originally Posted by
trungnt88
@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??
1 Attachment(s)
Re: Guide to add a NPC and config it to work as a Shop
I buy stuffs from the shop. It gives Error Code 6.
Am I doing it right?
Code:
cabal.enc
<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>
World1-npc.scp:
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
Re: Guide to add a NPC and config it to work as a Shop
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.