Mob NPCTemplate - Dawn-of-Light/DOLSharp GitHub Wiki
Discovering Mob/NPCTemplate tables
To be able to update or view the DOLServer database content easily with any SQL browser I needed a clear description of the main tables in DOL Database.
Here I'll explain how's working the Mob / NPCTemplate tables which are used to display all Non-Playable Characters/Monsters and even decoration elements like birds, snakes or wisps.
The main target is to use Mob table for locations (X, Y, Z, Heading, Region) only, those locations will tell the server to spawn objects described by the NPCTemplate table at given places of the game.
This can be seen as the Class / Instance relation of an object oriented programming language, the Class is the pattern to make the object (NPCTemplate), the Instance is the resulting single object which was made using the pattern (Mob), ideally you will make more than one mob/npc out of one template.
1 Mob Table
I'll explain this table first because it's mostly where everyone will head first!
You should always keep the NPCTemplate table by the hand when working on the Mob Table, because even if you want to work on a non-templated Mob you should definitely take the time to create one for it!
Primary Key Mob_ID : varchar(255)
It's a GUID unique string, any string can do the trick except that it must be unique in the tables records
Secondary Key Secondary Keys are used to search fields efficiently it's like putting a label on the field to find values faster
NPCTemplateID : int(11)
This is the main secondary key you will be using! Remember? Mob table records are Instance of NPCTemplate Class, referencing Mob to NPCTemplate will get you a new build of Mob according to NPCTemplate values!
References :
NPCTemplate.TemplateId
MobxLootTemplate.MobName (Cast as a String!)
FactionID : int(11)
One of the few not templated values, this set the Mob/NPC faction to raise or lower faction friendship upon kill
References :
Faction.ID
PathID : tinytext
Another value that can not be in NPCTemplate, this set path for the Mob, as NPCTemplate could be invoked anywhere the path for the Mob to walk on cannot be known for any point of the world...
References :
Path.PathID
Name : varchar(255)
Name of the Mob that will be displayed in game.
Can be overridden by NPCTemplate.Name (should be set equal to NPCTemplate.Name to prevent any errors)
It can be match against following tables :
MobxLootTemplate.MobName
LootTemplate.TemplateName
Region : smallint(5)
Region where the mob will spawn
References :
Regions.RegionID
EquipmentTemplateID : text
String referencing NPCEquipment table, shouldn't be used anyway as you're creating Templated Mobs, and this should go in NPCTemplate table!
References :
NPCEquipment.TemplateID
ItemListTemplateID : text
String referencing MerchantItem table, which means this mob/npc is a merchant, get data to build item selling list, and this should also be in the NPCTemplate table...
References :
MerchantItem.ItemListID
Race : int(11)
Race of the Mob/NPC, this can be found in NPCTemplate and should be set there.
References :
Race.ID
OwnerID : int(11)
Owner of a Pet Mob/NPC, shouldn’t be set by hand!
Fields and Value I won't explain anything of the other fields of Mob Table as you're probably jumping right away to the NPCTemplate chapter after you understood that everything should be set there! But there is still important values that can’t get out of Mob table, like localization!
X, Y, Z : int(11)
Localization of the Instanced Mob/NPC, this is set according to “Region” where the mob will be located
Heading : smallint(5)
Where the Mob is facing when spawn
RoamingRange : int(11)
Describe a circle of “RoamingRange” radius where the mob can idly walk.
2 NPCTemplate Table
Here is the real work now. This table is made to pattern Mobs/NPC, you can describe all the parameters of your Mob/NPC and turn it into visible object in your DOL world using the Mob Table to spawn copies everywhere!
Primary Key NpcTemplate_ID : varchar(255)
It's a GUID unique string, any string can do the trick except that it must be unique in the tables records
Secondary Key Secondary Keys are used to search fields efficiently it's like putting a label on the field to find values faster
TemplateId : int(11)
This value in an integer that should be referenced by Mob table to create an instance of this Template. This value can be duplicate, this will result in a mob having multiple template, the Game Manager will randomly choose between any template attached to the Mob table record, for example you could create 3 templates for a similar Mob using thrust, blunt or slash weapon and give them the same TemplateId, upon mob death the server will respawn a random template out of those 3 and display a mob equipped with one of these weapons model and melee damage type set according to the weapon model! You could also raise Dex stats for the Mob Template using thrust Weapon...
Referenced by :
Mob.NPCTemplateId
Name : varchar(255)
Name of the Mob/NPC that will be displayed, if this is set through the NPCTemplate table this means your Mob/NPC is templated, the LootTemplate table lookup will occur on the TemplateID before doing a lookup on Name! In current Public Database most of the NPCTemplate are match against LootTemplate table using Name field, this should be set to TemplateID field for better customization. For example you can create a NPCTemplate for a New Frontier “Basilisk” attached to LootTemplate using TemplateID and have “Stones of reward” dropping only in NF, for others inland “Basilisk” you just attach to the Name field in LootTemplate for common loots, this will make all “Basilisk” drop common loots but those in NF are dropping more stuff due to the TemplateID matching LootTemplate!
References :
LootTemplate.TemplateName
MobxLootTemplate.MobName
EquipmentTemplateID : (Splittable) text
String referencing the NPCEquipment table used to attach weapon and armor models to display on a Mob/NPC, this is a Splittable Field (See Splittable chapter), that means is support multiple references and ranges to randomize equipment, this could make a simple templated mob able to spawn with different equipment (chain armors or Leather for example)
References :
NPCEquipment.TemplateID
ItemsListTemplateID : text
String referencing MerchantItem table, which means this mob/npc is a merchant, get data to build item selling list.
References :
MerchantItem.ItemListID
Race : int(11)
Race of the Mob/NPC.
References :
Race.ID
OwnerID : int(11)
Owner of a Pet Mob/NPC, shouldn’t be set by hand!
Fields and Value Here are the stuff to pattern your Mobs! Finally you can set your mob appearance, size, speed, level, aggressive behaviour anything to make it live!
GuildName : tinytext
String to display as Guild Name for the Mob/NPC useful for Quest specific Mobs!
Model : (Splittable) tinytext
Model ID, or Splittable String of Model ID to randomize Mob/NPC appearance
Size : (Splittable) tinytext
Size of the Model, or Splittable String of Size to randomize Mob/NPC size appearance
MaxSpeed : smallint(6)
Max Speed of the Mob/NPC while moving.
Flags : smallint(3), Binary Code
Special status of the Mob/NPC, listed among these values, that can be added together for a Binary Code :
1 – GHOST
2 – STEALTH
4 – DONT SHOW NAME
8 – CAN’T TARGET
16 – PEACE
32 – FLYIN
64 – TORCH
128 – STATUE
256 – SWIMMING
If you want a PEACE Mob that DON’T SHOW NAME, input 16 + 4 = 20 as a value! Max value is 511 for all Flags set!
MeleeDamageType : tinyint(3)
Self-explanatory :
1 – Crush
2 – Slash
3 – Thrust
ParryChance, EvadeChance, BlockChance, LeftHandSwingChance : tinyint(3)
Self-explanatory too, based on 0% to 100% for maximum chance.
Spells, Styles : (Splittable) Text
Splittable String that describe the spells and styles a Mob/NPC can use, spells are based on “Spell ID” from Spell table, styles are bases on “Style ID|Class ID” from Style table
Strength, Constitution, Dexterity, Quickness, Piety, Intelligence, Charisma, Empathy : int(11)
Stats of the Mob/NPC, be aware that damage and other abilities may not follow Player rules... Base value is 30
Abilities : (Splittable) Text
String that list Abilities KeyName of the Mob/NPC piped with Ability level for example : “Intercept|1;CCImmunity|1” will give the Mob/NPC the listed abilities, references Ability table.
AggroLevel : tinyint(3)
Number representing Aggressiveness of the Mob/NPC, can be modified by Realm ownership and Faction relations
0 – 25 Friendly
25 – 50 Neutral
50 – 75 Hostile
75 and above Aggressive
AggroRange : int(11)
Range from Mob/NPC at which Aggro Level is used to check if Mob/NPC will attack or not (Higher is the Aggro Level, higher are the chances to be attacked within Aggro Range)
ClassType : text
DOLServer NPC Implementation for this Template, example DOL.GS.Blacksmith is used to template Blacksmith NPC.
Level : (Splittable) text
Collection and Ranges of integer representing the Mob/NPC Level, based on the same levels as players... for example a Mob that can spawn at level 46 or 48 to 52 would be the string “46;48-52”
BodyType : int(11)
Enum like value to represent the Mob/NPC type (maybe used for charming spells check and other conditions)
0 – None
1 – Animal
2 – Demon
3 – Dragon
4 – Elemental
5 – Giant
6 – Humanoid
7 – Insect
8 – Magical
9 – Reptile
10 – Plant
11 – Undead
MaxDistance, TetherRange : int(11)
MaxDistance is checked in DOLServer to prevent a Mob/NPC from “sticking” an object farther than this value, TetherRange is checked for pulling purpose, a Mob/NPC won’t chase player farther than this.
VisibleWeaponSlot : tinyint(3)
Used to display the weapons from Mob/NPC or not... it’s a Binary value but it use byte shifting, making it hard to just add numbers, here some values given by “Argo” :
0 – Not loaded (use Mob table value or other mechanisms)
16 – One hand Weapon + Shield
34 – Two handed Weapon
51 – Distance Weapon
240 – One hand Weapon, no Shield
255 – No weapon at all
ReplaceMobValues : int(11)
Boolean value to tell the server to overwrite Mob table values or not... this can be useful when copying Mobs to NPCTemplate and testing purpose, this could also be used if you use more than one NPCTemplate for a given Mob and want to keep base value of Mob table, but honestly this is a wrong way to do it!
1 – Overwrite
0 – Do not Overwrite
PackageID : text
Despite its name this field doesn’t reference anything, it should be used like a comment Area, most of time it’s the SQL package you used to build your database, like DOL Public DB, or maybe SniperWolf or Misi...
Good behavior would be to add your comments about the record, if it’s a copied NPCTemplate to reference different LootTemplate you could input the main NPCTemplate used for copy here to keep logs of what you copied!
Suffix, ExamineArticle, MessageArticle : text
These fields are related to in game translation, here you can describe the language article to be used when something is written about your mob. Example, females mobs are “She”, wisps mobs are “It”, when mob name is beginning with a vowel you can switch between “a” and “an”, and there is a lot of these specificity in other languages...
Unfortunately I have no clue how to use this field... Get in contact with Urza!
3 Splittable
After all this reading, just a side note to explain some “Splittables” Fields
-
Most of them can just take numeric values in the form of Collection or Ranges, for example “1;2;3;5;7” would be a collection of prime numbers, “10-20” would be all the values between and including 10 to 20, and you can mix both “11;12-18;23;27” which means to use the values 11, 23, 27 and all the values between 12 and 18.
-
For styles or ability it use a special delimiter, and doesn’t support Ranges, the “|” (pipe) is used to store additional data about one value, for example style can reference StyleID and ClassID for each semicolon separated values or just StyleID “156|22;159;157|22;158|22”, for Abilities it’s a string “KeyName” and a “Level” value “CCImmunity|1;Avoidance of Magic|5;Physical Defense” I’m not sure what happen if no level is specified...
But now it’s for you to try!
You should be able to read and update these tables now, notice that no effects will take place in game until you reload the objects from the database or restart the server, if you’re comfortable with SQL language this can lead you to make massive modifications into your database or display your bestiary on a web portal.
Have Fun!