Pages

Add NPC Cabal Online

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.
<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

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.

<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:

<cabal_world>

Now find: (mean Bloody Ice)

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

<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
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:

<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:

<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

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

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

 <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

<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

<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

<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

<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

<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

<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

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
Ragezone