High-Level Character Generation

From Dragon Age Toolset Wiki
Jump to: navigation, search

The Awakening and post-Awakening DLC allows players to create new characters that start at a higher level, i.e. the character generation screen does not start at level 1. This High-Level Character Generation tutorial demonstrates how to add similar functionality to stand-alone modules.

Creating the scripts

First, it is very important that you DUPLICATE the important core scripts. By creating your own scripts, you won't have to worry about screwing the official campaign or other modules.

The scripts that must be duplicated for this tutorial:

If you already have duplicates of these for other systems/tutorials (such as the background tutorial), make your edits in those files.

When you duplicate the files, make sure that the names are unique while still naming their purpose for easy editing. For example, you might add a module-specific prefix:

  • scar_module_core
  • scar_sys_chargen_h
  • scar_sys_chargen

Editing the sys_chargen_h file

The first thing you want to do is avoid duplicate functions, as this confuses the compiler. You won't need or want to edit every function, so at the top of the file place another include:

#include "sys_chargen_h"

For this tutorial, you can delete everything except the Chargen_InitializeCharacter function. (Leave any functions that you may have edited, but don't forget to integrate them when necessary.)

Next you need to create a new name for this function. I suggest the prefix you used for the script files:


Near the top of the function you should see a group of lines that look like this:

    // -------------------------------------------------------------------------
    // 2. Set Creature to Level and Experience 0
    // -------------------------------------------------------------------------
    SetCreatureProperty(oChar, PROPERTY_SIMPLE_LEVEL, 1.0, PROPERTY_VALUE_BASE);

Set the level and XP to the appropriate values for your starting level. (You can give less XP, forcing a character to gain that extra XP before leveling. This does not affect companions.)

You also need to find this group:

    // -------------------------------------------------------------------------
    // 6. Set up points available to distribute (skills only on humanoids)
    // -------------------------------------------------------------------------

And set the values to the appropriate level (or give more/less that usual for certain modules.)

Editing the sys_chargen file

Now that the include file is created, open the sys_chargen file. Make sure that you have both chargen includes. For example:

#include "sys_chargen_h"
#include "scar_sys_chargen_h"

This will keep normal functions from breaking.

Find and replace all Chargen_InitializeCharacter functions with your custom function. This will start your character at the appropriate level.

There is a bug that occurs during "Quick-Start" unless another step is taken. Find all instances of AL_DoAutoLevelUp. (There should be two in an unedited file.)

The function that causes the problem looks like this:

AL_DoAutoLevelUp(oChar, TRUE, TRUE);

Either set both trues to falses or copy/paste the other function to this space.

Editing the module_core

The home stretch. Now we have to associate the module chargen script with our custom script.

Near the bottom of an unedited script, you should find:

            // -----------------------------------------------------------------
            // Handle character generation events sent by the engine.
            // -----------------------------------------------------------------
                HandleEvent(ev, R"sys_chargen.ncs");

Switch the script handling the event to your custom script.

Edit: To avoid confusion, the file that should be edited here is your CUSTOM module_core (thanks for pointing that out below, Gaxkang55.) NEVER edit the core scripts, almost anything that you may need to do can be done with custom duplicates.

An alternative view

Editing the module_core script is almost certainly a bad idea, and is probably not even what was intended. But to be crystal clear, this code should be placed in your own module script (see next section), with appropriate modification (depending on how you have defined your event variables in that script). For example, if your module script initialisations are:

    event ev = GetCurrentEvent();
    int nEventType = GetEventType(ev);
    int bEventHandled = FALSE;

then you will need:

            if( (nEventType >= EVENT_TYPE_CHARGEN_START && nEventType <= EVENT_TYPE_CHARGEN_END) || nEventType == EVENT_TYPE_PLAYERLEVELUP )
                HandleEvent(ev, R"scar_sys_chargen.ncs");
                bEventHandled = TRUE;

Calling the custom module script

For those who don't know, a module script now must be associated with the module itself. This is done through [File->Manage Modules->Poperties]. Make sure you have your module selected before you hit properties.

Underneath the module name, there should be a parameter named "Script". Enter the browser and select your custom module_core script. Once you're finished eidting the module, click OK.

Final steps

Unless you already have the function in your module_core, you need to actually run character generation.

Under EVENT_TYPE_MODULE_START, add these lines:

Export and Test

Make sure you save each file along the way, and compile all scripts once finished. Export the scripts and play your module. You should begin character generation at the appropriate level.

See Also