Custom mobs

= Intro = You can have up to 10,000 mob IDs. This guide was written without testing on Git; use at your own discretion. Well, its pretty easy if you do it correctly and go step by step without rushing.

= Gettings Started = == Database Structure == Let's take a look at the structure of the entries in mob_db.conf:

Note: If you're adding custom mobs, it's better to add them to mob_db2.conf

    // =================== Mandatory fields ===============================
    Id: ID                                (int)
    SpriteName: "SPRITE_NAME"             (string)
    Name: "Mob name"                      (string)
    // =================== Optional fields ================================
    Lv: level                             (int, defaults to 1)
    Hp: health                            (int, defaults to 1)
    Sp: mana                              (int, defaults to 0)
    Exp: basic experience                 (int, defaults to 0)
    JExp: job experience                  (int, defaults to 0)
    AttackRange: attack range             (int, defaults to 1)
    Attack: [attack1, attack2]            (int, defaults to 0)
    Def: defence                          (int, defaults to 0)
    Mdef: magic defence                   (int, defaults to 0)
    Stats: {
        Str: strength                 (int, defaults to 0)
        Agi: agility                  (int, defaults to 0)
        Vit: vitality                 (int, defaults to 0)
        Int: intelligence             (int, defaults to 0)
        Dex: dexterity                (int, defaults to 0)
        Luk: luck                     (int, defaults to 0)
    ViewRange: view range                 (int, defaults to 1)
    ChaseRange: chase range               (int, defaults to 1)
    Size: size                            (int, defaults to 1)
    Race: race                            (int, defaults to 0)
    Element: (type, level)
    Mode: {
        CanMove: true/false           (bool)
        Looter: true/false            (bool)
        Aggressive: true/false        (bool)
        Assist: true/false            (bool)
        CastSensorIdle:true/false     (bool)
        Boss: true/false              (bool)
        Plant: true/false             (bool)
        CanAttack: true/false         (bool)
        Detector: true/false          (bool)
        CastSensorChase: true/false   (bool)
        ChangeChase: true/false       (bool)
        Angry: true/false             (bool)
        ChangeTargetMelee: true/false (bool)
        ChangeTargetChase: true/false (bool)
        TargetWeak: true/false        (bool)
    MoveSpeed: move speed                 (int, defaults to 0)
    AttackDelay: attack delay             (int, defaults to 4000)
    AttackMotion: attack motion           (int, defaults to 2000)
    DamageMotion: damage motion           (int, defaults to 0)
    MvpExp: mvp experience                (int, defaults to 0)
    MvpDrops: {
        AegisName: chance             (string: int)
    Drops: {
        AegisName: chance         (string: int)

{ class="wikitable"
! Fields !! Description
{ class="wikitable"
! Stats !! Description
{ class="wikitable"
{ class="wikitable"

|- | '''Element''' || This is a two-digit number representing the rank (level) and element of the mob.
|- | '''Element(Type)''' || Element Type of mob as mentioned below.
{| class="wikitable" | 0 || Ele_Neutral |- | 1 || Ele_Water |- | 2 || Ele_Earth |- | 3 || Ele_Fire |- | 4 || Ele_Wind |- | 5 || Ele_Poison |- | 6 || Ele_Holy |- | 7 || Ele_Dark |- | 8 || Ele_Ghost |- | 9 || Ele_Undead |}

|- | '''Element(Level)''' || Element level of mob from (1-4).
|- | '''Mode''' || This defines the mob behaves. |- | '''MoveSpeed''' || Walking speed of the mob. 1 is the fastest, 1000 is the lowest. 100 is the normal walking speed. |- | '''AttackDelay''' || ADelay= Attack Delay, also known as ASPD. This one will change the aspd of the mob. The lower the faster, but don't make it too low or it will lag when mobbed by several of these. |- | '''AttackMotion''' || Attack animation motion. Lower this value and the mob's attack will be displayed in higher fps (making it shorter, too) (Thanks to Wallex for this) |- | '''DamageMotion''' || Damage animation motion, same as aMotion but used to display the "I am hit" animation. Coincidentally, this same value is used to determine how long it is before the mob/player can move again. Endure is dMotion = 0, obviously. |- | '''MvpExp''' || The MVP exp the mob gives when it is defeated (to the player who got the MVP reward) (This exp is a percentage of the exp the monster gives.) |- The following fields are for drops and drop rates. Remember that these are in percentages; i.e. 100 = 100% |- | '''MvpDrops''' || The MvP Drops goes here, format is:

AegisName: Chance


Poring_Card: 1000

|- | '''Drops''' || The Normal Drops goes here, format is:

AegisName: Chance


Poring_Card: 1000


== Making it visible == === Server Side === If you've got a sprite and you're happy with it, then you can skip this part. If you would like to make your mob look like another mob, or even a player, then you need to take a look at db/mob_avail.txt

For normal mobs, you can use the data that's already in the file as an example to work on: // mob_id,sprite_id,equip # // iRO Halloween Event 2008 //3000,1015,0 //3001,1036,0 //3002,1298,0

// iRO Halloween Event 2009 //3014,1179,0 //3015,1272,0

However, if you would like to make your mob look like a character, you need to add more options:
// Valaris {| class="wikitable" |- | MobID || SpriteID || Sex || Hair || Hair_Color || Weapon || Shield || Head_Top || Head_Middle || Head_Bottom || Option || Dye_Color |- | 1900, || 4013, || 1, || 1, || 1, || 1254, || 0, || 67, || 12, || 54, || 16, || 1 |} You will need to use the Item ID for your mob's weapon and shield instead of the View ID of the item. Doing so may have undesirable effects.

A more in-depth look at each value:

'''MobID''': This is your mob ID.
'''SpriteID''': The Job number you want it to look like. They are:

Job_Novice 0
Job_Swordman 1
Job_Mage 2
Job_Archer 3
Job_Acolyte 4
Job_Merchant 5
Job_Thief 6
Job_Knight 7
Job_Priest 8
Job_Wizard 9
Job_Blacksmith 10

They can also be found on db/const.txt file.

'''Sex''': 0 for female, 1 for male
'''Hair''': The mob hair style, goes from 1 to 23
'''Hair_Color''': The mob hair color. Goes from 0 to 8 or 10, but it depends on the server's palette files.
'''Weapon''':The ID of the Weapon you want. See [[Custom_weapons|Custom Weapons]] for it. Also read at the end of the pre if you cant find the headgear you want.
'''Shield''': Same as above
'''Head_Top''': Same as above
'''Head_Middle''': Same as above
'''Head_Bottom''': Same as above
'''Option''': this option parameter will make the mob change its status, as well as give them carts, pecopecos, and falcons. In other words, this will change the visual effects of your mobs. The options are these*:

 1 Sight             32 Peco Peco riding   2048 Orc Head
 2 Hide              64 GM Perfect Hide    4096 Wedding Sprites
 4 Cloak            128 Level 2 Cart       8192 Ruwach
 8 Level 1 Cart     256 Level 3 Cart
16 Falcon           512 Level 4 Cart
                   1024 Level 5 Cart

'''Dye_Color''': Same as hair color. It goes from 0 to 77

=== Client Side === For your mob to exist in the client, you need to add it to a few [[Lua]] files. ==== datainfo/npcidentity.lua ==== Example at the end of the file:
["JT_4_F_TAEKWON"] = 644, ["JT_4_F_SWORDMAN"] = 645, -- Custom Mobs ["JT_JACOB"] = 2500, ["JT_AQUARING"] = 2600 } The number after the = sign denotes the mob's database ID number. Other sprites in this file have their view ID e.g. [[Adding_a_Script#Client_Side|NPC sprite number]].

==== datainfo/jobname.lua ==== Example at the end of the file:
[jobtbl.JT_GIBBET] = "GIBBET", [jobtbl.JT_DULLAHAN] = "DULLAHAN", [jobtbl.JT_LOLI_RURI] = "LOLI_RURI", [jobtbl.JT_DISGUISE] = "DISGUISE", -- Custom Mobs [jobtbl.JT_JACOB] = "jacobmob", [jobtbl.JT_AQUARING] = "aquaring" } In this file, the value after the = sign is the name of the actual sprite in your data folder/[[GRF]]

== Your mob in other files == === Dead Branch === Adding your mob to db/pre-re/mob_branch.txt or db/re/mob_branch.txt will allow Dead Branches to summon it.

=== Bloody Branch === Adding your mob to db/pre-re/mob_boss.txt or db/re/mob_boss.txt will allow Bloody Branches to summon it.

=== Poring Box === Adding your mob to db/pre-re/mob_poring.txt or db/re/mob_poring.txt will make your mob spawnable via the Poring Box.

=== Monster Racial Groups === Adding your mob to db/pre-re/mob_race2_db.txt or db/re/mob_race2_db.txt will add your mob to a [[Racial_Group|Racial Group]]. Guardians, Goblins and other mobs are members of particular Racial Groups.

=== Red Pouch of Surprise === Adding your mob to db/mob_pouch.txt will make your mob spawnable via the Red Pouch of Surprise.

== Spawn Points == Let's look at the syntax of a mob spawn point:


Only the things between <> are changed. Do not remove or change monster after the coordinates, because that's what tells the server that this line is a monster spawn script.

'''map name''': Name of the map. Use /where along with the following coordinates
'''x1''': X axis coordinates. It start from the left side of the map, and the higher it gets, the more it gets closer to the right side of the map.
'''y1''': Y axis coordinates. It start from the bottom, and the higher it gets, the more it gets closer to the top of the map.
'''x2''': X axis coordinates. It start from the left side of the map, and the higher it gets, the more it gets closer to the right side of the map.
'''y2''': Y axis coordinates. It start from the bottom, and the higher it gets, the more it gets closer to the top of the map.
These 4 coordinates will make a spawn area where the mob will spawn, however it won't limit its movement, so lets say you put 120,150 on the first pair, and 130,160 pair- That's a 10x10 cell area where the mob will spawn randomly.
If you want the mob to spawn at a random point, use 0 for all the coordinates.
'''monster name''': The name of the mob you want to be shown (using --ja-- in place of a name will display the "Japanese Name" from your database).
You can specify a custom level to use for the mob different from the one of the database by adjoining the level after the name with a comma. eg: "Poring,50" for a name will spawn a monster with name Poring and level 50.
'''mob id''': The ID of your mob.
'''amount''': How many mobs you want to be spawned.
'''delay1''': Minimum amount of time before a monster respawns.
'''delay2''': Maximum amount of time before a monster respawns.
delay1 and delay2 are used to define the time it takes for a monster to respawn; in milliseconds. Normal mobs usually have 0 (Instant Respawn), while MVPs have 7200000 (2 hours). If delay2 is greater than delay 1, the mob won't respawn until the map server restarts.
'''event''': Script event to be executed when the mob is killed. The event must be in the form "NPCName::OnEventName" to execute, and the event name label should start with "On". As with all events, if the NPC is an on-touch NPC, the player who triggers the script must be within 'trigger' range for the event to work.
'''size''': Optional. Size can be 0 (medium), 1 (small), or 2 (big).
'''ai''': Optional. AI can be 0 (default), 1 (attack/friendly), 2 (sphere), 3 (flora), or 4 (zanzou).

== Adding Skills ==

Lets look at the syntax of a mob skill:

MOB_ID, a unused dummy character sequence (for information only), STATE, SKILL_ID, SKILL_LV,
rate (10000 = 100%), casttime, delay, cancelable, a target, a condition type, a condition value,
a value 1, a value 2, a value 3, a value 4, a value 5, emotion

''''' NOTE: I had to cut the mob_avail structure so it could fit. It's a whole line, not 3 lines. '''''

'''MOD_ID''': your mob ID.
'''an unused.. etc etc''': you can put any text here you want, its just for information and to know what does this do. tip tipYou will see inside this file things like Poring@TF_POISON. Well, you could use this too. It would tell you: mob_name@DB_Skill_Name. tip tip
'''state''': this is the state that the mob must accomplish before being able to use this skill. The states are:

any, idle (in standby), walk (in movement), attack, dead (on killed), loot, chase (following target),

'''SKILL_ID''': The ID of the skill goes here. To look for one, go to your db folder and open the skill_db.txt file. You will see a lot of lines like this one:

2,0,0,0,0,0,10,0,no,0,0,0,weapon,0 //SM_SWORD#Œ•C—û#

And the syntax is:


so, the ID of the SM_SWORD, which is the Swordman's Sword Mastery by the way, is 2:

'''2''',0,0,0,0,0,10,0,no,0,0,0,weapon,0 //SM_SWORD#Œ•C—û#

'''SKILL_LV''': You can put the skill level as high as you want. Though, 100 is usually as far as most skills go.
'''rate''': How frequent will the mob use the skill.
'''casttime''': Skill's cast time.
'''delay''': How much time must pass before the skill can be used again, in milliseconds.
'''cancelable''': if the skill cast can be interrupted. Set it either '''yes''' or '''no'''.
'''a target''': the target of the skill. It can be:

target (player), self (the mob itself), friend (slaves)

'''a condition type''':a condition that also must be fulfilled before the mob is able to use this skill. There are two kinds of conditions:

  1. Mob Condition:
//conditions: (condition type) (value which specifies a condition value)
// always            unconditional
// myhpltmaxrate     when the mob's hp drops to a certain %
// mystatuson        If the mob has any abnormalities in status (condition value),
// mystatusoff       If the mob has ended any abnormalities in status (condition value),
// friendhpltmaxrate when the mobs' friend's hp drops to a certain %
// friendstatuson    If the friend has any abnormalities in status (condition value),
// friendstatusoff   If the friend has ended any abnormalities in status (condition value),
// attackpcgt        Attack PC becomes more than the  number of specification
// attackpcge        Attack PC becomes equal or more than the number of specification.
// slavelt           when the number of slaves is lower than the original number of specification.
// slavele           when the number of slaves is lower or equal than the original number of specification.
// closedattacked    when melee attacked (close range attack)
// longrangeattacked when long ranged attacked (like bows and far range weapons)
// skillused         when a skill is used on the mob
// casttargeted      when a target is in cast range.
// rudeattacked      when a target is rude attacked
// hiding            when a target is hidden *not implemented yet*
  1. Target Conditions
// The character's state which can be specified to be a condition value
// by the statuson/statusoff system
// anybad      any type of state change
// stone       condition of being in stone state
// freeze      condition of being in frozen state
// stan        condition of being in stunned state
// sleep       condition of being in sleep state
// poison      condition of being in poisoned state
// curse       condition of being in cursed state
// silence     condition of being in silenced state
// confusion   condition of being in confusion state
// blind       condition of being in blind state
// hiding      condition of being in hidden state
// sight       condition of being in unhidden state

You can use only ONE of these conditions.

'''value1,value2,value3,value4,value5''': Basically they're only the same but, when you want your mob using the same condition to trigger the skill, but in different times, in case of the myhpltmaxrate when the hp is being decreased, you can set them in a decreasing order, like:


'''emotion''': Lets your mob use an emotion, at random times. The emotion IDs are:

e_gasp 0
e_what 1
e_ho 2
e_lv 3
e_swt 4
e_ic 5

For more info, go to your db/const.txt file.

== Making it talk! == Another add, suggested by chronocrosser_x and Fenrir Soarblade:

Well, I believe you have seen some mobs on your server talking when certain things happens. I never saw them again talking, dont know why but they used to talk. I believe they still do it.

Ok, go to your Data folder. If you look in the files, you should find a file called monstertalktable. If there isnt, we will create one with Wordpad =3!. If there is, open it with Wordpad, not Notepad.

Once there, we will copy and paste this:




Well, lets see step by step =3!:

'''''': This is the start of the monster talk table. Leave it as it is =3!
'''''': The mob_db.txt first name you see, after the ID, goes here =3! Its used to identify the mob
'''%TAB%Text Here%TAB%''': This is an event, same as the one below. When a monster see you, this one will be displayed =3!
'''%TAB%Text Here%TAB%''': When a monster attacks you, this one will be displayed O_O!
'''%TAB%Text Here%TAB%''': When a monster's hp is at 50%, this one will be displayed o..o!
'''%TAB%Text Here%TAB%''': When a monster's hp is at 25%, this one will be displayed x,x
'''%TAB%Text Here%TAB%''': When a monster kills a character/player, this one will be displayed T~T!
'''%TAB%Text Here%TAB%''': When a monster dies by player hand, this one will be displayed ^__^!
'''''': The same name of the mob_db.txt, the one after the ID.
'''''': Keep it like this.

I never messed with this, but i think its ok =3! Also for those spaces other than the messages spaces, use TAB, not the Space Bar for it ._.!

[[Category:Database]] [[Category:Data]] [[Category:Customization]]