Adding a new spell tutorial

From Dragon Age Toolset Wiki
Jump to: navigation, search

This tutorial steps you through making a new spell called Full Heal. This will be a simple copy of the heal spell with a modification to the amount healed. The focus here is on creating a new spell, but the basic steps are the same for talents and other abilities.


The process of adding a spell to the game is as follows:

  • Create a new module that extends the single player game
  • Create a new guitype that your spell exists under
  • Create a new ability entry for your spell
  • Create a custom script to handle your spell
  • Create strings to describe your spell in the talent page and tool tips
  • Testing it in the game

Before beginning ensure you read the article on editing 2DA files and how to convert them to GDA files for use in the game.

Creating your module

These are just some basic settings required so that your module extends the Single Player campaign.

  1. Load the toolset and select File > Manage Modules
  2. Click on New and fill in the following fields:
    1. Name: Full Heal
    2. Script: (none) (Click on the ... button and select (none))
    3. UID: full_heal
    4. Extended Module: Single Player
  3. Click Open to load your new module (it should be selected by default)
  4. Select Tools > Export > Generate Module XML

You now have a new module that will be loaded whenever you play the Single Player campaign.

Creating a new Spell Type

This step is not strictly necessary to get a new spell into the game, but is recommended. By doing this, your new spell will have its own category on the talents page. This is also how you can restrict which classes have access to the spell.

For more information on the columns we are modifying refer to the article on Guitypes.xls.

  1. Open up your 2DA folder, it should be at \Dragon Age\tools\Source\2DA
  2. Copy the file guitypes.xls to a new folder, for example C:\2DA
  3. Open the file and delete all the rows except the headings
  4. Create a new row with the following details:
    1. ID: 777
    2. Label: Divine Healer
    3. StringID: **** (we will replace this later with the proper string ID)
    4. TintColor: 0x888888 (I think this only matters if you are using the progress bar)
    5. BlendTree: ****
    6. Any remaining columns in between set to 0
  5. Save and close the file.
  6. Convert it to a GDA file
    1. To convert from XLS to GDA, there is an application called ExcelProcessor, which can be found in your installed Dragon Age directory - Dragon Age\tools\ResourceBuild\Processors. Just drag the XLS file onto the ExcelProcessor and it automatically converts it. See Compiling 2DAs for more detail.
  7. Copy the GDA to your module override folder (My Documents\Bioware\Dragon Age\AddIns\full_heal\module\override)
  8. Rename the file guitypes_fh.GDA

Creating a new ability entry

This is where you can specify the properties of your new spell. However for this example I'm just keeping it simple. I recommend reading this page to see what can be done: ABI_base.xls

  1. Open up the rules folder in your 2DA folder, it should be at \Dragon Age\tools\Source\2DA\rules
  2. Copy ABI_Base.xls to your 2DA folder
  3. Open the file and find the entry for HEAL
  4. Copy the whole row to the bottom of the file
  5. Delete the rest of the rows except for the headings
  6. Cut your row and paste it as the first row
  7. Make the following changes to your HEAL row
    1. ID: 777777
    2. label: FULL HEAL
    3. guitype: 777
  8. Save and close the file
  9. Convert it to a GDA file (For instructions see Compiling 2DAs)
  10. Copy the ABI_Base.GDA file to your module override folder (My Documents\Bioware\Dragon Age\AddIns\full_heal\module\override)
  11. Rename the file ABI_Base_fh.GDA

Preliminary Testing

At this stage we want to ensure that the above steps worked, and that the new spell appears in-game. Simply run the game and check the talents page for a mage character. Your spell should appear in its own category down the bottom. If it doesn't try the following:

  • Check that the guitype for your ability in the ABI_base 2DA is the same as the id you set for your guitype in the guitypes 2DA
  • Check that your GDA files are copied to the correct override folder
  • Generate your module XML file again

Creating a custom spell script

The easiest way to do this is generally open the script that the spell you are copying references, copy it to a new file and modify the contents to suit your purposes. Spell scripting is a little beyond the scope of this tutorial so I've prepared a simple script already. What it does is calculate the maximum health of the target of the spell and then heal them for that amount.

  1. Select File > New > Script
  2. Set the following properties
    1. Resource Name: full_heal
    2. Folder: \
  3. Click OK to create the script
  4. Copy the contents of the script below into the script and click Save

The script should compile correctly if you check the log.

