Dragon Age: Origins

File information

Last updated

Original upload

Created by

Phaenan

Virus scan

Safe to use

Tags for this mod

About this mod

Allows modders to add craftskills in their addon or module through the provided script framework. Entirely and easily customizable by editing the included 2DA tables.

Permissions and credits
Original Description here:

This should be working properly, but I didn't test it intensively so you may very well run into some issues here and there. I'll be here to patch things up if the need arises, so don't worry too much about it and just let me know if you have any problems.


Important :
This code does _not_ enable you to benefit from the native craft GUI. It is (probably) possible to tweak the scaleform movies to use that GUI, but it certainly can't be done automatically through scripts.


Import Instructions :
1. Download DACrafting - Framework.zip and extract it.
2. Keep the phae_dacrafting.xls safe, you'll need to understand what's what. Plus, it'll be easier to use those worksheets as a base instead of usign the GDA...
3. In the toolset select Tools > Builder > Builder To Builder Load
4. Select DACrafting - Framework.dadbdata from the folder you extracted it to.
5. Make sure both resources have the Import box checked. If you're importing into your own module you'll want to create new strid instead of using the default ones.
6. Click Ok.
7. Find the stuff in your palette under \Phaenan\DACrafting


Use instructions :
Simply play with the 2DA. The abilities "spellscript" field must refer to a script calling the Phae_craft_HandleEvent() routine. Have a look at the default phae_dacrafting_init script if need be. Actually, you can pretty much use this script for all your abilities, no matter how many craftskills you defined in the 2DA tables.


Changing the floaty messages :
By default, the library will use the example package strref to print necessary floaty messages. Of course, it won't fit in your module since those strref depends on the example package talktable, which means you'll have to change those strref with your own. 
Here are the references :
872251135 = "Invalid target."
872251136 = "Plot condition not met."
872251137 = "Reagents mismatch."
872251138= "No such recipe."
872251139= "Crafted : "


Characters stage :
If your using the framework in a standalone campaign, you'll have to make sure the char_stage is properly defined. If you don't know what I mean, you prolly don't need to do anything. Otherwise you'll have to replace the "char_stage" tag by your own in the getCharStage() routine. (line 466 in phae_dacrafting_h)


Notice :
Except for what I just said about strrefs and char_stage, avoid touching at phae_dacrafting_h unless you understand what you're doing. Although you may want to modify the routines to tailor the framework to your needs, you do not need to if you don't want to.


╔════════════╗
║      License & yada
╠════════════╝

║ If I had a mind for such things, I suppose I'd place the framework under the GNU
║ LGPL so you're free to use it and modify it any way you like. Still, try to keep the 
║ library credits header. Letting me know you're using that framework in your mods
║ is a nice bonus : I'd feel fuzzy inside knowing I didn't work for nothing. :o
║ 
║ 
║ This framework shall not be added to the "Open House" content index.
║ 
╚═══════════════════▐


Preserved Data and Information: 

Documentation /Example Package
Spoiler:  
Show

When designing the three example craftskills included in the example package, I tried to cover the different approaches you may want to follow when using the framework in your module. However, since you probably can't read minds, I'll explain a bit what to expect from each one of those skill. Hopefully it'll help you find out which example you'll have to dissect.

.



First and foremost, the example package doesn't include a module core script. Basically it means it won't automatically initialize itself once the dazip is installed.
To activate the example craftskills, open the devconsole once ingame and type :
runscript phae_dacrafting_debug init


Doing so will give the abilities to the currently controlled character, and will also grant you a stack of every reagents required to test the recipes.

.



This craftskill use a pre-existent placeable. Since it's a type 1 skill, a key reagent must be specific to every recipe. In this example I used molds for that purpose, believing it demonstrates the concept quite well. One type of mold, one precise item created ; that kind of logic won't ruffle your players feather. I think. Maybe. Oh well, you'll see anyway...

Aside from that, it's pretty much straighfoward. I'd say that the easiest example to study at first.

.



In this example, several abilities are required : one per recipe. You may want to consider another craftskill type if you'll be creating douzens of recipes, as the players talents/spells frame will be clunky quite fast.
Note that if you're using spells or talents, those abilities won't be avaible to some classes ; obviously spell abilities only show on Mages ability frame, while talent abilities will only be visible on Warriors and Rogues. However, it's possible to double every recipe and create two versions of the ability / recipe binomes : mages, and non-mages. That's just more work for you, but shouldn't be noticed by players.

.



This last example may be of interest since it's not activated via a talent, spell or skill, but by using a quickitem placed in the inventory. Moreover, it doesn't use a pre-existent placeable so basically the players won't get the impression they are using a container. They'll activate the quickitem, see a frame asking for the reags, and the results of the crafting attempt will be show as soon as that frame is closed.
Because it's a type 3 craftskill, you're completely free when deciding the recipes reagents ; however you have to make sure two different recipes does not share the exact same reagents assortment. If that was to happen, the recipe with the lowest ID would be the only one to be ever used by the scripts.

Note that even if I didn't do it in any of these examples, you can define VFX and / or animation for your abilities ; have a look at the ABI_base documentation if that wasn't already clear to you.



Documention The 2DA Tables
Spoiler:  
Show

