Difference between revisions of "My first: Character creation origin"

From Divinity Engine Wiki
Jump to: navigation, search
(Adding The Origins To The Scripting Database)
(Adding The Origins To The Scripting Database)
 
Line 64: Line 64:
 
You'll see the "Start" script (or goal, as we call it) under "DOS2ModWrapper".<br />
 
You'll see the "Start" script (or goal, as we call it) under "DOS2ModWrapper".<br />
 
Use the same "DB_Origins" logic, as in the following picture, to register your character. The id corresponds to the id you used in your xml file under "Character UUID".<br />
 
Use the same "DB_Origins" logic, as in the following picture, to register your character. The id corresponds to the id you used in your xml file under "Character UUID".<br />
You do not have to add your code line to this specific script. It is better to add it to a scipt of your own, under the Start folder of your own project. That way, your mod stays compatible with other mods that add Origin characters! <br />
+
You do not have to add your code line to this specific script. It is better to add it to a scipt of your own, under the DOS2ModWrapper folder, in your own project. That way, your mod stays compatible with other mods that add Origin characters! <br />
  
 
[[File:StartGoal.png|none]]
 
[[File:StartGoal.png|none]]

Latest revision as of 09:35, 16 July 2018

Getting started

The Divinity Engine uses XML style file presets in order to load in the available classes during character creation.
This data driven approach allows us to define custom presets in character creation in the blink of an eye.
The first thing you need to know when creating your first character creation origin is the location of the preset files.
You can find those located inside : Data/Mods/{YourModName}/CharacterCreation/OriginPresets (If the directory doesn't exist, you can just create it yourself).
Once you find or create the directory inside of your mod.
Here's an already made template file so you can try it out for yourself: Origin Template
Once you put the provided template file in the folder, load up character creation now and cycle through the origins,
you should be able to see something like the following:

CustomOrigin.png

Preset breakdown

Now that we've loaded our origin preset let's take a look at the most important properties.
Open up the template file in any text editor. If you're not familiar with XML we suggest to read up on that first.

Origin Display Name

The name which will be displayed to the user in the UI.
The handle property is set to ls::TranslatedStringRepository::s_HandleUnknown by default in order to signal that this string has not been localized for other languages yet.

Origin Name

This is the string which is used by code in order to identify the class with its unique type.
Make sure this name is unique,otherwise things might not behave as they should.
It doesn't need to be the same as the Origin Display Name, but it is nice to be similar for readability's sake.

Origin Description

The description of the Origin which will be shown to the user in the UI.
There's also a Long description, but that one is not currently used anywhere in the game.
The handle property is set to ls::TranslatedStringRepository::s_HandleUnknown by default in order to signal that this string has not been localized for other languages yet.

Character UUID

This one deserves a bit of explanation. In character creation the system uses the so called dummy characters during the customization stage.
After the user has picked their character, the customization is transferred to the character which he's actually going to be playing as.
The flow is designed this way to accommodate for the scripting needs of the game.

The Character UUID field specifies the template UUID which the customization will be transferred to -
the actual character that the user will start controlling once they are done with character creation.
You can create a new template or reuse an already existing one (you can do that in the Editor).
The only important thing is that the chosen template is Global. This means its isGlobal flag must be checked when inspecting it in the editor.
If you want to use an already existing template, make sure it has the Hero_ prefix in its name. Those templates are all created so that they are able to equip armor. However if you wish to create your own custom template, you can follow this guide - My_first:_Character . A word of warning - creating your own custom hero character is not an easy process.

User Can Alter Tags

This is just a flag which tells the game if this origin can alter its tags or not.
For our predetermined origin stories picking tags is disallowed, but for the custom origin story, you can pick any tags you want.

Skill Set

This is the skill set which is given specifically to this origin. It is loaded from data and needs to be defined there.
You can leave this empty, if your origin does not have any special super powers.

Supported Genders

Simply a list of supported genders for the particular origin. If your origin story is only made for female characters for example, you can remove the male gender from this list.

Supported Races

Simply a list of supported races for the particular origin. If your origin story only fits a particular race or specific set of races, you can specify that list here.

Adding The Origins To The Scripting Database

A lot of the game's logic involving origin characters is handled by our Osiris scripts.
To ensure that your new origin will behave correctly, your character needs to be registered to the existing database of origin characters.
An example of this database registration can be found in the Origins project.

Use the Project Browser to open the Origins project. There, open the Story Editor.
You'll see the "Start" script (or goal, as we call it) under "DOS2ModWrapper".
Use the same "DB_Origins" logic, as in the following picture, to register your character. The id corresponds to the id you used in your xml file under "Character UUID".
You do not have to add your code line to this specific script. It is better to add it to a scipt of your own, under the DOS2ModWrapper folder, in your own project. That way, your mod stays compatible with other mods that add Origin characters!

StartGoal.png