// -----------------------------------------------------------------------------
// full_heal.nss
// -----------------------------------------------------------------------------
#include "log_h"
#include "abi_templates"
#include "sys_traps_h"
#include "spell_constants_h"
const int FULL_HEAL = 777777;
void _HandleImpact(struct EventSpellScriptImpactStruct stEvent)
    effect eEffect;
    //int bHostile = FALSE;
    // make sure there is a location, just in case
    if (IsObjectValid(stEvent.oTarget) == TRUE)
        stEvent.lTarget = GetLocation(stEvent.oTarget);
    // -------------------------------------------------------------------------
    // Handle Spells
    // -------------------------------------------------------------------------
    switch (stEvent.nAbility)
        case FULL_HEAL:
            float fHeal = GetCreatureProperty(stEvent.oTarget,7,PROPERTY_VALUE_TOTAL);
            eEffect = EffectHeal(fHeal);
            eEffect = SetEffectEngineInteger(eEffect, EFFECT_INTEGER_VFX, Ability_GetImpactObjectVfxId(stEvent.nAbility));
            ApplyEffectOnObject(EFFECT_DURATION_TYPE_INSTANT, eEffect, stEvent.oTarget, 0.0f, stEvent.oCaster, stEvent.nAbility);
   // if(bHostile) // sending only for hostile spells
        //SendEventOnCastAt(stEvent.oTarget, stEvent.oCaster, stEvent.nAbility, bHostile);
void main()
    event ev = GetCurrentEvent();
    int nEventType = GetEventType(ev);
            // Get a structure with the event parameters
            struct EventSpellScriptCastStruct stEvent = Events_GetEventSpellScriptCastParameters(ev);
            // Hand this through to cast_impact
            SetAbilityResult(stEvent.oCaster, stEvent.nResistanceCheckResult);
            // Get a structure with the event parameters
            struct EventSpellScriptImpactStruct stEvent = Events_GetEventSpellScriptImpactParameters(ev);
            Log_Trace(LOG_CHANNEL_COMBAT_ABILITY, GetCurrentScriptName() + ".EVENT_TYPE_SPELLSCRIPT_IMPACT",Log_GetAbilityNameById(stEvent.nAbility));
            // Handle impact
            if (CheckSpellResistance(stEvent.oTarget, stEvent.oCaster, stEvent.nAbility) == FALSE)
            } else
                UI_DisplayMessage(stEvent.oTarget, UI_MESSAGE_RESISTED);

Creating new Strings

This step allows you to set your own description for the spell and have it appear correctly in tool tips.

  1. Ensure your module is loaded in the toolset
  2. Select Tools > String Editor
  3. Right click in the empty space and select Insert > Insert String
  4. Set the Type to Spells
  5. Set the text to Divine Healer
  6. Click OK to save the string
  7. Make a note of the string ID generated and what it is for (in this case the Spell Type)
  8. Repeat the above steps for the following text (without the information in brackets):
Full Heal (note it down as the spell name)
The mage channels divine energy to completely heal the target from all battle damage. (note it down as the description)

The last string is for the tool tip, copy and paste the text below.

<name/> (<guitypename/>)
Range: <range/>
Activation: <cost/>
Cooldown: <cooldown/>s



Once these strings are all created select Tools > Export > Export Talk Table. This will compile your strings into a talk table which can be used with the game.

Updating your ability

This step involves tweaking our new spell to use the strings we created as well as the custom script. We will also adjust the cost and cooldown to make it a bit more balanced.

For the following steps I recommend using GDApp to modify your GDA files rather than editing the excel files and recreating them. It can be found on the 3rd_party_extensions page.

  1. Open your ABI_base_fh.GDA file with GDApp
  2. Set the namestrref field to the string ID for your spell name
  3. Set the descstrref field to the string ID for your spell description
  4. Set the tooltipstrref field to the string ID for your spell tooltip
  5. Set the cost to 50
  6. Set the spellscript to full_heal.ncs
  7. Set the cooldown to 20
  8. Save the file

Next we modify the guitype:

  1. Open your guitypes_fh.GDA file with GDApp
  2. Set the stringid field to the string ID for your Spell Type
  3. Save the file

Now we have updated GDA files which reference our spell script and new strings. It should now function correctly in the game and look like any other spell.

Testing your new spell

Your new spell should be working and properly labeled in the game. You can select it when leveling up, or you can use a debug script to add your spell manually.

With the developer console enabled, have your mage character selected and type the following:

` runscript addtalent 777777

Advanced Topics

I will try and expand this section a bit later, but for now once you are confident with these steps, try the following:

  • Change the icon for the spell to make it stand out more. You can use one from another spell or make your own
  • Change the different values in ABI_base to alter the spell further
  • Create a new talent using the same procedure but copy and modify a talent instead of a spell
  • Set the ability field of the guitypes.xls to ensure your new ability type is only available to certain classes. This is how the specialization classes limit their abilities.

See Also