Modifying a spell
From Nexus Wiki
The purpose of this tutorial is to illustrate how to modify the spell Fireball. Much of the logic that defines spell properties is done in code instead of 2da files, we will be opening up some scripts, and modifying the damage value of fireball. (Not all spell properties are in code, there are still some that are handeled by 2da's)
This will be a brief tutorial on how to alter the damage of Fireball in your Dragon Age OC (Original Campaign).
Setup Altering the damage of spells and talents in Dragon Age is not done through the 2da files, even though it would have been more convenient to do so. I suspect it was done this way for performance reasons. Moving along, open up the toolset. It's a safe bet you have either the Single Player 'module environment' open, or your own custom made one It shouldn't matter which one we use, but to avoid any potential issues use a custom module you already made, or follow along to make a new one Under File -> Manage Modules, you are going to want to select new. In this example we need to set the [Name] field and the [UID] field. Name is obviously the displayed name of the module. UID represents the name of the folder created by the toolset on your HDD under this location: For XP: \MyDocs\BioWare\Dragon Age\AddIns\ [UID] \
You should be able to use any module, but I will assume a blank one. On the right, find the Scripts under the Palette Window. We will using [spell_constants_h], which contains the values that correspond to the raw potency of the spells. We will also be using [spell_aoe_instant], as the _h suffix signifies what is called a Header file. While we will do our edit in the constants file, it will not be complied directly.
Before you dive in, you should understand how the toolset manages data. The scripts we are looking at in the palette list are actually the same scripts your game is using when you are playing. Making hasty changes, especially without backups, can trash your game. This is where the data structure comes in. If you open [spell_constants_h], you will see a Read Only Copy at the top in red. This is because this resource is not 'checked out' of the database. Checking out a 'resource', like this script, gives us full edit permissions. This is a core game resource, and editing it would be bad; Instead, we want to right click, and Open Local Copy. This is a copy that you can edit, without your changes reflecting on the original.
Open a Local Copy of [spell_constants_h]. You will see a yellow bar if done properly. Scroll down to the spells you desire, in our case primal. It's in the middle, and we are looking for:
const float FIREBALL_DAMAGE_FACTOR = 0.3f;
I want a really beefy fireball, so lets ramp it up, 10x the damage. We should have something like this:
const float FIREBALL_DAMAGE_FACTOR = 3.0f;
This is the main method used to alter the damage between spells as they all follow a basic function that allows for easier power scaling. Should one desire to see this, it is found in [spell_aoe_instant] for our spell of choice. Open a local copy of this now since we need it later. This file is more detailed, but you can look for or search for:
Since all we are going to do is make our fireball stronger, we will not be changing anything in this file. If you want to make changes to other spells at the same time, the only thing to remember is you have to also open the file with said spell's functions. While Fireball is in the [spell_aoe_instant] file, Cone of Cold is in [spell_cone]. The header file is compiled when a file that 'includes' this file is compiled, thus why we need the files we are not altering. We have made the changes we want, and we have [spell_constants_h] and spell_aoe_instant] open. You did open them locally right? (Yellow Bar)
Now, I saved my scripts, unsaved ones have a * by the name, though I am not sure it is needed (the _h file will throw an error when you save it, ignore it). Select the[spell_aoe_instant] file and click Compile Script. If done correctly it should say stuff like "Compile Successful".
That is it for the toolset part. Navigate to:
You will find probably something like 84 files, don't be alarmed. Those are all files that were 'linked' to the ones we compiled. If your tool- set has not been fiddled with, they will all be the same as the current game ones. Regardless, we only need these two files:
You can delete the rest (there was 84 total, 82 I deleted). Note the extensions, there will likely be two versions of the ones we compiled. Both of these files need to be here, even though we did not alter the aoe one, for reasons outside the scope of this post.
This is essentially it, you can open your game, and drop a fireball on your party and laugh. The 'module' we just made will show up in the 'Downloadable content' menu. Since our mod was blank this is no issue, but you might want to remove our 'test bed' from that menu. This is as simple as navigating to:
There you can delete the folder that has the name of the [UID] we made earlier. This can remove potential resources like Level files, both raw and exported, so make sure you know what you are doing. This will not, however, remove it from the Toolset. The toolset will re-create that folder if the module is selected/loaded. It will not replace the lost files, but rather it retains 'designer resources' which are 'virtual' assets stored in the database, like placeables. Our spell mod does not require the 'module' to be active to function, if you feel queasy about deleting things, you can just disable it. This is more for modules you are working on that do have real resources, but are still in early testing phases. Our mod is completley independent of the 'module' system since we are directly overriding the spell scripts. This will cause issues with multiple mods trying to achieve the same effect. There appear to be potential workarounds, but they are far beyond the scope covered in this post.
This tutorial was created by me, it can be used whereever so long as you refer to where you got it, or link to it. Thanks.