While the framework can be used without touching any script, a good understanding of how the 2DA tables intertwine is crucial. For that reason, the source package includes the Excel files used to generate the example tables. Those files are commented through notes and explanation rows, but those comments are DACrafting specific and do not describe the structure of vanilla tables. Meaning that people having a poor understanding of the vanilla 2DA_base or ABI_base should first have a look at the relevant Toolset wiki pages :
Generic 2DA introduction
2DA_base
ABI_base
Guitypes


.



There is no need to alter this table, however as said before it's crucial to understand how it works. Basically, the entries defined here combine together the 2DA sheets sharing the same prefix. For instance, in the examples package the twophae_dacft_reags* tables are fused in one single M2DA table, meaning the ID values shouldn't collide.




.



This M2DA table holds the details of every craftskill added via the DACrafting framework. Since it's merged, you'll want to use an unique suffix and make sure the ID you're using don't collide with those of anyone else using the framework as well.
The obvious being said, let's have a look at that table structure.




The table prefix will be used by the scripts to access the tables specific to that craftskill. Therefore it'd better be unique.

The logic column defines how the scripts will be identifying recipes :
  • Type 1 :
    Each recipe must use a specific reagent, defined on the recipes table via the CondItemTag field.
  • Type 2 :
    The recipes are identified by the ability used to trigger the craftskill. Think NwN2 here : players had to cast a precise spell on the crafting container to use the right recipe. The ability are linked to recipes via the CondAbilityID field on the recipes table.
  • Type 3 :
    The recipe will simply be guessed using the exact reagents assortment found in the container, by checking the reagents list against the recipes table reagents columns.

The AbilityID field is necessary for type 1 and 3 craftskills. It defines which ability is authorized to trigger the craftskill ; this ID obviously have to match the relevant ABI_base entry.
Type 2 craftskills do not need this field since they are not triggered by a single ability but through a series of recipe-specific abilities defined in the phae_dacft_rcpabi table.

Finally the placeable define which placeable will be holding the reagents. You can use the tag of an existing placeable, or leave that field to "auto". When a craftskill is set to "auto", the scripts simply create a temporary invisible placeable.
Important :
The abilities triggering the craftskill have to be able to target the placeable. When set to "auto", the abilities have to be able to target the controlled character (targettype=1) otherwise the ability must be able to target the specified placeable.(targettype=8)

.



This M2DA table holds the information about the type 2 craftskills. More exactly it does reference the recipe-specific abilities and link those to the relevant craftskill.




This is once again a merged table, so unique IDs are crucial. However, since the IDs here are actually keyed from the ABI_base abilities ID, there is not much to worry about ; you wouldn't want your ABI_base entries to collides with other people's anyway.

Here, the CraftskillID must be a valid craftskill ID defined in the phae_dacft_skills table.

.



You will have to create one 2DA recipe table per craftskill. Those tables won't be merged and the ID used in there do not need to be unique to your craftskill or module ; they don't have to be consecutive either, you're pretty free.
This table holds all the information related to a craftskill recipes : the conditions, the reagents to expect, and what to create. Let's have look at the structure :




That's a mouthfull, yep, but I'd like to think it's pretty logical and easy to understand.

The CondItemTag column concerns type 1 craftskills ; type 2 & 3 will have empty fields here. For type 1 craftskills you must define the key reagent by putting its tag here ; by key reagent, understand a reagent this recipe will be the only one to use in that entire craftskill. It can be a recipe scroll, a mold, whatever idea you can come with. However, there are two restrictions :
- The player must be able to place that reagent in the container. Meaning no plot items.
- The player must be able to place only 1 unit of this reagent. If it's a stackable item, you'll want to add it to thephae_dacft_reags table.
You mustn't add that key reagent to the recipe reagent list (the Reagent1, Reagent2 (...) fields) as it'll be automatically done.

Likewise, the CondAbilityID is the column defining the key ability used in type 2 craftskills, and will be empty for type 1 & 3 craftskills. Each of this abilities have to be unique to a single recipe, and must be able to target the placeable defined in thephae_dacft_skills M2DA table.

The OptPlotUID and OptPlotFlag fields can be used to restrict a recipe to pretty much any condition you can imagine ; the flag can be either a main flag or a defined flag. For instance, in the recipe excerpt below - the Dalish arrow from the example craftskills - the script will automatically check the defined flag 256 of the plot having the UID4EB13E46F6FF497A853165A0B0C2718B : 

Basically, that defined flag restrict that recipe to Dalish characters. Neat, huh.

Obviously, the ResultRes and ResultStack define the number and kind of item to create when the crafting attempt is a success.
As for the five ReagentX and ReagentXCount columns sets, they are used to set the reagents list required for each recipe. Note that recipes must have at least one reagent - key reagent not included - and that the players will have to place the exact quantities you define here. Hopefully, you'll find in the framework a placeable core script making stacks splitting easy as pie. (cf. example package)

.



Speaking of which : in order to have the container automatically split reagent stacks, and believe me you want that to work, you need to expand the phae_dacft_reags M2DA table. That table holds the information needed to split the stacks of every Origins & Awakening reagents, however it doesn't include gems or - obviously - your own custom reagents.
So, you'll have to create a new phae_dacft_reags_youruid table to define those reagents. Hopefully, that's as easy as easy can get :




Enter the reagent tag in ReagentTag, push the resource in ReagentRes, and that's it... Just make sure the IDs doesn't collide with other DACrafting using addons since that's a M2DA.




Website | NexusMods Forum