<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.datoolset.net/mw/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=TrueKeaton</id>
		<title>Dragon Age Toolset Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://www.datoolset.net/mw/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=TrueKeaton"/>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/wiki/Special:Contributions/TrueKeaton"/>
		<updated>2026-04-22T02:21:44Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.25.6</generator>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Cutscene_effect&amp;diff=12961</id>
		<title>Cutscene effect</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Cutscene_effect&amp;diff=12961"/>
				<updated>2010-05-25T16:23:31Z</updated>
		
		<summary type="html">&lt;p&gt;TrueKeaton: /* Sepia Fade */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox cutscenes}}&lt;br /&gt;
&lt;br /&gt;
[[Cutscene]] effects can be applied either to the MASTER object (in which case they apply to all cameras in the cutscene simultaneously) or to individual cameras.&lt;br /&gt;
&lt;br /&gt;
*Fade In/Fade Out&lt;br /&gt;
*da_bloom&lt;br /&gt;
*da_blurdesaturate&lt;br /&gt;
*da_bssrdf&lt;br /&gt;
*da_bssrdf_shared&lt;br /&gt;
*da_cleartogreen&lt;br /&gt;
*da_colorfade&lt;br /&gt;
*da_copybackbuffer&lt;br /&gt;
*da_depth&lt;br /&gt;
*da_distortion&lt;br /&gt;
*da_dof&lt;br /&gt;
*da_fade&lt;br /&gt;
*da_hsvmatrix&lt;br /&gt;
*da_motionblur&lt;br /&gt;
*da_sepiafade&lt;br /&gt;
&lt;br /&gt;
== Fade In/Fade Out ==&lt;br /&gt;
&lt;br /&gt;
This effect is only available for the MASTER object. Over the course of the event the screen will either fade in or out from a solid color, depending on the effect's type. The state of the view (faded in or faded out) will persist after the event, the event's duration only determines how rapidly the fade occurs.&lt;br /&gt;
&lt;br /&gt;
{{inspector start}}&lt;br /&gt;
{{inspector section|General}}&lt;br /&gt;
{{inspector row|End Time| The time that the action ends }}&lt;br /&gt;
{{inspector row|Infinite| If true this action extends on forever. It never ends. }}&lt;br /&gt;
{{inspector row|Start Time| The time that the action begins }}&lt;br /&gt;
&lt;br /&gt;
{{inspector section|Fade}}&lt;br /&gt;
{{inspector row|Fade Color| The color to fade in or out to. }}&lt;br /&gt;
{{inspector row|Fade Type| Whether this is a fade in or a fade out. }}&lt;br /&gt;
{{inspector end}}&lt;br /&gt;
&lt;br /&gt;
== Bloom ==&lt;br /&gt;
&lt;br /&gt;
Causes bright areas of the image to &amp;quot;bleed&amp;quot; over into adjacent dark areas, and to oversaturate the camera.&lt;br /&gt;
&lt;br /&gt;
The [[curve editor]] can be used to set the following parameters:&lt;br /&gt;
&lt;br /&gt;
*Brightness&lt;br /&gt;
*Contrast&lt;br /&gt;
*Glow intensity&lt;br /&gt;
*Horizontal blur width&lt;br /&gt;
*Vertical blur width&lt;br /&gt;
&lt;br /&gt;
{{inspector start}}&lt;br /&gt;
{{inspector section|General}}&lt;br /&gt;
{{inspector row|End Time| The time that the action ends }}&lt;br /&gt;
{{inspector row|Infinite| If true this action extends on forever. It never ends. }}&lt;br /&gt;
{{inspector row|Start Time| The time that the action begins }}&lt;br /&gt;
&lt;br /&gt;
{{inspector section|Effect}}&lt;br /&gt;
{{inspector row|Brightness|  }}&lt;br /&gt;
{{inspector row|Contrast|  }}&lt;br /&gt;
{{inspector row|GlowIntensity|  }}&lt;br /&gt;
{{inspector row|HBlurWidth| Distance that the bloom's bleed-over extends in the horizontal direction. }}&lt;br /&gt;
{{inspector row|VBlurWidth| Distance that the bloom's bleed-over extends in the vertical direction. }}&lt;br /&gt;
{{inspector end}}&lt;br /&gt;
&lt;br /&gt;
== Blur desaturate ==&lt;br /&gt;
&lt;br /&gt;
The [[curve editor]] can be used with the following properties:&lt;br /&gt;
&lt;br /&gt;
*Brightness&lt;br /&gt;
*Contrast&lt;br /&gt;
*hblurwidth&lt;br /&gt;
*hue&lt;br /&gt;
*saturation&lt;br /&gt;
*vblurwidth&lt;br /&gt;
&lt;br /&gt;
{{inspector start}}&lt;br /&gt;
{{inspector section|General}}&lt;br /&gt;
{{inspector row|End Time| The time that the action ends }}&lt;br /&gt;
{{inspector row|Infinite| If true this action extends on forever. It never ends. }}&lt;br /&gt;
{{inspector row|Start Time| The time that the action begins }}&lt;br /&gt;
&lt;br /&gt;
{{inspector section|Effect}}&lt;br /&gt;
{{inspector row|Brightness|}}&lt;br /&gt;
{{inspector row|Contrast|}}&lt;br /&gt;
{{inspector row|FadeDirection|}}&lt;br /&gt;
{{inspector row|FadeOutStart|}}&lt;br /&gt;
{{inspector row|HBlurWidth|}}&lt;br /&gt;
{{inspector row|Hue|}}&lt;br /&gt;
{{inspector row|Saturation|}}&lt;br /&gt;
{{inspector row|TimeToFade|}}&lt;br /&gt;
{{inspector row|VBlurWidth|}}&lt;br /&gt;
{{inspector end}}&lt;br /&gt;
&lt;br /&gt;
== BSSRDF ==&lt;br /&gt;
&lt;br /&gt;
{{inspector start}}&lt;br /&gt;
{{inspector section|General}}&lt;br /&gt;
{{inspector row|End Time| The time that the action ends }}&lt;br /&gt;
{{inspector row|Infinite| If true this action extends on forever. It never ends. }}&lt;br /&gt;
{{inspector row|Start Time| The time that the action begins }}&lt;br /&gt;
{{inspector end}}&lt;br /&gt;
&lt;br /&gt;
== BSSRDF Shared ==&lt;br /&gt;
&lt;br /&gt;
{{inspector start}}&lt;br /&gt;
{{inspector section|General}}&lt;br /&gt;
{{inspector row|End Time| The time that the action ends }}&lt;br /&gt;
{{inspector row|Infinite| If true this action extends on forever. It never ends. }}&lt;br /&gt;
{{inspector row|Start Time| The time that the action begins }}&lt;br /&gt;
{{inspector end}}&lt;br /&gt;
&lt;br /&gt;
== Clear to Green ==&lt;br /&gt;
&lt;br /&gt;
{{inspector start}}&lt;br /&gt;
{{inspector section|General}}&lt;br /&gt;
{{inspector row|End Time| The time that the action ends }}&lt;br /&gt;
{{inspector row|Infinite| If true this action extends on forever. It never ends. }}&lt;br /&gt;
{{inspector row|Start Time| The time that the action begins }}&lt;br /&gt;
{{inspector end}}&lt;br /&gt;
&lt;br /&gt;
== Color Fade ==&lt;br /&gt;
&lt;br /&gt;
A more fine-tunable variant on the &amp;quot;Fade to black&amp;quot; effect, color fade allows you to set the beginning and end colors and transparency of the fade as well as how long it takes for the fade to happen. By making the fade take longer than the duration of the effect you can get a partial fade.&lt;br /&gt;
&lt;br /&gt;
{{inspector start}}&lt;br /&gt;
{{inspector section|General}}&lt;br /&gt;
{{inspector row|End Time| The time that the action ends }}&lt;br /&gt;
{{inspector row|Infinite| If true this action extends on forever. It never ends. }}&lt;br /&gt;
{{inspector row|Start Time| The time that the action begins }}&lt;br /&gt;
&lt;br /&gt;
{{inspector section|Effect}}&lt;br /&gt;
{{inspector row|EndColourAlpha| Transparency of the end color at TimeToFade seconds. }}&lt;br /&gt;
{{inspector row|EndColourBlue| Blueness of the end color at TimeToFade seconds. }}&lt;br /&gt;
{{inspector row|EndColourGreen| Greenness of the end color at TimeToFade seconds. }}&lt;br /&gt;
{{inspector row|EndColourRed| Redness of the end color at TimeToFade seconds. }}&lt;br /&gt;
{{inspector row|StartColourAlpha| Transparency of the color at the beginning of the fade (set to 0 to start out completely transparent) }}&lt;br /&gt;
{{inspector row|StartColourBlue| Blueness of the color at the beginning of the fade. }}&lt;br /&gt;
{{inspector row|StartColourGreen| Greenness of the color at the beginning of the fade. }}&lt;br /&gt;
{{inspector row|StartColourRed| Redness of the color at the beginning of the fade. }}&lt;br /&gt;
{{inspector row|TimeToFade| Time it takes for the fade to transition from the start color and transparency to the end color and transparency. Doesn't necessarily have to be the same as the duration of the effect - if it's longer the effect will only fade partway before ending, if it's shorter the fade will remain at the end color for the remaining duration of the effect.}}&lt;br /&gt;
{{inspector end}}&lt;br /&gt;
&lt;br /&gt;
== Copy Back Buffer ==&lt;br /&gt;
&lt;br /&gt;
{{inspector start}}&lt;br /&gt;
{{inspector section|General}}&lt;br /&gt;
{{inspector row|End Time| The time that the action ends }}&lt;br /&gt;
{{inspector row|Infinite| If true this action extends on forever. It never ends. }}&lt;br /&gt;
{{inspector row|Start Time| The time that the action begins }}&lt;br /&gt;
{{inspector end}}&lt;br /&gt;
&lt;br /&gt;
== Distortion ==&lt;br /&gt;
&lt;br /&gt;
{{inspector start}}&lt;br /&gt;
{{inspector section|General}}&lt;br /&gt;
{{inspector row|End Time| The time that the action ends }}&lt;br /&gt;
{{inspector row|Infinite| If true this action extends on forever. It never ends. }}&lt;br /&gt;
{{inspector row|Start Time| The time that the action begins }}&lt;br /&gt;
{{inspector end}}&lt;br /&gt;
&lt;br /&gt;
== Depth ==&lt;br /&gt;
&lt;br /&gt;
{{inspector start}}&lt;br /&gt;
{{inspector section|General}}&lt;br /&gt;
{{inspector row|End Time| The time that the action ends }}&lt;br /&gt;
{{inspector row|Infinite| If true this action extends on forever. It never ends. }}&lt;br /&gt;
{{inspector row|Start Time| The time that the action begins }}&lt;br /&gt;
{{inspector end}}&lt;br /&gt;
&lt;br /&gt;
== Depth of Field (DOF) ==&lt;br /&gt;
&lt;br /&gt;
Sets the camera's focus on near/far objects. By default all objects are in focus regardless of how far away they are, but a real-world camera has a limited ability to focus on objects of differing ranges.&lt;br /&gt;
&lt;br /&gt;
The [[curve editor]] can be used to set the following properties:&lt;br /&gt;
&lt;br /&gt;
*Far fade&lt;br /&gt;
*Focal radius&lt;br /&gt;
*Focus distance&lt;br /&gt;
*Max blur&lt;br /&gt;
*Near fade&lt;br /&gt;
*Weight blur&lt;br /&gt;
&lt;br /&gt;
{{inspector start}}&lt;br /&gt;
{{inspector section|General}}&lt;br /&gt;
{{inspector row|End Time| The time that the action ends }}&lt;br /&gt;
{{inspector row|Infinite| If true this action extends on forever. It never ends. }}&lt;br /&gt;
{{inspector row|Start Time| The time that the action begins }}&lt;br /&gt;
&lt;br /&gt;
{{inspector section|Effect}}&lt;br /&gt;
{{inspector row|FarFade| Distance over which focus is lost in the direction away from the camera.}}&lt;br /&gt;
{{inspector row|FocalRadius| The range over which the camera's focus is sharp, in meters. }}&lt;br /&gt;
{{inspector row|FocalDistance| The center of the range over which the camera's focus is sharp. Objects that are FocalDistance meters away &amp;amp;plusmn; FocalRadius will be in sharp focus. }}&lt;br /&gt;
{{inspector row|MaxBlur|  }}&lt;br /&gt;
{{inspector row|NearFade| Distance over which focus is lost in the direction toward the camera. }}&lt;br /&gt;
{{inspector row|RenderBlurRadius|  }}&lt;br /&gt;
{{inspector row|WeightBlur| The strength of the blurring effect used on out-of-focus parts of the view. }}&lt;br /&gt;
{{inspector end}}&lt;br /&gt;
&lt;br /&gt;
== Fade ==&lt;br /&gt;
&lt;br /&gt;
The [[curve editor]] can be used with the following properties:&lt;br /&gt;
*BlurStrength&lt;br /&gt;
&lt;br /&gt;
{{inspector start}}&lt;br /&gt;
{{inspector section|General}}&lt;br /&gt;
{{inspector row|End Time| The time that the action ends }}&lt;br /&gt;
{{inspector row|Infinite| If true this action extends on forever. It never ends. }}&lt;br /&gt;
{{inspector row|Start Time| The time that the action begins }}&lt;br /&gt;
&lt;br /&gt;
{{inspector section|Effect}}&lt;br /&gt;
{{inspector row|BlurStrength|}}&lt;br /&gt;
{{inspector end}}&lt;br /&gt;
&lt;br /&gt;
== HSV Matrix ==&lt;br /&gt;
&lt;br /&gt;
Allows adjustment of the brightness, contrast, hue and saturation of the view.&lt;br /&gt;
&lt;br /&gt;
The [[curve editor]] can be used to set the following properties:&lt;br /&gt;
&lt;br /&gt;
*Brightness&lt;br /&gt;
*Contrast&lt;br /&gt;
*Hue&lt;br /&gt;
*Saturation&lt;br /&gt;
&lt;br /&gt;
{{inspector start}}&lt;br /&gt;
{{inspector section|General}}&lt;br /&gt;
{{inspector row|End Time| The time that the action ends }}&lt;br /&gt;
{{inspector row|Infinite| If true this action extends on forever. It never ends. }}&lt;br /&gt;
{{inspector row|Start Time| The time that the action begins }}&lt;br /&gt;
&lt;br /&gt;
{{inspector section|Effect}}&lt;br /&gt;
{{inspector row|Brightness| Brightness multiplier }}&lt;br /&gt;
{{inspector row|Contrast|  }}&lt;br /&gt;
{{inspector row|Hue|  }}&lt;br /&gt;
{{inspector row|Saturation| Color intensity multiplier. 0 makes the view grayscale.  Values between 0 and 1 make the colors muted, values greater than one make the colors unnaturally vibrant. }}&lt;br /&gt;
{{inspector end}}&lt;br /&gt;
&lt;br /&gt;
== Motion Blur ==&lt;br /&gt;
&lt;br /&gt;
Motion blur blends previous frames into the current frame, creating the effect of motion blur. &lt;br /&gt;
&lt;br /&gt;
The [[curve editor]] can be used to set the blend property.&lt;br /&gt;
&lt;br /&gt;
{{inspector start}}&lt;br /&gt;
{{inspector section|General}}&lt;br /&gt;
{{inspector row|End Time| The time that the action ends }}&lt;br /&gt;
{{inspector row|Infinite| If true this action extends on forever. It never ends. }}&lt;br /&gt;
{{inspector row|Start Time| The time that the action begins }}&lt;br /&gt;
&lt;br /&gt;
{{inspector section|Effect}}&lt;br /&gt;
{{inspector row|blend| A range from 0-1. Determines the strength of the blur. Note that 1 produces a nonfunctional effect. }}&lt;br /&gt;
{{inspector end}}&lt;br /&gt;
&lt;br /&gt;
== Sepia Fade ==&lt;br /&gt;
&lt;br /&gt;
Adds a sepia (brown-hued) filter to the camera. Commonly used to indicate &amp;quot;old&amp;quot; film, often for flashbacks.&lt;br /&gt;
&lt;br /&gt;
{{inspector start}}&lt;br /&gt;
{{inspector section|General}}&lt;br /&gt;
{{inspector row|End Time| The time that the action ends }}&lt;br /&gt;
{{inspector row|Infinite| If true this action extends on forever. It never ends. }}&lt;br /&gt;
{{inspector row|Start Time| The time that the action begins }}&lt;br /&gt;
&lt;br /&gt;
{{inspector section|Effect}}&lt;br /&gt;
{{inspector row|TimeToFade| Appears to have no effect }}&lt;br /&gt;
{{inspector end}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cutscenes]]&lt;/div&gt;</summary>
		<author><name>TrueKeaton</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Level_Editor_Tutorial&amp;diff=12834</id>
		<title>Level Editor Tutorial</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Level_Editor_Tutorial&amp;diff=12834"/>
				<updated>2010-04-07T16:44:13Z</updated>
		
		<summary type="html">&lt;p&gt;TrueKeaton: /* Adding lights */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Building your room (Interior Level)=&lt;br /&gt;
How to create/lightmap a [[Level]] for use in an Interior [[Area]]:&lt;br /&gt;
Objective: Following along with this tutorial, you should be able to create a simple room from scratch in 10 minutes or less&lt;br /&gt;
&lt;br /&gt;
 This was lifted from a posting by St4rdog http://social.bioware.com/forum/1/topic/8/index/150840&lt;br /&gt;
 It needs some additional formatting love, but is as good starting place for people to create usable &lt;br /&gt;
 interior levels&lt;br /&gt;
&lt;br /&gt;
File &amp;gt; New &amp;gt; Level &amp;gt; Room Level&lt;br /&gt;
&lt;br /&gt;
* Click on &amp;quot;New Area&amp;quot; in top-left list &amp;gt; Object Inspector in bottom-right &amp;gt; Layout Name &amp;gt; anything under 8 characters no spaces or special characters (*,&amp;amp;,%, etc).&lt;br /&gt;
* Click the Setup Start Point icon, then click anywhere to make a start point.&lt;br /&gt;
* Select the Area, then add the Start Point Name in the Object Inspector.  &lt;br /&gt;
*Right-click in 3D view and select Insert &amp;gt; New Room.&lt;br /&gt;
*Click Models (blue box) in the Palette in the top-right. These folders contain everything such as floor tiles, walls, etc.&lt;br /&gt;
*Enable Grid Snap with the magnet icon to make sure they line up.&lt;br /&gt;
*The &amp;quot;prp&amp;quot; folder contains things like beds/barrels to clutter your Level.&lt;br /&gt;
 Hint: Use [[DATool]] (3rd party tool downloadable at http://social.bioware.com/project/41/ )to browse &lt;br /&gt;
 through these quickly to find the floors/walls you want.&lt;br /&gt;
*Any gaps you can see between models (such as wall sections) will be visible in game. When you have time to refine the layout, you can remove most hairline gaps by setting exact X Y Z coordinates in the toolset (though sometimes 0.99 or 1.01 looks better than 1.00). Larger gaps may require the use of tileset assets such as pillars. The black box tileset (blk) can be placed outside a room to cover up any defects.&lt;br /&gt;
 Hint: If you need lots of wall sections quickly, place one at a convenient location e.g. (0,0). Copy (Ctrl-C) then Paste (Ctrl-V)&lt;br /&gt;
 as many as you need. In the Object Inspector, change the coordinates of successive sections to (0,8), (0,16) etc or drag manually &lt;br /&gt;
 if you can do that quicker.&lt;br /&gt;
&lt;br /&gt;
 Note: If you get &amp;quot;Cannot spawn models into the selected parent object&amp;quot; when trying to place a model &lt;br /&gt;
 then you don't have &amp;quot;New Room&amp;quot; selected.&lt;br /&gt;
&lt;br /&gt;
==Working with multiple rooms==&lt;br /&gt;
&lt;br /&gt;
In general it is best to define each building room as a new room in the level. This becomes important when you work on lighting. To physically connect rooms you need to slide them together to get the doors to line up, they do not line up automatically. It takes some trial and error but becomes easier with practice.&lt;br /&gt;
&lt;br /&gt;
Use the Room Properties icon to specify which rooms are connected etc.&lt;br /&gt;
&lt;br /&gt;
==Pathfinding==&lt;br /&gt;
&lt;br /&gt;
Click the Generate Pathfinding icon. Green dots indicate where the player will be allowed to walk.&lt;br /&gt;
&lt;br /&gt;
For this to work, the area properties must name a valid start point, and it needs to be bounded by walls or other obstacles.&lt;br /&gt;
&lt;br /&gt;
 Hint: you may need to place another startpoint in any room that can't be reached from the main startpoint. That would apply, for example, to&lt;br /&gt;
 rooms reached by transition doors within the area.&lt;br /&gt;
&lt;br /&gt;
==Adding lights==&lt;br /&gt;
&lt;br /&gt;
* Right-click on &amp;quot;New Room&amp;quot; in top-left list &amp;gt; Insert &amp;gt; New Light&lt;br /&gt;
&lt;br /&gt;
* Move it up off the floor a little (e.g. Z = 2). In Object Inspector &amp;gt; Affects Characters TRUE &amp;gt; &amp;quot;Color Intensity&amp;quot; 2 or more &amp;gt; &amp;quot;Light Type&amp;quot; Point - Static (lc) &amp;gt; Choose any bright color.&lt;br /&gt;
&lt;br /&gt;
*Copy and paste. In Object Inspector &amp;gt;&amp;quot;Light Type&amp;quot; Ambient - Baked (this light stops your shadows being pitch black) &amp;gt; Choose a dark blue colour and keep the Color Intensity under 2/3.&lt;br /&gt;
&lt;br /&gt;
* Right-click on &amp;quot;New Room&amp;quot; in top-left list &amp;gt; Insert &amp;gt; New Light Probe&lt;br /&gt;
&lt;br /&gt;
 Note : you need a light probe to make character and water lighting work properly. The exact position doesn't seem to matter much.&lt;br /&gt;
&lt;br /&gt;
 Note: I'm not sure what the mix of Baked/Static light is supposed to be. &lt;br /&gt;
 If you just put a Baked + Ambient it complains about not having Static, but if &lt;br /&gt;
 you put a Static + Ambient it seems to work fine, but the wiki says Static is &lt;br /&gt;
 the most expensive.&lt;br /&gt;
&lt;br /&gt;
 Hint: For more even character lighting, use 3 or 4 static lights. Arrange them in &lt;br /&gt;
 a circle outside all of the rooms. Increase the Point Radius property of each light &lt;br /&gt;
 to a very large value, e.g. 10000 so that it works like a floodlight.&lt;br /&gt;
&lt;br /&gt;
==Rendering Lightmaps==&lt;br /&gt;
&lt;br /&gt;
*Press the Render Lightmaps icon (you need ActivePython 2.5 installed to default location). When it's done click the Display Lightmaps On/Off icon in the top-left to refresh the results.&lt;br /&gt;
*Uncheck the &amp;quot;View Models Fully Lit&amp;quot; icon in the lop-left. You should see shadows from any objects you've dropped in.&lt;br /&gt;
&lt;br /&gt;
 Note: Lightmap-atlas messages might appear the first time you render. That seems normal.&lt;br /&gt;
 Sometimes re-rendering the lightmaps messes them up badly when Display Lightmaps On/Off is on. It &lt;br /&gt;
 doesn't seem to use the latest lightmaps. Try pressing Display Lightmaps On/Off a few times to &lt;br /&gt;
 update it. If they're still messed up sometimes one of these fixes it (don't know which)&lt;br /&gt;
 unloading/reloading your Area or Level/changing your Area's layout property/posting your Level to &lt;br /&gt;
 Local.&lt;br /&gt;
&lt;br /&gt;
==Adding the Minimap==&lt;br /&gt;
&lt;br /&gt;
Select the area. Right click, then select Minimap &amp;gt; Minimap Selection Tool. The default green box appears. Right click on the area again, Minimap &amp;gt; Post Minimap to Local. &lt;br /&gt;
&lt;br /&gt;
==Exporting==&lt;br /&gt;
&lt;br /&gt;
*Press the Do All Local Posts icon to the right of the lightmapping icons. It will export the name you typed into the &amp;quot;New Area&amp;quot; &amp;quot;Layout Name&amp;quot;. &lt;br /&gt;
*If that doesn't work, select the area then Edit &amp;gt; Post Selection To Local.&lt;br /&gt;
*If there's a complaint about walkable/player start then delete your old start then place a new one on a flat area.&lt;br /&gt;
*Save your .lvl file. It's not used by the game and the name/location doesn't matter. Only the exported/posted files are used.&lt;br /&gt;
&lt;br /&gt;
==Using this in an Area==&lt;br /&gt;
&lt;br /&gt;
File &amp;gt; New &amp;gt; Area &amp;gt; Any Name&lt;br /&gt;
&lt;br /&gt;
*In the Object Inspector &amp;gt; Area Layout you should get a &amp;quot;...&amp;quot; box (make sure it's Checked Out) &amp;gt; click then select your &amp;quot;Layout Name&amp;quot; which should now be there.&lt;br /&gt;
&lt;br /&gt;
* Now you have a pretty lightmapped level inside an area.&lt;br /&gt;
&lt;br /&gt;
=Building your terrain (Exterior Level)=&lt;br /&gt;
How to create/lightmap a [[Level]] for use in an Exterior [[Area]]:&lt;br /&gt;
Objective: Following along with this tutorial, you should be able to create a simple terrain from scratch.&lt;br /&gt;
&lt;br /&gt;
File&amp;gt;New&amp;gt;Level&lt;br /&gt;
&lt;br /&gt;
* Choose Terrain (Landscape) Level and then click Next.&lt;br /&gt;
&lt;br /&gt;
* Accept the default values for the purpose of this tutorial and click Next and then click Finish. You can learn more about what the different terrain options do at the [[Level editor]] page.&lt;br /&gt;
&lt;br /&gt;
You should now see a flat, dark piece of terrain. To move around you hold down the mouse wheel. If you want to rotate the view press the Alt key while holding down the mouse wheel. You will want some light so you can see what you are doing, so we will generate a light source next.&lt;br /&gt;
&lt;br /&gt;
Tip: When choosing the size of your terrain level think about where you are going to put horizon and vista objects, like distant mountains and tree lines. You may need to allow for extra space around your adventure area to place those items.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Grid Size==&lt;br /&gt;
&lt;br /&gt;
If you want to work with a larger grid than the one provided by default you can change the grid size by going to: &lt;br /&gt;
&lt;br /&gt;
Tools/Options/Level Editor/Grid Square Size.&lt;br /&gt;
&lt;br /&gt;
This will not change the actual dimensions of the terrain level that you created, it only changes the size of the squares in the grid.&lt;br /&gt;
&lt;br /&gt;
==Define an area==&lt;br /&gt;
&lt;br /&gt;
Must be done before rendering the lightmap.&lt;br /&gt;
&lt;br /&gt;
* Click on the purple +-sign and click Define Area. Start in one corner and draw the green square to define the area that you will export.&lt;br /&gt;
* Fill in the box Layout Name, max seven characters.&lt;br /&gt;
* Fill in the box Name.&lt;br /&gt;
&lt;br /&gt;
==Lighting==&lt;br /&gt;
&lt;br /&gt;
* Right click on Terrain World to the upper left and choose Insert&amp;gt;New Light. This will spawn a light source in your area.  Make sure you change the Light Type to Ambient - Baked (L).  Be sure to click on the Render Lightmaps button if you want to see how your ambient light is working.&lt;br /&gt;
&lt;br /&gt;
Now that the terrain is lit we can modify it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Modifying Terrain==&lt;br /&gt;
&lt;br /&gt;
The [[Terrain mesh]] tools allow you to modify the terrain by changing elevations, smoothing edges, flatting terrain, or painting textures.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Water==&lt;br /&gt;
&lt;br /&gt;
Please note that as of build 1.0.982.0 water is broken.  You can see it in editor, but it is not making it into the game.&lt;br /&gt;
&lt;br /&gt;
First use the [[Terrain mesh]] tools to make a hole.  It doesn't have to be deep.  Then right-click on Terrain world and select Insert -&amp;gt; New Water Mesh.  Double Click on the Water Mesh to zoom to it.  By default it gets placed in a corner.  Using the 3 Axis Movement tool [[File:moveTool.png]] grab the water and drag it to your hole.  Depending on the size of the hole, you might have to adjust the water mesh size by changing the Size X and Size Y property values.  Once you have the mesh placed, it's time to create the light probe.  Right-click near the water mesh and select Insert -&amp;gt; New Light Probe.  Using the move tool again, drag the light probe so that is roughly centered over the water mesh and slightly above it.  Click on Render Lightmaps, then Render Light Probs.  You might have to toggle Display Lightmaps, but you should now see your water looking like water and reflecting things around it.&lt;br /&gt;
&lt;br /&gt;
==Placing Models==&lt;br /&gt;
&lt;br /&gt;
* Click the blue box in the Palette Window to access the models that come with the game. The [[Model list]] shows pictures of many of the models available.&lt;br /&gt;
&lt;br /&gt;
* The [[Model]] page has more details on how to work with models.&lt;br /&gt;
&lt;br /&gt;
Tip 1: I had to change the Snap Options to make the models go where I wanted them. The settings I use were 0.10 for Snap to Grid and Snap Z Size. I also had to turn off Enable Snap to Surface whenever I wanted to change the vertical position of something (like creating the second floor of a building). Enable Snap to Surface is not applied globally, so once you turn it off and position an object vertically, turning it back on will not move that object unless you select it (or have it selected when you turn it back on).&lt;br /&gt;
&lt;br /&gt;
Tip 2: When placing premade cottages be aware that the door frames you can see attached to those buildings DO NOT have built in door hooks (see [[Area tutorial]] for information on placing doors). You can place a door frame model (for example, fhe_doorfrs_0) over the built in door frame to generate a door hook. The door frame model has to be placed from the Level Editor.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Adding Vegetation and Wind==&lt;br /&gt;
&lt;br /&gt;
The [[Vegetation]] page includes a list with pictures of the various plants available for placement. If you do not see the plants once you place them with the Scatter Object Tool then you may need to adjust your SpeedTree Rendering Distance Selector. This is a drop-down that you will see in the Tool Bar. It lists the distances at which plants will be visible. I set it to Very Far and left it there.&lt;br /&gt;
&lt;br /&gt;
Each level can have one active wind object in it. The location of the wind object doesn't matter. The wind object defines how wind behaves on this level, which is used for such things as flapping banners and swaying trees.&lt;br /&gt;
&lt;br /&gt;
Image:Level editor wind object.png &lt;br /&gt;
&lt;br /&gt;
The Wind Object may be found by right clicking on Terrain World and selecting:&lt;br /&gt;
&lt;br /&gt;
Insert&amp;gt;New Wind Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Visual Effects (VFX)==&lt;br /&gt;
&lt;br /&gt;
Placeable visual effects like flames or smoke are considered to be art assets in the Dragon Age toolset, so you need to place them from within the Level Editor. &lt;br /&gt;
&lt;br /&gt;
The [[VFX Tutorial]] provides guidance on creating and placing visual effects.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Path finding and Obstructions==&lt;br /&gt;
&lt;br /&gt;
The path finding process lays down a grid of points that are marked &amp;quot;accessible&amp;quot; if they can be reached from a path finding start spot via passable terrain. This is essentially a flood-fill algorithm.&lt;br /&gt;
&lt;br /&gt;
You must create an [[Exportable area]] before you can generate any path finding data.&lt;br /&gt;
&lt;br /&gt;
* Click on the purple + in the tool bar ([[File:IconAddExportableArea.png]]). This will open an Area Properties window. The [[Level editor]] page has more details on this process, so I will just keep these steps very basic.&lt;br /&gt;
* Name your Exportable Area in the Layout Name field of the Area Properties window. The name of an exportable area layout is limited to seven characters. BioWare uses the following naming system:&lt;br /&gt;
** Three-letter prefix that describes the region or plot the layout is for. For example, &amp;quot;ost&amp;quot; for Ostagar and environs.&lt;br /&gt;
** Three-digit number that uniquely identifies the layout within that region. Increments of one hundred are commonly used for major areas to allow sub-regions to be grouped together.&lt;br /&gt;
** A single character identifying variants of the layout. For example, a &amp;quot;d&amp;quot; suffix for the &amp;quot;daytime&amp;quot; version of an exterior layout. &amp;quot;d&amp;quot; is also often used to mean &amp;quot;default&amp;quot;, for areas where day and night are irrelevant (deep in a cave, for example).&lt;br /&gt;
* Define your walkable area. Do this by clicking the Define Area button in the Area Properties window. The green box must include any areas that you want players to be able to walk. If you click in a corner of the level the green box will appear there. You can then expand it by dragging the corner.&lt;br /&gt;
* Close the Area Properties window.&lt;br /&gt;
&lt;br /&gt;
In most cases you will want to block off certain areas of your terrain.&lt;br /&gt;
* Turn on the Build Terrain Blocking tool.  It is the middle mountain icon.&lt;br /&gt;
* Using left-click to place and right-click to end chains/delete, place down blocks or 'walls' around areas you don't want the player to enter&lt;br /&gt;
* Be sure to provide visual clues if it isn't obvious why the player can't walk there.&lt;br /&gt;
&lt;br /&gt;
Now that you have your exportable area you can generate path finding data.&lt;br /&gt;
&lt;br /&gt;
* Place a Starting Point in your level. I found that path finding does not work if you place the Starting Point before you have an Exportable Area. To place a Starting Point click on Setup Start Point in the tool bar.&lt;br /&gt;
* Record the name of your Starting Point by clicking on it and looking at the name in the Object Inspector. Do not change the name - changing the name can prevent path finding from working.&lt;br /&gt;
* Click Exportable Area Properties in the tool bar to open the Area Properties window. Put the Start Point name in the appropriate  field and close the window.&lt;br /&gt;
&lt;br /&gt;
You should now be ready to generate pathfinding data by clicking on the Generate Pathfinding for Active Area button in the tool bar.&lt;br /&gt;
&lt;br /&gt;
==Converting Levels into Areas==&lt;br /&gt;
&lt;br /&gt;
Click on Do All Local Posts (you can avoid problems by generating a lightmap and pathfinding before doing local posts). This can be found in the menu at Tools&amp;gt;Export&amp;gt;Do All Local Posts&lt;br /&gt;
&lt;br /&gt;
Your level has now been converted and can be used to make an area. The [[Area tutorial]] will walk you through what to do next.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Tutorials]]&lt;/div&gt;</summary>
		<author><name>TrueKeaton</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Level_Editor_Tutorial&amp;diff=12833</id>
		<title>Level Editor Tutorial</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Level_Editor_Tutorial&amp;diff=12833"/>
				<updated>2010-04-07T16:43:36Z</updated>
		
		<summary type="html">&lt;p&gt;TrueKeaton: /* Adding lights */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Building your room (Interior Level)=&lt;br /&gt;
How to create/lightmap a [[Level]] for use in an Interior [[Area]]:&lt;br /&gt;
Objective: Following along with this tutorial, you should be able to create a simple room from scratch in 10 minutes or less&lt;br /&gt;
&lt;br /&gt;
 This was lifted from a posting by St4rdog http://social.bioware.com/forum/1/topic/8/index/150840&lt;br /&gt;
 It needs some additional formatting love, but is as good starting place for people to create usable &lt;br /&gt;
 interior levels&lt;br /&gt;
&lt;br /&gt;
File &amp;gt; New &amp;gt; Level &amp;gt; Room Level&lt;br /&gt;
&lt;br /&gt;
* Click on &amp;quot;New Area&amp;quot; in top-left list &amp;gt; Object Inspector in bottom-right &amp;gt; Layout Name &amp;gt; anything under 8 characters no spaces or special characters (*,&amp;amp;,%, etc).&lt;br /&gt;
* Click the Setup Start Point icon, then click anywhere to make a start point.&lt;br /&gt;
* Select the Area, then add the Start Point Name in the Object Inspector.  &lt;br /&gt;
*Right-click in 3D view and select Insert &amp;gt; New Room.&lt;br /&gt;
*Click Models (blue box) in the Palette in the top-right. These folders contain everything such as floor tiles, walls, etc.&lt;br /&gt;
*Enable Grid Snap with the magnet icon to make sure they line up.&lt;br /&gt;
*The &amp;quot;prp&amp;quot; folder contains things like beds/barrels to clutter your Level.&lt;br /&gt;
 Hint: Use [[DATool]] (3rd party tool downloadable at http://social.bioware.com/project/41/ )to browse &lt;br /&gt;
 through these quickly to find the floors/walls you want.&lt;br /&gt;
*Any gaps you can see between models (such as wall sections) will be visible in game. When you have time to refine the layout, you can remove most hairline gaps by setting exact X Y Z coordinates in the toolset (though sometimes 0.99 or 1.01 looks better than 1.00). Larger gaps may require the use of tileset assets such as pillars. The black box tileset (blk) can be placed outside a room to cover up any defects.&lt;br /&gt;
 Hint: If you need lots of wall sections quickly, place one at a convenient location e.g. (0,0). Copy (Ctrl-C) then Paste (Ctrl-V)&lt;br /&gt;
 as many as you need. In the Object Inspector, change the coordinates of successive sections to (0,8), (0,16) etc or drag manually &lt;br /&gt;
 if you can do that quicker.&lt;br /&gt;
&lt;br /&gt;
 Note: If you get &amp;quot;Cannot spawn models into the selected parent object&amp;quot; when trying to place a model &lt;br /&gt;
 then you don't have &amp;quot;New Room&amp;quot; selected.&lt;br /&gt;
&lt;br /&gt;
==Working with multiple rooms==&lt;br /&gt;
&lt;br /&gt;
In general it is best to define each building room as a new room in the level. This becomes important when you work on lighting. To physically connect rooms you need to slide them together to get the doors to line up, they do not line up automatically. It takes some trial and error but becomes easier with practice.&lt;br /&gt;
&lt;br /&gt;
Use the Room Properties icon to specify which rooms are connected etc.&lt;br /&gt;
&lt;br /&gt;
==Pathfinding==&lt;br /&gt;
&lt;br /&gt;
Click the Generate Pathfinding icon. Green dots indicate where the player will be allowed to walk.&lt;br /&gt;
&lt;br /&gt;
For this to work, the area properties must name a valid start point, and it needs to be bounded by walls or other obstacles.&lt;br /&gt;
&lt;br /&gt;
 Hint: you may need to place another startpoint in any room that can't be reached from the main startpoint. That would apply, for example, to&lt;br /&gt;
 rooms reached by transition doors within the area.&lt;br /&gt;
&lt;br /&gt;
==Adding lights==&lt;br /&gt;
&lt;br /&gt;
* Right-click on &amp;quot;New Room&amp;quot; in top-left list &amp;gt; Insert &amp;gt; New Light&lt;br /&gt;
&lt;br /&gt;
* Move it up off the floor a little (e.g. Z = 2). In Object Inspector &amp;gt; Affects Characters TRUE &amp;gt; &amp;quot;Color Intensity&amp;quot; 2 or more &amp;gt; &amp;quot;Light Type&amp;quot; Point - Static (lc) &amp;gt; Choose any bright color.&lt;br /&gt;
&lt;br /&gt;
*Copy and paste. In Object Inspector &amp;gt;&amp;quot;Light Type&amp;quot; Ambient - Baked (this light stops your shadows being pitch black) &amp;gt; Choose a dark blue colour and keep the Color Intensity under 2/3.&lt;br /&gt;
&lt;br /&gt;
* Right-click on &amp;quot;New Room&amp;quot; in top-left list &amp;gt; Insert &amp;gt; New Light Probe&lt;br /&gt;
&lt;br /&gt;
 Note : you need a light probe to make character and water lighting work properly. The exact position doesn't seem to matter much.&lt;br /&gt;
&lt;br /&gt;
 Note: I'm not sure what the mix of Baked/Static light is supposed to be. &lt;br /&gt;
 If you just put a Baked + Ambient it complains about not having Static, but if &lt;br /&gt;
 you put a Static + Ambient it seems to work fine, but the wiki says Static is &lt;br /&gt;
 the most expensive.&lt;br /&gt;
&lt;br /&gt;
 Hint: For more even character lighting, use 3 or 4 static lights. Arrange them in a circle outside all of the rooms. Increase the Point Radius property of each light to a very large value, e.g. 10000 so that it works like a floodlight.&lt;br /&gt;
&lt;br /&gt;
==Rendering Lightmaps==&lt;br /&gt;
&lt;br /&gt;
*Press the Render Lightmaps icon (you need ActivePython 2.5 installed to default location). When it's done click the Display Lightmaps On/Off icon in the top-left to refresh the results.&lt;br /&gt;
*Uncheck the &amp;quot;View Models Fully Lit&amp;quot; icon in the lop-left. You should see shadows from any objects you've dropped in.&lt;br /&gt;
&lt;br /&gt;
 Note: Lightmap-atlas messages might appear the first time you render. That seems normal.&lt;br /&gt;
 Sometimes re-rendering the lightmaps messes them up badly when Display Lightmaps On/Off is on. It &lt;br /&gt;
 doesn't seem to use the latest lightmaps. Try pressing Display Lightmaps On/Off a few times to &lt;br /&gt;
 update it. If they're still messed up sometimes one of these fixes it (don't know which)&lt;br /&gt;
 unloading/reloading your Area or Level/changing your Area's layout property/posting your Level to &lt;br /&gt;
 Local.&lt;br /&gt;
&lt;br /&gt;
==Adding the Minimap==&lt;br /&gt;
&lt;br /&gt;
Select the area. Right click, then select Minimap &amp;gt; Minimap Selection Tool. The default green box appears. Right click on the area again, Minimap &amp;gt; Post Minimap to Local. &lt;br /&gt;
&lt;br /&gt;
==Exporting==&lt;br /&gt;
&lt;br /&gt;
*Press the Do All Local Posts icon to the right of the lightmapping icons. It will export the name you typed into the &amp;quot;New Area&amp;quot; &amp;quot;Layout Name&amp;quot;. &lt;br /&gt;
*If that doesn't work, select the area then Edit &amp;gt; Post Selection To Local.&lt;br /&gt;
*If there's a complaint about walkable/player start then delete your old start then place a new one on a flat area.&lt;br /&gt;
*Save your .lvl file. It's not used by the game and the name/location doesn't matter. Only the exported/posted files are used.&lt;br /&gt;
&lt;br /&gt;
==Using this in an Area==&lt;br /&gt;
&lt;br /&gt;
File &amp;gt; New &amp;gt; Area &amp;gt; Any Name&lt;br /&gt;
&lt;br /&gt;
*In the Object Inspector &amp;gt; Area Layout you should get a &amp;quot;...&amp;quot; box (make sure it's Checked Out) &amp;gt; click then select your &amp;quot;Layout Name&amp;quot; which should now be there.&lt;br /&gt;
&lt;br /&gt;
* Now you have a pretty lightmapped level inside an area.&lt;br /&gt;
&lt;br /&gt;
=Building your terrain (Exterior Level)=&lt;br /&gt;
How to create/lightmap a [[Level]] for use in an Exterior [[Area]]:&lt;br /&gt;
Objective: Following along with this tutorial, you should be able to create a simple terrain from scratch.&lt;br /&gt;
&lt;br /&gt;
File&amp;gt;New&amp;gt;Level&lt;br /&gt;
&lt;br /&gt;
* Choose Terrain (Landscape) Level and then click Next.&lt;br /&gt;
&lt;br /&gt;
* Accept the default values for the purpose of this tutorial and click Next and then click Finish. You can learn more about what the different terrain options do at the [[Level editor]] page.&lt;br /&gt;
&lt;br /&gt;
You should now see a flat, dark piece of terrain. To move around you hold down the mouse wheel. If you want to rotate the view press the Alt key while holding down the mouse wheel. You will want some light so you can see what you are doing, so we will generate a light source next.&lt;br /&gt;
&lt;br /&gt;
Tip: When choosing the size of your terrain level think about where you are going to put horizon and vista objects, like distant mountains and tree lines. You may need to allow for extra space around your adventure area to place those items.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Grid Size==&lt;br /&gt;
&lt;br /&gt;
If you want to work with a larger grid than the one provided by default you can change the grid size by going to: &lt;br /&gt;
&lt;br /&gt;
Tools/Options/Level Editor/Grid Square Size.&lt;br /&gt;
&lt;br /&gt;
This will not change the actual dimensions of the terrain level that you created, it only changes the size of the squares in the grid.&lt;br /&gt;
&lt;br /&gt;
==Define an area==&lt;br /&gt;
&lt;br /&gt;
Must be done before rendering the lightmap.&lt;br /&gt;
&lt;br /&gt;
* Click on the purple +-sign and click Define Area. Start in one corner and draw the green square to define the area that you will export.&lt;br /&gt;
* Fill in the box Layout Name, max seven characters.&lt;br /&gt;
* Fill in the box Name.&lt;br /&gt;
&lt;br /&gt;
==Lighting==&lt;br /&gt;
&lt;br /&gt;
* Right click on Terrain World to the upper left and choose Insert&amp;gt;New Light. This will spawn a light source in your area.  Make sure you change the Light Type to Ambient - Baked (L).  Be sure to click on the Render Lightmaps button if you want to see how your ambient light is working.&lt;br /&gt;
&lt;br /&gt;
Now that the terrain is lit we can modify it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Modifying Terrain==&lt;br /&gt;
&lt;br /&gt;
The [[Terrain mesh]] tools allow you to modify the terrain by changing elevations, smoothing edges, flatting terrain, or painting textures.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Water==&lt;br /&gt;
&lt;br /&gt;
Please note that as of build 1.0.982.0 water is broken.  You can see it in editor, but it is not making it into the game.&lt;br /&gt;
&lt;br /&gt;
First use the [[Terrain mesh]] tools to make a hole.  It doesn't have to be deep.  Then right-click on Terrain world and select Insert -&amp;gt; New Water Mesh.  Double Click on the Water Mesh to zoom to it.  By default it gets placed in a corner.  Using the 3 Axis Movement tool [[File:moveTool.png]] grab the water and drag it to your hole.  Depending on the size of the hole, you might have to adjust the water mesh size by changing the Size X and Size Y property values.  Once you have the mesh placed, it's time to create the light probe.  Right-click near the water mesh and select Insert -&amp;gt; New Light Probe.  Using the move tool again, drag the light probe so that is roughly centered over the water mesh and slightly above it.  Click on Render Lightmaps, then Render Light Probs.  You might have to toggle Display Lightmaps, but you should now see your water looking like water and reflecting things around it.&lt;br /&gt;
&lt;br /&gt;
==Placing Models==&lt;br /&gt;
&lt;br /&gt;
* Click the blue box in the Palette Window to access the models that come with the game. The [[Model list]] shows pictures of many of the models available.&lt;br /&gt;
&lt;br /&gt;
* The [[Model]] page has more details on how to work with models.&lt;br /&gt;
&lt;br /&gt;
Tip 1: I had to change the Snap Options to make the models go where I wanted them. The settings I use were 0.10 for Snap to Grid and Snap Z Size. I also had to turn off Enable Snap to Surface whenever I wanted to change the vertical position of something (like creating the second floor of a building). Enable Snap to Surface is not applied globally, so once you turn it off and position an object vertically, turning it back on will not move that object unless you select it (or have it selected when you turn it back on).&lt;br /&gt;
&lt;br /&gt;
Tip 2: When placing premade cottages be aware that the door frames you can see attached to those buildings DO NOT have built in door hooks (see [[Area tutorial]] for information on placing doors). You can place a door frame model (for example, fhe_doorfrs_0) over the built in door frame to generate a door hook. The door frame model has to be placed from the Level Editor.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Adding Vegetation and Wind==&lt;br /&gt;
&lt;br /&gt;
The [[Vegetation]] page includes a list with pictures of the various plants available for placement. If you do not see the plants once you place them with the Scatter Object Tool then you may need to adjust your SpeedTree Rendering Distance Selector. This is a drop-down that you will see in the Tool Bar. It lists the distances at which plants will be visible. I set it to Very Far and left it there.&lt;br /&gt;
&lt;br /&gt;
Each level can have one active wind object in it. The location of the wind object doesn't matter. The wind object defines how wind behaves on this level, which is used for such things as flapping banners and swaying trees.&lt;br /&gt;
&lt;br /&gt;
Image:Level editor wind object.png &lt;br /&gt;
&lt;br /&gt;
The Wind Object may be found by right clicking on Terrain World and selecting:&lt;br /&gt;
&lt;br /&gt;
Insert&amp;gt;New Wind Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Visual Effects (VFX)==&lt;br /&gt;
&lt;br /&gt;
Placeable visual effects like flames or smoke are considered to be art assets in the Dragon Age toolset, so you need to place them from within the Level Editor. &lt;br /&gt;
&lt;br /&gt;
The [[VFX Tutorial]] provides guidance on creating and placing visual effects.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Path finding and Obstructions==&lt;br /&gt;
&lt;br /&gt;
The path finding process lays down a grid of points that are marked &amp;quot;accessible&amp;quot; if they can be reached from a path finding start spot via passable terrain. This is essentially a flood-fill algorithm.&lt;br /&gt;
&lt;br /&gt;
You must create an [[Exportable area]] before you can generate any path finding data.&lt;br /&gt;
&lt;br /&gt;
* Click on the purple + in the tool bar ([[File:IconAddExportableArea.png]]). This will open an Area Properties window. The [[Level editor]] page has more details on this process, so I will just keep these steps very basic.&lt;br /&gt;
* Name your Exportable Area in the Layout Name field of the Area Properties window. The name of an exportable area layout is limited to seven characters. BioWare uses the following naming system:&lt;br /&gt;
** Three-letter prefix that describes the region or plot the layout is for. For example, &amp;quot;ost&amp;quot; for Ostagar and environs.&lt;br /&gt;
** Three-digit number that uniquely identifies the layout within that region. Increments of one hundred are commonly used for major areas to allow sub-regions to be grouped together.&lt;br /&gt;
** A single character identifying variants of the layout. For example, a &amp;quot;d&amp;quot; suffix for the &amp;quot;daytime&amp;quot; version of an exterior layout. &amp;quot;d&amp;quot; is also often used to mean &amp;quot;default&amp;quot;, for areas where day and night are irrelevant (deep in a cave, for example).&lt;br /&gt;
* Define your walkable area. Do this by clicking the Define Area button in the Area Properties window. The green box must include any areas that you want players to be able to walk. If you click in a corner of the level the green box will appear there. You can then expand it by dragging the corner.&lt;br /&gt;
* Close the Area Properties window.&lt;br /&gt;
&lt;br /&gt;
In most cases you will want to block off certain areas of your terrain.&lt;br /&gt;
* Turn on the Build Terrain Blocking tool.  It is the middle mountain icon.&lt;br /&gt;
* Using left-click to place and right-click to end chains/delete, place down blocks or 'walls' around areas you don't want the player to enter&lt;br /&gt;
* Be sure to provide visual clues if it isn't obvious why the player can't walk there.&lt;br /&gt;
&lt;br /&gt;
Now that you have your exportable area you can generate path finding data.&lt;br /&gt;
&lt;br /&gt;
* Place a Starting Point in your level. I found that path finding does not work if you place the Starting Point before you have an Exportable Area. To place a Starting Point click on Setup Start Point in the tool bar.&lt;br /&gt;
* Record the name of your Starting Point by clicking on it and looking at the name in the Object Inspector. Do not change the name - changing the name can prevent path finding from working.&lt;br /&gt;
* Click Exportable Area Properties in the tool bar to open the Area Properties window. Put the Start Point name in the appropriate  field and close the window.&lt;br /&gt;
&lt;br /&gt;
You should now be ready to generate pathfinding data by clicking on the Generate Pathfinding for Active Area button in the tool bar.&lt;br /&gt;
&lt;br /&gt;
==Converting Levels into Areas==&lt;br /&gt;
&lt;br /&gt;
Click on Do All Local Posts (you can avoid problems by generating a lightmap and pathfinding before doing local posts). This can be found in the menu at Tools&amp;gt;Export&amp;gt;Do All Local Posts&lt;br /&gt;
&lt;br /&gt;
Your level has now been converted and can be used to make an area. The [[Area tutorial]] will walk you through what to do next.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Tutorials]]&lt;/div&gt;</summary>
		<author><name>TrueKeaton</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Level_Editor_Tutorial&amp;diff=12832</id>
		<title>Level Editor Tutorial</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Level_Editor_Tutorial&amp;diff=12832"/>
				<updated>2010-04-07T16:43:20Z</updated>
		
		<summary type="html">&lt;p&gt;TrueKeaton: /* Adding lights */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Building your room (Interior Level)=&lt;br /&gt;
How to create/lightmap a [[Level]] for use in an Interior [[Area]]:&lt;br /&gt;
Objective: Following along with this tutorial, you should be able to create a simple room from scratch in 10 minutes or less&lt;br /&gt;
&lt;br /&gt;
 This was lifted from a posting by St4rdog http://social.bioware.com/forum/1/topic/8/index/150840&lt;br /&gt;
 It needs some additional formatting love, but is as good starting place for people to create usable &lt;br /&gt;
 interior levels&lt;br /&gt;
&lt;br /&gt;
File &amp;gt; New &amp;gt; Level &amp;gt; Room Level&lt;br /&gt;
&lt;br /&gt;
* Click on &amp;quot;New Area&amp;quot; in top-left list &amp;gt; Object Inspector in bottom-right &amp;gt; Layout Name &amp;gt; anything under 8 characters no spaces or special characters (*,&amp;amp;,%, etc).&lt;br /&gt;
* Click the Setup Start Point icon, then click anywhere to make a start point.&lt;br /&gt;
* Select the Area, then add the Start Point Name in the Object Inspector.  &lt;br /&gt;
*Right-click in 3D view and select Insert &amp;gt; New Room.&lt;br /&gt;
*Click Models (blue box) in the Palette in the top-right. These folders contain everything such as floor tiles, walls, etc.&lt;br /&gt;
*Enable Grid Snap with the magnet icon to make sure they line up.&lt;br /&gt;
*The &amp;quot;prp&amp;quot; folder contains things like beds/barrels to clutter your Level.&lt;br /&gt;
 Hint: Use [[DATool]] (3rd party tool downloadable at http://social.bioware.com/project/41/ )to browse &lt;br /&gt;
 through these quickly to find the floors/walls you want.&lt;br /&gt;
*Any gaps you can see between models (such as wall sections) will be visible in game. When you have time to refine the layout, you can remove most hairline gaps by setting exact X Y Z coordinates in the toolset (though sometimes 0.99 or 1.01 looks better than 1.00). Larger gaps may require the use of tileset assets such as pillars. The black box tileset (blk) can be placed outside a room to cover up any defects.&lt;br /&gt;
 Hint: If you need lots of wall sections quickly, place one at a convenient location e.g. (0,0). Copy (Ctrl-C) then Paste (Ctrl-V)&lt;br /&gt;
 as many as you need. In the Object Inspector, change the coordinates of successive sections to (0,8), (0,16) etc or drag manually &lt;br /&gt;
 if you can do that quicker.&lt;br /&gt;
&lt;br /&gt;
 Note: If you get &amp;quot;Cannot spawn models into the selected parent object&amp;quot; when trying to place a model &lt;br /&gt;
 then you don't have &amp;quot;New Room&amp;quot; selected.&lt;br /&gt;
&lt;br /&gt;
==Working with multiple rooms==&lt;br /&gt;
&lt;br /&gt;
In general it is best to define each building room as a new room in the level. This becomes important when you work on lighting. To physically connect rooms you need to slide them together to get the doors to line up, they do not line up automatically. It takes some trial and error but becomes easier with practice.&lt;br /&gt;
&lt;br /&gt;
Use the Room Properties icon to specify which rooms are connected etc.&lt;br /&gt;
&lt;br /&gt;
==Pathfinding==&lt;br /&gt;
&lt;br /&gt;
Click the Generate Pathfinding icon. Green dots indicate where the player will be allowed to walk.&lt;br /&gt;
&lt;br /&gt;
For this to work, the area properties must name a valid start point, and it needs to be bounded by walls or other obstacles.&lt;br /&gt;
&lt;br /&gt;
 Hint: you may need to place another startpoint in any room that can't be reached from the main startpoint. That would apply, for example, to&lt;br /&gt;
 rooms reached by transition doors within the area.&lt;br /&gt;
&lt;br /&gt;
==Adding lights==&lt;br /&gt;
&lt;br /&gt;
* Right-click on &amp;quot;New Room&amp;quot; in top-left list &amp;gt; Insert &amp;gt; New Light&lt;br /&gt;
&lt;br /&gt;
* Move it up off the floor a little (e.g. Z = 2). In Object Inspector &amp;gt; Affects Characters TRUE &amp;gt; &amp;quot;Color Intensity&amp;quot; 2 or more &amp;gt; &amp;quot;Light Type&amp;quot; Point - Static (lc) &amp;gt; Choose any bright color.&lt;br /&gt;
&lt;br /&gt;
*Copy and paste. In Object Inspector &amp;gt;&amp;quot;Light Type&amp;quot; Ambient - Baked (this light stops your shadows being pitch black) &amp;gt; Choose a dark blue colour and keep the Color Intensity under 2/3.&lt;br /&gt;
&lt;br /&gt;
* Right-click on &amp;quot;New Room&amp;quot; in top-left list &amp;gt; Insert &amp;gt; New Light Probe&lt;br /&gt;
&lt;br /&gt;
 Note : you need a light probe to make character and water lighting work properly. The exact position doesn't seem to matter much.&lt;br /&gt;
&lt;br /&gt;
 Note: I'm not sure what the mix of Baked/Static light is supposed to be. &lt;br /&gt;
 If you just put a Baked + Ambient it complains about not having Static, but if &lt;br /&gt;
 you put a Static + Ambient it seems to work fine, but the wiki says Static is &lt;br /&gt;
 the most expensive.&lt;br /&gt;
&lt;br /&gt;
 Hint: For more even character lighting, use 3 or 4 static lights. Arrange them in a circle outside all of the rooms. Increase the Point&lt;br /&gt;
Radius property of each light to a very large value, e.g. 10000 so that it works like a floodlight.&lt;br /&gt;
&lt;br /&gt;
==Rendering Lightmaps==&lt;br /&gt;
&lt;br /&gt;
*Press the Render Lightmaps icon (you need ActivePython 2.5 installed to default location). When it's done click the Display Lightmaps On/Off icon in the top-left to refresh the results.&lt;br /&gt;
*Uncheck the &amp;quot;View Models Fully Lit&amp;quot; icon in the lop-left. You should see shadows from any objects you've dropped in.&lt;br /&gt;
&lt;br /&gt;
 Note: Lightmap-atlas messages might appear the first time you render. That seems normal.&lt;br /&gt;
 Sometimes re-rendering the lightmaps messes them up badly when Display Lightmaps On/Off is on. It &lt;br /&gt;
 doesn't seem to use the latest lightmaps. Try pressing Display Lightmaps On/Off a few times to &lt;br /&gt;
 update it. If they're still messed up sometimes one of these fixes it (don't know which)&lt;br /&gt;
 unloading/reloading your Area or Level/changing your Area's layout property/posting your Level to &lt;br /&gt;
 Local.&lt;br /&gt;
&lt;br /&gt;
==Adding the Minimap==&lt;br /&gt;
&lt;br /&gt;
Select the area. Right click, then select Minimap &amp;gt; Minimap Selection Tool. The default green box appears. Right click on the area again, Minimap &amp;gt; Post Minimap to Local. &lt;br /&gt;
&lt;br /&gt;
==Exporting==&lt;br /&gt;
&lt;br /&gt;
*Press the Do All Local Posts icon to the right of the lightmapping icons. It will export the name you typed into the &amp;quot;New Area&amp;quot; &amp;quot;Layout Name&amp;quot;. &lt;br /&gt;
*If that doesn't work, select the area then Edit &amp;gt; Post Selection To Local.&lt;br /&gt;
*If there's a complaint about walkable/player start then delete your old start then place a new one on a flat area.&lt;br /&gt;
*Save your .lvl file. It's not used by the game and the name/location doesn't matter. Only the exported/posted files are used.&lt;br /&gt;
&lt;br /&gt;
==Using this in an Area==&lt;br /&gt;
&lt;br /&gt;
File &amp;gt; New &amp;gt; Area &amp;gt; Any Name&lt;br /&gt;
&lt;br /&gt;
*In the Object Inspector &amp;gt; Area Layout you should get a &amp;quot;...&amp;quot; box (make sure it's Checked Out) &amp;gt; click then select your &amp;quot;Layout Name&amp;quot; which should now be there.&lt;br /&gt;
&lt;br /&gt;
* Now you have a pretty lightmapped level inside an area.&lt;br /&gt;
&lt;br /&gt;
=Building your terrain (Exterior Level)=&lt;br /&gt;
How to create/lightmap a [[Level]] for use in an Exterior [[Area]]:&lt;br /&gt;
Objective: Following along with this tutorial, you should be able to create a simple terrain from scratch.&lt;br /&gt;
&lt;br /&gt;
File&amp;gt;New&amp;gt;Level&lt;br /&gt;
&lt;br /&gt;
* Choose Terrain (Landscape) Level and then click Next.&lt;br /&gt;
&lt;br /&gt;
* Accept the default values for the purpose of this tutorial and click Next and then click Finish. You can learn more about what the different terrain options do at the [[Level editor]] page.&lt;br /&gt;
&lt;br /&gt;
You should now see a flat, dark piece of terrain. To move around you hold down the mouse wheel. If you want to rotate the view press the Alt key while holding down the mouse wheel. You will want some light so you can see what you are doing, so we will generate a light source next.&lt;br /&gt;
&lt;br /&gt;
Tip: When choosing the size of your terrain level think about where you are going to put horizon and vista objects, like distant mountains and tree lines. You may need to allow for extra space around your adventure area to place those items.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Grid Size==&lt;br /&gt;
&lt;br /&gt;
If you want to work with a larger grid than the one provided by default you can change the grid size by going to: &lt;br /&gt;
&lt;br /&gt;
Tools/Options/Level Editor/Grid Square Size.&lt;br /&gt;
&lt;br /&gt;
This will not change the actual dimensions of the terrain level that you created, it only changes the size of the squares in the grid.&lt;br /&gt;
&lt;br /&gt;
==Define an area==&lt;br /&gt;
&lt;br /&gt;
Must be done before rendering the lightmap.&lt;br /&gt;
&lt;br /&gt;
* Click on the purple +-sign and click Define Area. Start in one corner and draw the green square to define the area that you will export.&lt;br /&gt;
* Fill in the box Layout Name, max seven characters.&lt;br /&gt;
* Fill in the box Name.&lt;br /&gt;
&lt;br /&gt;
==Lighting==&lt;br /&gt;
&lt;br /&gt;
* Right click on Terrain World to the upper left and choose Insert&amp;gt;New Light. This will spawn a light source in your area.  Make sure you change the Light Type to Ambient - Baked (L).  Be sure to click on the Render Lightmaps button if you want to see how your ambient light is working.&lt;br /&gt;
&lt;br /&gt;
Now that the terrain is lit we can modify it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Modifying Terrain==&lt;br /&gt;
&lt;br /&gt;
The [[Terrain mesh]] tools allow you to modify the terrain by changing elevations, smoothing edges, flatting terrain, or painting textures.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Water==&lt;br /&gt;
&lt;br /&gt;
Please note that as of build 1.0.982.0 water is broken.  You can see it in editor, but it is not making it into the game.&lt;br /&gt;
&lt;br /&gt;
First use the [[Terrain mesh]] tools to make a hole.  It doesn't have to be deep.  Then right-click on Terrain world and select Insert -&amp;gt; New Water Mesh.  Double Click on the Water Mesh to zoom to it.  By default it gets placed in a corner.  Using the 3 Axis Movement tool [[File:moveTool.png]] grab the water and drag it to your hole.  Depending on the size of the hole, you might have to adjust the water mesh size by changing the Size X and Size Y property values.  Once you have the mesh placed, it's time to create the light probe.  Right-click near the water mesh and select Insert -&amp;gt; New Light Probe.  Using the move tool again, drag the light probe so that is roughly centered over the water mesh and slightly above it.  Click on Render Lightmaps, then Render Light Probs.  You might have to toggle Display Lightmaps, but you should now see your water looking like water and reflecting things around it.&lt;br /&gt;
&lt;br /&gt;
==Placing Models==&lt;br /&gt;
&lt;br /&gt;
* Click the blue box in the Palette Window to access the models that come with the game. The [[Model list]] shows pictures of many of the models available.&lt;br /&gt;
&lt;br /&gt;
* The [[Model]] page has more details on how to work with models.&lt;br /&gt;
&lt;br /&gt;
Tip 1: I had to change the Snap Options to make the models go where I wanted them. The settings I use were 0.10 for Snap to Grid and Snap Z Size. I also had to turn off Enable Snap to Surface whenever I wanted to change the vertical position of something (like creating the second floor of a building). Enable Snap to Surface is not applied globally, so once you turn it off and position an object vertically, turning it back on will not move that object unless you select it (or have it selected when you turn it back on).&lt;br /&gt;
&lt;br /&gt;
Tip 2: When placing premade cottages be aware that the door frames you can see attached to those buildings DO NOT have built in door hooks (see [[Area tutorial]] for information on placing doors). You can place a door frame model (for example, fhe_doorfrs_0) over the built in door frame to generate a door hook. The door frame model has to be placed from the Level Editor.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Adding Vegetation and Wind==&lt;br /&gt;
&lt;br /&gt;
The [[Vegetation]] page includes a list with pictures of the various plants available for placement. If you do not see the plants once you place them with the Scatter Object Tool then you may need to adjust your SpeedTree Rendering Distance Selector. This is a drop-down that you will see in the Tool Bar. It lists the distances at which plants will be visible. I set it to Very Far and left it there.&lt;br /&gt;
&lt;br /&gt;
Each level can have one active wind object in it. The location of the wind object doesn't matter. The wind object defines how wind behaves on this level, which is used for such things as flapping banners and swaying trees.&lt;br /&gt;
&lt;br /&gt;
Image:Level editor wind object.png &lt;br /&gt;
&lt;br /&gt;
The Wind Object may be found by right clicking on Terrain World and selecting:&lt;br /&gt;
&lt;br /&gt;
Insert&amp;gt;New Wind Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Visual Effects (VFX)==&lt;br /&gt;
&lt;br /&gt;
Placeable visual effects like flames or smoke are considered to be art assets in the Dragon Age toolset, so you need to place them from within the Level Editor. &lt;br /&gt;
&lt;br /&gt;
The [[VFX Tutorial]] provides guidance on creating and placing visual effects.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Path finding and Obstructions==&lt;br /&gt;
&lt;br /&gt;
The path finding process lays down a grid of points that are marked &amp;quot;accessible&amp;quot; if they can be reached from a path finding start spot via passable terrain. This is essentially a flood-fill algorithm.&lt;br /&gt;
&lt;br /&gt;
You must create an [[Exportable area]] before you can generate any path finding data.&lt;br /&gt;
&lt;br /&gt;
* Click on the purple + in the tool bar ([[File:IconAddExportableArea.png]]). This will open an Area Properties window. The [[Level editor]] page has more details on this process, so I will just keep these steps very basic.&lt;br /&gt;
* Name your Exportable Area in the Layout Name field of the Area Properties window. The name of an exportable area layout is limited to seven characters. BioWare uses the following naming system:&lt;br /&gt;
** Three-letter prefix that describes the region or plot the layout is for. For example, &amp;quot;ost&amp;quot; for Ostagar and environs.&lt;br /&gt;
** Three-digit number that uniquely identifies the layout within that region. Increments of one hundred are commonly used for major areas to allow sub-regions to be grouped together.&lt;br /&gt;
** A single character identifying variants of the layout. For example, a &amp;quot;d&amp;quot; suffix for the &amp;quot;daytime&amp;quot; version of an exterior layout. &amp;quot;d&amp;quot; is also often used to mean &amp;quot;default&amp;quot;, for areas where day and night are irrelevant (deep in a cave, for example).&lt;br /&gt;
* Define your walkable area. Do this by clicking the Define Area button in the Area Properties window. The green box must include any areas that you want players to be able to walk. If you click in a corner of the level the green box will appear there. You can then expand it by dragging the corner.&lt;br /&gt;
* Close the Area Properties window.&lt;br /&gt;
&lt;br /&gt;
In most cases you will want to block off certain areas of your terrain.&lt;br /&gt;
* Turn on the Build Terrain Blocking tool.  It is the middle mountain icon.&lt;br /&gt;
* Using left-click to place and right-click to end chains/delete, place down blocks or 'walls' around areas you don't want the player to enter&lt;br /&gt;
* Be sure to provide visual clues if it isn't obvious why the player can't walk there.&lt;br /&gt;
&lt;br /&gt;
Now that you have your exportable area you can generate path finding data.&lt;br /&gt;
&lt;br /&gt;
* Place a Starting Point in your level. I found that path finding does not work if you place the Starting Point before you have an Exportable Area. To place a Starting Point click on Setup Start Point in the tool bar.&lt;br /&gt;
* Record the name of your Starting Point by clicking on it and looking at the name in the Object Inspector. Do not change the name - changing the name can prevent path finding from working.&lt;br /&gt;
* Click Exportable Area Properties in the tool bar to open the Area Properties window. Put the Start Point name in the appropriate  field and close the window.&lt;br /&gt;
&lt;br /&gt;
You should now be ready to generate pathfinding data by clicking on the Generate Pathfinding for Active Area button in the tool bar.&lt;br /&gt;
&lt;br /&gt;
==Converting Levels into Areas==&lt;br /&gt;
&lt;br /&gt;
Click on Do All Local Posts (you can avoid problems by generating a lightmap and pathfinding before doing local posts). This can be found in the menu at Tools&amp;gt;Export&amp;gt;Do All Local Posts&lt;br /&gt;
&lt;br /&gt;
Your level has now been converted and can be used to make an area. The [[Area tutorial]] will walk you through what to do next.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Tutorials]]&lt;/div&gt;</summary>
		<author><name>TrueKeaton</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Adding_a_new_spell_tutorial&amp;diff=12809</id>
		<title>Adding a new spell tutorial</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Adding_a_new_spell_tutorial&amp;diff=12809"/>
				<updated>2010-03-30T18:30:36Z</updated>
		
		<summary type="html">&lt;p&gt;TrueKeaton: /* Creating a custom spell script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;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. &lt;br /&gt;
[[category:tutorials]]&lt;br /&gt;
&lt;br /&gt;
The process of adding a spell to the game is as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Create a new module that extends the single player game&lt;br /&gt;
*Create a new guitype that your spell exists under&lt;br /&gt;
*Create a new ability entry for your spell&lt;br /&gt;
*Create a custom script to handle your spell&lt;br /&gt;
*Create strings to describe your spell in the talent page and tool tips&lt;br /&gt;
*Testing it in the game&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Before beginning ensure you read the article on editing [[2DA]] files and how to convert them to GDA files for use in the game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating your module ==&lt;br /&gt;
&lt;br /&gt;
These are just some basic settings required so that your module extends the Single Player campaign. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Load the toolset and select '''File''' &amp;gt; '''Manage Modules'''&lt;br /&gt;
# Click on '''New''' and fill in the following fields:&lt;br /&gt;
## '''Name''': Full Heal&lt;br /&gt;
## '''Script''': (none) (Click on the ... button and select (none))&lt;br /&gt;
## '''UID''': full_heal&lt;br /&gt;
## '''Extended Module''': Single Player&lt;br /&gt;
# Click '''Open''' to load your new module (it should be selected by default)&lt;br /&gt;
# Select '''Tools''' &amp;gt; '''Export''' &amp;gt; '''Generate Module XML'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You now have a new module that will be loaded whenever you play the Single Player campaign.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating a new Spell Type == &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
For more information on the columns we are modifying refer to the article on [[Guitypes.xls]].&lt;br /&gt;
&lt;br /&gt;
# Open up your 2DA folder, it should be at \Dragon Age\tools\Source\2DA &lt;br /&gt;
# Copy the file '''guitypes.xls''' to a new folder, for example C:\2DA&lt;br /&gt;
# Open the file and delete all the rows except the headings&lt;br /&gt;
# Create a new row with the following details:&lt;br /&gt;
## '''ID''': 777&lt;br /&gt;
## '''Label''': Divine Healer&lt;br /&gt;
## '''StringID''': **** (we will replace this later with the proper string ID)&lt;br /&gt;
## '''TintColor''': 0x888888 (I think this only matters if you are using the progress bar)&lt;br /&gt;
## '''BlendTree''': ****&lt;br /&gt;
## Any remaining columns in between set to 0&lt;br /&gt;
# Save and close the file. &lt;br /&gt;
# Convert it to a '''GDA''' file &lt;br /&gt;
## 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.&lt;br /&gt;
# Copy the GDA to your module override folder (My Documents\Bioware\Dragon Age\AddIns\full_heal\module\override)&lt;br /&gt;
# Rename the file '''guitypes_fh.GDA'''&lt;br /&gt;
&lt;br /&gt;
== Creating a new ability entry == &lt;br /&gt;
&lt;br /&gt;
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]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Open up the rules folder in your 2DA folder, it should be at \Dragon Age\tools\Source\2DA\rules&lt;br /&gt;
# Copy '''ABI_Base.xls''' to your 2DA folder&lt;br /&gt;
# Open the file and find the entry for '''HEAL'''&lt;br /&gt;
# Copy the whole row to the bottom of the file&lt;br /&gt;
# Delete the rest of the rows except for the headings&lt;br /&gt;
# Cut your row and paste it as the first row&lt;br /&gt;
# Make the following changes to your HEAL row&lt;br /&gt;
##''' ID''': 777777&lt;br /&gt;
## '''label''': FULL HEAL&lt;br /&gt;
## '''guitype''': 777&lt;br /&gt;
# Save and close the file&lt;br /&gt;
# Convert it to a '''GDA''' file (For instructions see [[Compiling 2DAs]])&lt;br /&gt;
# Copy the '''ABI_Base.GDA''' file to your module override folder (My Documents\Bioware\Dragon Age\AddIns\full_heal\module\override)&lt;br /&gt;
# Rename the file '''ABI_Base_fh.GDA'''&lt;br /&gt;
&lt;br /&gt;
== Preliminary Testing ==&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* 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&lt;br /&gt;
* Check that your GDA files are copied to the correct override folder&lt;br /&gt;
* Generate your module XML file again&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating a custom spell script ==&lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Select '''File''' &amp;gt; '''New''' &amp;gt; '''Script'''&lt;br /&gt;
# Set the following properties&lt;br /&gt;
## '''Resource Name''': full_heal&lt;br /&gt;
## '''Folder''': \&lt;br /&gt;
# Click '''OK''' to create the script &lt;br /&gt;
# Copy the contents of the script below into the script and click '''Save'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The script should compile correctly if you check the log.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
// -----------------------------------------------------------------------------&lt;br /&gt;
// full_heal.nss&lt;br /&gt;
// -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;log_h&amp;quot;&lt;br /&gt;
#include &amp;quot;abi_templates&amp;quot;&lt;br /&gt;
#include &amp;quot;sys_traps_h&amp;quot;&lt;br /&gt;
#include &amp;quot;spell_constants_h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const int FULL_HEAL = 777777;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void _HandleImpact(struct EventSpellScriptImpactStruct stEvent)&lt;br /&gt;
{&lt;br /&gt;
   &lt;br /&gt;
    effect eEffect;&lt;br /&gt;
   &lt;br /&gt;
    //int bHostile = FALSE;&lt;br /&gt;
&lt;br /&gt;
    // make sure there is a location, just in case&lt;br /&gt;
    if (IsObjectValid(stEvent.oTarget) == TRUE)&lt;br /&gt;
    {&lt;br /&gt;
        stEvent.lTarget = GetLocation(stEvent.oTarget);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Handle Spells&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    switch (stEvent.nAbility)&lt;br /&gt;
    {       &lt;br /&gt;
&lt;br /&gt;
        case FULL_HEAL:&lt;br /&gt;
        {&lt;br /&gt;
            float fHeal = GetCreatureProperty(stEvent.oTarget,7,PROPERTY_VALUE_TOTAL);&lt;br /&gt;
            eEffect = EffectHeal(fHeal);&lt;br /&gt;
            eEffect = SetEffectEngineInteger(eEffect, EFFECT_INTEGER_VFX, Ability_GetImpactObjectVfxId(stEvent.nAbility));&lt;br /&gt;
            ApplyEffectOnObject(EFFECT_DURATION_TYPE_INSTANT, eEffect, stEvent.oTarget, 0.0f, stEvent.oCaster, stEvent.nAbility);&lt;br /&gt;
&lt;br /&gt;
            break;&lt;br /&gt;
        }&lt;br /&gt;
       &lt;br /&gt;
        &lt;br /&gt;
    }&lt;br /&gt;
   // if(bHostile) // sending only for hostile spells&lt;br /&gt;
        //SendEventOnCastAt(stEvent.oTarget, stEvent.oCaster, stEvent.nAbility, bHostile);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    event ev = GetCurrentEvent();&lt;br /&gt;
    int nEventType = GetEventType(ev);&lt;br /&gt;
&lt;br /&gt;
    switch(nEventType)&lt;br /&gt;
    {&lt;br /&gt;
        case EVENT_TYPE_SPELLSCRIPT_PENDING:&lt;br /&gt;
        {&lt;br /&gt;
            Ability_SetSpellscriptPendingEventResult(COMMAND_RESULT_SUCCESS);&lt;br /&gt;
&lt;br /&gt;
            break;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        case EVENT_TYPE_SPELLSCRIPT_CAST:&lt;br /&gt;
        {&lt;br /&gt;
            // Get a structure with the event parameters&lt;br /&gt;
            struct EventSpellScriptCastStruct stEvent = Events_GetEventSpellScriptCastParameters(ev);&lt;br /&gt;
&lt;br /&gt;
            // Hand this through to cast_impact&lt;br /&gt;
            SetAbilityResult(stEvent.oCaster, stEvent.nResistanceCheckResult);&lt;br /&gt;
&lt;br /&gt;
            break;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        case EVENT_TYPE_SPELLSCRIPT_IMPACT:&lt;br /&gt;
        {&lt;br /&gt;
            // Get a structure with the event parameters&lt;br /&gt;
            struct EventSpellScriptImpactStruct stEvent = Events_GetEventSpellScriptImpactParameters(ev);&lt;br /&gt;
&lt;br /&gt;
            Log_Trace(LOG_CHANNEL_COMBAT_ABILITY, GetCurrentScriptName() + &amp;quot;.EVENT_TYPE_SPELLSCRIPT_IMPACT&amp;quot;,Log_GetAbilityNameById(stEvent.nAbility));&lt;br /&gt;
&lt;br /&gt;
            // Handle impact&lt;br /&gt;
            if (CheckSpellResistance(stEvent.oTarget, stEvent.oCaster, stEvent.nAbility) == FALSE)&lt;br /&gt;
            {&lt;br /&gt;
                _HandleImpact(stEvent);&lt;br /&gt;
            } else&lt;br /&gt;
            {&lt;br /&gt;
                UI_DisplayMessage(stEvent.oTarget, UI_MESSAGE_RESISTED);&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            break;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Creating new Strings ==&lt;br /&gt;
&lt;br /&gt;
This step allows you to set your own description for the spell and have it appear correctly in tool tips. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Ensure your module is loaded in the toolset&lt;br /&gt;
# Select '''Tools''' &amp;gt; '''String Editor'''&lt;br /&gt;
# Right click in the empty space and select '''Insert''' &amp;gt; '''Insert String'''&lt;br /&gt;
# Set the '''Type''' to '''Spells'''&lt;br /&gt;
# Set the text to Divine Healer&lt;br /&gt;
# Click '''OK''' to save the string&lt;br /&gt;
# Make a note of the string ID generated and what it is for (in this case the Spell Type)&lt;br /&gt;
# Repeat the above steps for the following text (without the information in brackets):&lt;br /&gt;
&lt;br /&gt;
:: Full Heal (note it down as the spell name)&lt;br /&gt;
:: The mage channels divine energy to completely heal the target from all battle damage. (note it down as the description)&lt;br /&gt;
&lt;br /&gt;
The last string is for the tool tip, copy and paste the text below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;name/&amp;gt; (&amp;lt;guitypename/&amp;gt;)&lt;br /&gt;
&amp;lt;usetype/&amp;gt;&lt;br /&gt;
Range: &amp;lt;range/&amp;gt;&lt;br /&gt;
Activation: &amp;lt;cost/&amp;gt;&lt;br /&gt;
Cooldown: &amp;lt;cooldown/&amp;gt;s&lt;br /&gt;
&lt;br /&gt;
&amp;lt;requirements/&amp;gt;&lt;br /&gt;
&amp;lt;conditions/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;description/&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once these strings are all created select '''Tools''' &amp;gt; '''Export''' &amp;gt; '''Export Talk Table'''. This will compile your strings into a talk table which can be used with the game. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Updating your ability ==&lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Open your '''ABI_base_fh.GDA''' file with '''GDApp'''&lt;br /&gt;
# Set the '''namestrref''' field to the string ID for your spell name&lt;br /&gt;
# Set the '''descstrref''' field to the string ID for your spell description&lt;br /&gt;
# Set the '''tooltipstrref''' field to the string ID for your spell tooltip&lt;br /&gt;
# Set the '''cost''' to 50&lt;br /&gt;
# Set the '''spellscript''' to full_heal.ncs&lt;br /&gt;
# Set the '''cooldown''' to 20&lt;br /&gt;
# Save the file&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next we modify the guitype:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Open your '''guitypes_fh.GDA''' file with '''GDApp'''&lt;br /&gt;
# Set the '''stringid''' field to the string ID for your Spell Type&lt;br /&gt;
# Save the file&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
== Testing your new spell == &lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
With the developer console enabled, have your mage character selected and type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;` runscript addtalent 777777&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Advanced Topics ==&lt;br /&gt;
&lt;br /&gt;
I will try and expand this section a bit later, but for now once you are confident with these steps, try the following:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Change the icon for the spell to make it stand out more. You can use one from another spell or make your own&lt;br /&gt;
* Change the different values in ABI_base to alter the spell further&lt;br /&gt;
* Create a new talent using the same procedure but copy and modify a talent instead of a spell&lt;br /&gt;
* 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.&lt;/div&gt;</summary>
		<author><name>TrueKeaton</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Backgrounds_tutorial&amp;diff=12808</id>
		<title>Backgrounds tutorial</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Backgrounds_tutorial&amp;diff=12808"/>
				<updated>2010-03-29T15:17:06Z</updated>
		
		<summary type="html">&lt;p&gt;TrueKeaton: /* Modifying the 2DAs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This tutorial shows you how to modify the character backgrounds that can be selected during character generation. This is likely only of use if you are creating your own module or campaign as there would be no point to changing the background in the single player campaign unless you were also going to make extensive additions to support the new backgrounds  (e.g a completely new origin story). So the example we will use for this tutorial is a new stand alone module in which we completely replace the existing backgrounds. Changing backgrounds is especially useful if your module is set in a different lore to the main Dragon Age game or if you simply want to reduce the scope of the number of different backgrounds.&lt;br /&gt;
&lt;br /&gt;
We will also demonstrate some important principals that can be followed when modifying other core rules such as available races or classes. Most importantly we will add the new backgrounds in a way that doesn’t require any editing of core resources. By leaving the core resources alone we make our changes compatible with future patches which might otherwise overwrite our work. Furthermore keeping the core resources in tact allows us to make different modifications to different modules within the same toolset.&lt;br /&gt;
&lt;br /&gt;
It is recommended that the reader should have some experience with scripting or coding in order to carry out the operations involved. The more you are relying on just copy pasting these instructions the more likely you are to make mistakes that you won’t know how to fix.&lt;br /&gt;
&lt;br /&gt;
== The backgrounds demo module ==&lt;br /&gt;
Any basic module will do for the purposes of this tutorial. If you want to create a test module for this tutorial then just create a simple module with a single area and a starting location. Make sure that the only thing selected in the module’s hierarchy is ''Core game resources''. This will ensure that the module is a stand alone module rather than an add-in to the single player campaign or some other module. For the purposes of this tutorial we will assume the module is called ''Backgrounds demo'' and I will prefix my resources with ''bdm_'' to be sure that they are distinct from any that are already in existence.&lt;br /&gt;
&lt;br /&gt;
We are going to completely replace the existing backgrounds with 3 new ones of our own. You can use new backgrounds in your module however you see fit. You could create entire origin stories for each one like in the single player campaign (possibly a major undertaking depending on length) or you can just use them to influence dialogue and plot options in the main part of your game.&lt;br /&gt;
&lt;br /&gt;
For our demo we are creating a  module in which the player starts off in a small human village (we will not be creating the details of this module so this is just for the purpose of an example). There is a wizard in this village who plays a pivotal role in the story. We allow the player to start as the wizard’s apprentice (if they are a mage) or as his servant (if they are human or elven and not a mage) or as a wandering traveller who has come to visit the wizard (if they are not human and not a mage). So the three backgrounds will be:&lt;br /&gt;
&lt;br /&gt;
* Servant&lt;br /&gt;
* Apprentice&lt;br /&gt;
* Traveller&lt;br /&gt;
&lt;br /&gt;
== Creating the background strings ==&lt;br /&gt;
Before we start modifying the 2DA files we are going to create some strings. Open the string editor in the toolset and create the following strings in your ‘Backgrounds demo’ talk table:&lt;br /&gt;
&lt;br /&gt;
[[Image:Back_tut_talk_table.png]]&lt;br /&gt;
&lt;br /&gt;
Your string IDs might be different to these so be sure to reference the right string ID in the instructions that follow. Simply replace these string Ids with your own.&lt;br /&gt;
&lt;br /&gt;
'''IMPORTANT!''' ''There is currently a bug in the game that causes it to crash if a background description ID has a value greater than 109 912 680. To get around this you can go into your module’s properties and change the start and end IDs for strings to be less than that. After that the string editor will generate IDs in a range that won’t crash. You can always put those values back again after you create the background descriptions (that way you have less to alter once Bioware fix this). Hopefully Bioware will fix this bug soon as the official string range for non-Bioware / certified modules is over 610 000 000.''&lt;br /&gt;
&lt;br /&gt;
You may have noticed that we have given two different names and descriptions for the traveller background depending on the PC’s race. We will say more about that in the following section.&lt;br /&gt;
&lt;br /&gt;
{{TutorialRef|String editor}}&lt;br /&gt;
&lt;br /&gt;
== Modifying the 2DAs ==&lt;br /&gt;
The next thing we need to do is to modify the worksheets in backgrounds.xls. Be sure to make a copy of the spreadsheet first so that you leave the original intact. See LINK for general information about editing 2DA files. The first worksheet is called ‘backgrounds’; modify it to look like the following:&lt;br /&gt;
&lt;br /&gt;
[[Image:back_tut_backgrounds.png]]&lt;br /&gt;
&lt;br /&gt;
Note that since 2DAs combine together to form M2DAs, and we don’t want the existing backgrounds in our game, we have overwritten the last two slots as unused1 and unused2,  even though we won’t be using them. The name and desc  string refs on this tab will be overwritten by the race specific ones on the names tab so we can leave those blank (AFAIK these string refs are not used providing the ones on the names tab are provided - also the tooltip string ref seems not to be used anywhere – if you prefer you can set these to something just to be safe).&lt;br /&gt;
&lt;br /&gt;
The three race columns determine which backgrounds can be selected by which race and the 3 class columns determine which background can be selected by which class. So, as you can see from the picture our Servant background is accessible to elf or human warriors and rogues, the Apprentice background can be selected by elf or human mages and the Traveller background by elf or dwarf warriors and rogues.&lt;br /&gt;
&lt;br /&gt;
The last three tabs indicate a starting ability for each background by race. Note that by default these columns are not hooked up into the character generation script (instead they are hard coded in the script) and are not used, but we will correct that later on when we do the scripting. You have to be careful here because the columns relate to the race IDs, so 1=dwarf, 2=elf and 3=human, which is in a different order to the other race columns in this table. The number in the column is an ability ID as given in ABI_base.xls. For this demo we have just given the same skill for each race for a given background. Servants get combat tactics, Apprentices get persuade and Travellers get survival.&lt;br /&gt;
&lt;br /&gt;
The next tab table to modify is background_names.&lt;br /&gt;
&lt;br /&gt;
[[Image:back_tut_bg_names.png]]&lt;br /&gt;
&lt;br /&gt;
Make sure that the IDs here match the IDs in your string table. Note that for Apprentices and Servants we use the same strings regardless of race, but for the Traveller background we use different strings. This is to illustrate how you can divide a single background up into multiple names and descriptions. Internally they are both stored as the same background ID but during character generation a different name, description and icon can be shown to the player. In the single player game this was done with the Noble background by splitting it into human and dwarf Noble variations.&lt;br /&gt;
&lt;br /&gt;
NOTE – you must be careful when splitting a single background into different parts for each race. You must make both the names and descriptions different! If you don’t make the descriptions different then the engine will not recognise them as different even if they have different names.&lt;br /&gt;
&lt;br /&gt;
Now modify the background_desc table as follows&lt;br /&gt;
&lt;br /&gt;
[[Image:back_tut_bg_desc.png]]&lt;br /&gt;
&lt;br /&gt;
Again note the distinct descriptions for the Traveller background.&lt;br /&gt;
&lt;br /&gt;
Now for the background_icons table. For this demo we will just use some of the existing icons but you may want to create your own icons to add here.&lt;br /&gt;
&lt;br /&gt;
[[Image:back_tut_bg_icons.png]]&lt;br /&gt;
&lt;br /&gt;
The background_defaults table must have an entry for each race, background and class combination that is allowed. The ID column must be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
(1000 * raceID)  + (100 * classID) + backgroundID&lt;br /&gt;
&lt;br /&gt;
[[Image:back_tute_bg_defaults.png]]&lt;br /&gt;
&lt;br /&gt;
The label column should give a description of the row (AFAIK this is not used anywhere).&lt;br /&gt;
For this simple demo we will have each background combination spawn in the same place (the module default start location) but if you wanted different origins to spawn in different places then you can use the next two columns to specify this (AFAIK you have to write your own scripts to accomplish this though).&lt;br /&gt;
&lt;br /&gt;
In the template column you can put the name of a creature resource that you want to use as a template for this race/background/class combination. In the picture you can see that we have just used some default templates that shipped with the toolset but you can easily create your own. Note that only the inventory is copied across to the PC so if you want to create your own templates you do not need to alter anything on the creature except for their inventory.&lt;br /&gt;
&lt;br /&gt;
The name columns take string Ids. If you want to add your own names then you’ll have to create new strings in the string editor.&lt;br /&gt;
&lt;br /&gt;
Finally we have the ability column. As with the skill columns in the backgrounds table these IDs correspond to entries in the ABI_base.xls file. It should be noted that race, class and background are all possible sources of starting abilities so before you decide what to put in this column you should familiarise yourself with what skills are already being added in different parts of character generation in order to ensure that you don’t duplicate an ability somewhere.&lt;br /&gt;
&lt;br /&gt;
The final table is the chargen_preload table. The two columns here should exactly match the entries from the ID and Template columns of the previous table.&lt;br /&gt;
&lt;br /&gt;
[[Image:back_tut_chargen_preload.png]]&lt;br /&gt;
&lt;br /&gt;
{{TutorialRef|2DA|2DA#Excel file formatting|Background.xls}}&lt;br /&gt;
&lt;br /&gt;
== Compiling and fixing the GDAs ==&lt;br /&gt;
Now compile backgrounds.xls and place the resulting GDAs into your ''AddIns\module_name\module\override'' directory.&lt;br /&gt;
Never place anything in your ''AddIns\module_name\core\override'' directory or it will affect other modules than the one you are editing.&lt;br /&gt;
&lt;br /&gt;
There used to be a [[Bug: ExcelProcessor doesn't handle row IDs above 8.3 million correctly|bug]] that prevented large string IDs from compiling correctly. This is now fixed. For the record, the old workaround was to edit the GDA files in the toolset to correct the string IDs manually, but you should now see that the string IDs are correct.&lt;br /&gt;
&lt;br /&gt;
{{TutorialRef|Compiling 2DAs|GDA}}&lt;br /&gt;
&lt;br /&gt;
== Creating the backgrounds plot ==&lt;br /&gt;
The background plot is used for keeping track of a PC’s background and can be used to affect conversation options.&lt;br /&gt;
 &lt;br /&gt;
The single player game uses a plot called gen00pt_backgrounds to keep track of the PC background. You can find it in the ''\_Global\Generic'' folder of the plots tab if you want to take a look. We will create a similar plot for our custom backgrounds. Create a new plot and call it ''bdm_000pt_backgrounds'' (My naming convention is to use 000 to indicate a resource that isn’t tied to any particular area – feel free to use your own convention but remember to update any references later in the tutorial). Add main plot flags as indicated in the picture below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Back_tut_bg_plot.png]]&lt;br /&gt;
&lt;br /&gt;
You could also add some defined flags if you wanted. Defined flags can be used to return some combination of the main flags such as TRAVELLER or add some extra condition like FEMALE_APPRENTICE or ELVEN_APPRENTICE. Defined flags are beyond the scope of this tutorial however.&lt;br /&gt;
&lt;br /&gt;
{{TutorialRef|Designer Resources|Plot}}&lt;br /&gt;
&lt;br /&gt;
== Creating the scripts ==&lt;br /&gt;
We are not going to edit any of the original core game scripts, we will only be adding new scripts of our own. As we discuss how to do this you should examine the core scripts that are referred to, but under no circumstances should you make any changes to those files. By leaving the core scripts as they are we make our modification more compatible with any future patches that may be released. If you modified the core scripts and then a patch was released that overwrote those scripts you would lose your changes. Also keeping your modification contained within your own module allows you to make different modifications to different modules within the one toolset.&lt;br /&gt;
&lt;br /&gt;
Lets start off with a script to handle the character generation events that are normally handled by the module_core script. Create a new script called ''bdm_module_core''. It is up to you what directory structure to use for your scripts but it can be a good idea to keep all your scripts in a directory with your module name to make them distinct from the core scripts. Then if you are emulating the functionality of  a particular core script you can mirror the original directory structure underneath your main module folder. So in this case the module_core script is contained in the ''\_Core Scripts'' folder so we will put our bdm_module_core in ''\Backgrounds demo\_Core Scripts'' (the underscore ensures the core directories come first – looks like Bioware accidentally created one without it! I’m pretty sure Core and _Core are meant to be the same directory). Organising things this way will really help with keeping track of your scripts.&lt;br /&gt;
&lt;br /&gt;
The ''bdm_module_core'' script should contain the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
#include &amp;quot;global_objects_h&amp;quot;&lt;br /&gt;
void main(){&lt;br /&gt;
    event ev = GetCurrentEvent();&lt;br /&gt;
    int nEvent = GetEventType(ev); //extract event type from current event&lt;br /&gt;
    int nEventHandled = FALSE; //keep track of whether the event has been handled&lt;br /&gt;
    switch(nEvent){&lt;br /&gt;
        case EVENT_TYPE_MODULE_START:{&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            // Initiate character generation.&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            PreloadCharGen(); //preloads resources for character generation&lt;br /&gt;
            StartCharGen(GetHero(),0,TRUE); //initiates character generation&lt;br /&gt;
            break;&lt;br /&gt;
        }&lt;br /&gt;
        default:&lt;br /&gt;
        {&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            // Handle character generation events sent by the engine.&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            if ((nEvent &amp;gt;= EVENT_TYPE_CHARGEN_START &amp;amp;&amp;amp; nEvent &amp;lt;= EVENT_TYPE_CHARGEN_END) &lt;br /&gt;
                || nEvent == EVENT_TYPE_PLAYERLEVELUP )&lt;br /&gt;
            {&lt;br /&gt;
                HandleEvent(ev, R&amp;quot;bdm_sys_chargen.ncs&amp;quot;);&lt;br /&gt;
                nEventHandled = TRUE;&lt;br /&gt;
            }&lt;br /&gt;
            break;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
    if (!nEventHandled) { //If this event wasn't handled by this script, let the core script try&lt;br /&gt;
        HandleEvent(ev, RESOURCE_SCRIPT_MODULE_CORE);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go to ''file &amp;gt; manage modules'' and open the properties for your module and set the script property to point at this script.&lt;br /&gt;
&lt;br /&gt;
Our new script handles some of the events that are usually handled by the module_core script. Once it has handled the event it chooses whether or not to pass the event on to module_core. The first event that we handle is EVENT_TYPE_MODULE_START, which is where we initiate character generation. In this case we pass the event on to the core script to handle after we have done what we need to.&lt;br /&gt;
&lt;br /&gt;
The second thing we handle is actually a group of events. If you look in the module_core script you will see that right down the bottom in the default event handler is some code that looks just like the code we have added in our default event, with a couple of little differences. Instead of passing the character generation events to the sys_chargen.ncs script we are going to pass it to our own script called ''bdm_sys_chargen.ncs'' which we will write shortly. If we catch one of those character generation events then we want to handle it ourselves and prevent the core script from handling it so we set nEventHandled = TRUE. Note that any other event that is caught by the default handler but isn’t a character generation event is going to go straight on through to the core script.&lt;br /&gt;
&lt;br /&gt;
Before we create the ''bdm_sys_chargen'' script we are going to need some new constants defined. Create a new script called ''bdm_2da_constants_h'' and put it in folder ''\Backgrounds demo\_Core Includes''. Now add the following to this script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
// -----------------------------------------------------------------------------&lt;br /&gt;
// Backgrounds - rules/backgrounds.xls&lt;br /&gt;
// -----------------------------------------------------------------------------&lt;br /&gt;
const int BACKGROUND_SERVANT = 1;&lt;br /&gt;
const int BACKGROUND_APPRENTICE = 2;&lt;br /&gt;
const int BACKGROUND_TRAVELLER = 3;&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These constants provide a way for us to refer to the background IDs that we defined in the 2DA files without having to remember the numbers. Constants like this also make your code more readable.  If you need to add more new items to 2DAs when you are modding something else you can also add constants for them here. From now on we will be using these background constants instead of the original single player background constants that you can find in the ''2da_constants_h'' script. That means we’d better find all the places where those constants are used and update them with our own scripts.&lt;br /&gt;
&lt;br /&gt;
Create another new script and call it ''bdm_sys_chargen'' and put it in a folder called ''\Backgrounds demo\_Systems''. Put the following code in it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
#include &amp;quot;bdm_sys_chargen_h&amp;quot;&lt;br /&gt;
#include &amp;quot;log_h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
const int CHARGEN_QUICKSTART_QUICK = 0;&lt;br /&gt;
const int CHARGEN_QUICKSTART_NORMAL = 1;&lt;br /&gt;
const int CHARGEN_QUICKSTART_ADVANCED = 2;&lt;br /&gt;
&lt;br /&gt;
void _RunChargen(int nRace, int nClass, object oChar, int nBackground)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Chargen_InitializeCharacter(oChar);&lt;br /&gt;
    Chargen_SelectGender(oChar,GENDER_MALE);&lt;br /&gt;
    Chargen_SelectRace(oChar,nRace);&lt;br /&gt;
    Chargen_SelectCoreClass(oChar,nClass);&lt;br /&gt;
    Chargen_SelectBackground(oChar, nBackground,FALSE);&lt;br /&gt;
&lt;br /&gt;
    int nEquipIdx = Chargen_GetEquipIndex(nRace, nClass, nBackground);&lt;br /&gt;
    Chargen_InitInventory(oChar,0,nEquipIdx);&lt;br /&gt;
    Chargen_SpendAttributePoints(oChar,PROPERTY_ATTRIBUTE_STRENGTH, 3,FALSE);&lt;br /&gt;
    Chargen_SpendAttributePoints(oChar,PROPERTY_ATTRIBUTE_DEXTERITY, 2,FALSE);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void main(){&lt;br /&gt;
    event   ev              =   GetCurrentEvent();&lt;br /&gt;
    int     nEventType      =   GetEventType(ev);&lt;br /&gt;
    object  oChar           =   GetEventObject(ev,0);&lt;br /&gt;
&lt;br /&gt;
    int nMode;&lt;br /&gt;
    int nInt0 = GetEventInteger(ev,0);&lt;br /&gt;
    int nInt1 = GetEventInteger(ev,1);&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Debug Data.&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    Log_Trace(LOG_CHANNEL_EVENTS_CHARGEN,&amp;quot;bdm_sys_chargen&amp;quot;,&amp;quot;Chargen Event:&amp;quot; + Log_GetEventNameById (nEventType) &lt;br /&gt;
               + &amp;quot; &amp;quot; + ToString(nInt0) + &amp;quot;,&amp;quot; + ToString(nInt1), oChar);&lt;br /&gt;
&lt;br /&gt;
    int nEventHandled = FALSE;&lt;br /&gt;
&lt;br /&gt;
    switch (nEventType)&lt;br /&gt;
    {&lt;br /&gt;
        // ----------------------------------------------------------------------&lt;br /&gt;
        // This fires when the player selects the icon corresponding to any of&lt;br /&gt;
        // the available backgrounds&lt;br /&gt;
        //&lt;br /&gt;
        // nInt0 - Constant BACKGROUND_* integer&lt;br /&gt;
        // ----------------------------------------------------------------------&lt;br /&gt;
        case EVENT_TYPE_CHARGEN_SELECT_BACKGROUND: {&lt;br /&gt;
            int nBackground = nInt0;&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            // Set the background on the player and reinitialize plot flags&lt;br /&gt;
            // for the background&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            Chargen_InitializeCharacter(oChar,TRUE);&lt;br /&gt;
            Chargen_SelectGender(oChar,GetCreatureGender(oChar));&lt;br /&gt;
            Chargen_SelectRace(oChar,GetCreatureRacialType(oChar));&lt;br /&gt;
            Chargen_SelectCoreClass(oChar,GetCreatureCoreClass(oChar));&lt;br /&gt;
&lt;br /&gt;
            bdm_Chargen_SelectBackground(oChar, nBackground, FALSE);&lt;br /&gt;
            bdm_Chargen_SetupPlotFlags(oChar);&lt;br /&gt;
&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            // Generate the index into the equipment template 2da and&lt;br /&gt;
            // then load the starting equipment based on the data returned.&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            int nClass = GetCreatureCoreClass(oChar);&lt;br /&gt;
            int nRace = GetCreatureRacialType(oChar);&lt;br /&gt;
            int nEquipIdx = Chargen_GetEquipIndex(nRace, nClass, nBackground);&lt;br /&gt;
           Chargen_InitInventory(oChar,0,nEquipIdx);&lt;br /&gt;
            nEventHandled = TRUE;&lt;br /&gt;
            break;&lt;br /&gt;
        }&lt;br /&gt;
        case EVENT_TYPE_CHARGEN_END: {&lt;br /&gt;
            nMode = nInt0;&lt;br /&gt;
            int nQuickStart = nInt1;&lt;br /&gt;
            // 0 - quickstart&lt;br /&gt;
            // 1 - normal    \&lt;br /&gt;
            // 2 - advanced  / treat as the same&lt;br /&gt;
            Log_Trace(LOG_CHANNEL_CHARACTER,&amp;quot;bdm_sys_chargen&amp;quot;,&amp;quot;MODE: &amp;quot; + IntToString(nMode) &lt;br /&gt;
                       + &amp;quot;, Quick Start: &amp;quot; + IntToString(nQuickStart));&lt;br /&gt;
            if (nMode == CHARGEN_MODE_CREATE &amp;amp;&amp;amp; nQuickStart == CHARGEN_QUICKSTART_QUICK){&lt;br /&gt;
                Log_Trace(LOG_CHANNEL_CHARACTER,&amp;quot;bdm_sys_chargen&amp;quot;,&amp;quot;Setting default values for player character&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
                    int nRandClass = abs((GetLowResTimer()%3)+1);&lt;br /&gt;
&lt;br /&gt;
                    if(nRandClass == CLASS_ROGUE || nRandClass == CLASS_WARRIOR)&lt;br /&gt;
                    {&lt;br /&gt;
                        _RunChargen(RACE_HUMAN, nRandClass, oChar, BACKGROUND_SERVANT );&lt;br /&gt;
&lt;br /&gt;
                        WR_SetPlotFlag(PLT_BDM_000PT_BACKGROUNDS, BDM_GEN_BACK_SERVANT, TRUE);&lt;br /&gt;
                    }&lt;br /&gt;
                    else // mage&lt;br /&gt;
                    {&lt;br /&gt;
                        _RunChargen(RACE_HUMAN, nRandClass, oChar, BACKGROUND_APPRENTICE );&lt;br /&gt;
                        WR_SetPlotFlag(PLT_BDM_000PT_BACKGROUNDS, BDM_GEN_BACK_APPRENTICE, TRUE);&lt;br /&gt;
                    }&lt;br /&gt;
                    Chargen_SetNumTactics(oChar);&lt;br /&gt;
                    SetCanLevelUp(oChar,Chargen_HasPointsToSpend(oChar));&lt;br /&gt;
                    SendEventModuleChargenDone(&amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
                    nEventHandled = TRUE;&lt;br /&gt;
            }&lt;br /&gt;
            break;&lt;br /&gt;
        }&lt;br /&gt;
    }    //end switch&lt;br /&gt;
&lt;br /&gt;
    if (!nEventHandled){&lt;br /&gt;
        HandleEvent(ev, R&amp;quot;sys_chargen.ncs&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are two events in the original sys_chargen script that we need to replace because they deal with backgrounds. The first of these is EVENT_TYPE_CHARGEN_SELECT_BACKGROUND and the other is EVENT_TYPE_CHARGEN_END. For the second event we only need to change the case where the character is being created in quickstart mode, so we just handle that section of the code. The objective here is to change only as much as we need to and then pass any remaining events through to the original sys_chargen script. Take some time to compare the new script with Bioware’s ''sys_chargen'' script .&lt;br /&gt;
&lt;br /&gt;
You will notice that we include a script called ''bdm_sys_chargen_h'' and that we use some functions with a ''bdm_'' prefix. Those functions are contained in that include file which we’ll write now. Essentially these are modifications of a couple of functions from the ''sys_chargen_h'' include file. Create a new script and call it ''bdm_sys_chargen_h''. Put it in folder ''\Backgrounds demo\_Systems\Includes'' and add the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
#include &amp;quot;sys_chargen_h&amp;quot;&lt;br /&gt;
#include &amp;quot;bdm_2da_constants_h&amp;quot;&lt;br /&gt;
#include &amp;quot;wrappers_h&amp;quot;&lt;br /&gt;
#include &amp;quot;plt_bdm_000pt_backgrounds&amp;quot;&lt;br /&gt;
&lt;br /&gt;
void bdm_Chargen_SelectBackground(object oChar, int nBackground, int bUnApply = FALSE)&lt;br /&gt;
{&lt;br /&gt;
     Log_Chargen(&amp;quot;bdm_Chargen_SelectBackground&amp;quot;,&amp;quot;-- &amp;quot; + (bUnApply?&amp;quot;Un&amp;quot;:&amp;quot;&amp;quot;) +&amp;quot;Selecting BG: &amp;quot; + ToString(nBackground),oChar);&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // 1. Set the background variable&lt;br /&gt;
    //          - Create creature property (or check what we used so far&lt;br /&gt;
    //          - We don't set backgrounds on non player generated chars.&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (bUnApply)&lt;br /&gt;
    {&lt;br /&gt;
        SetCreatureProperty(oChar, PROPERTY_SIMPLE_BACKGROUND, 0.0, PROPERTY_VALUE_BASE);&lt;br /&gt;
    }&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
       SetCreatureProperty(oChar, PROPERTY_SIMPLE_BACKGROUND, IntToFloat(nBackground), PROPERTY_VALUE_BASE);&lt;br /&gt;
    }&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // 2. Give one skill&lt;br /&gt;
    //    - retrieve the skill that is granted by the background from backgrounds.xls&lt;br /&gt;
    //    - give it to the player.&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    int nAbility = ChargenGetBackgroundSkill(GetCreatureRacialType(oChar), nBackground);&lt;br /&gt;
    if (nAbility)&lt;br /&gt;
    {&lt;br /&gt;
        _AddAbility (oChar, nAbility, bUnApply);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void bdm_Chargen_SetupPlotFlags(object oChar)&lt;br /&gt;
{&lt;br /&gt;
    int nRace       =  GetCreatureRacialType(oChar);&lt;br /&gt;
    int nBackground = GetPlayerBackground(oChar);&lt;br /&gt;
&lt;br /&gt;
    Log_Trace(LOG_CHANNEL_CHARACTER,&amp;quot;bdm_sys_chargen_h&amp;quot;,&amp;quot;Setting plot flags, race: &amp;quot; &lt;br /&gt;
               + IntToString(nRace) + &amp;quot;, background: &amp;quot; + IntToString(nBackground));&lt;br /&gt;
&lt;br /&gt;
    // First, init all flags (debug setup)&lt;br /&gt;
    WR_SetPlotFlag(PLT_BDM_000PT_BACKGROUNDS, BDM_GEN_BACK_SERVANT,FALSE);&lt;br /&gt;
    WR_SetPlotFlag(PLT_BDM_000PT_BACKGROUNDS, BDM_GEN_BACK_APPRENTICE,FALSE);&lt;br /&gt;
    WR_SetPlotFlag(PLT_BDM_000PT_BACKGROUNDS, BDM_GEN_BACK_DWARF_TRAVELLER,FALSE);&lt;br /&gt;
    WR_SetPlotFlag(PLT_BDM_000PT_BACKGROUNDS, BDM_GEN_BACK_ELF_TRAVELLER,FALSE);&lt;br /&gt;
&lt;br /&gt;
    switch (nBackground)&lt;br /&gt;
    {&lt;br /&gt;
        case BACKGROUND_SERVANT:&lt;br /&gt;
        {&lt;br /&gt;
            WR_SetPlotFlag(PLT_BDM_000PT_BACKGROUNDS, BDM_GEN_BACK_SERVANT,TRUE); break;&lt;br /&gt;
            break;&lt;br /&gt;
        }&lt;br /&gt;
        case BACKGROUND_APPRENTICE:&lt;br /&gt;
        {&lt;br /&gt;
            WR_SetPlotFlag(PLT_BDM_000PT_BACKGROUNDS, BDM_GEN_BACK_APPRENTICE,TRUE); break;&lt;br /&gt;
            break;&lt;br /&gt;
        }&lt;br /&gt;
        case BACKGROUND_TRAVELLER:&lt;br /&gt;
        {&lt;br /&gt;
            switch(nRace)&lt;br /&gt;
            {&lt;br /&gt;
                case RACE_DWARF: WR_SetPlotFlag(PLT_BDM_000PT_BACKGROUNDS, BDM_GEN_BACK_DWARF_TRAVELLER,TRUE); break;&lt;br /&gt;
                case RACE_ELF: WR_SetPlotFlag(PLT_BDM_000PT_BACKGROUNDS, BDM_GEN_BACK_ELF_TRAVELLER,TRUE); break;&lt;br /&gt;
            }&lt;br /&gt;
            break;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lets examine these two functions. First you should compare them to their original versions. For ''bdm_Chargen_SelectBackground()'' we have actually made a more generic version of the function that should work with any backgrounds. We have removed the hard coded values for the background abilities and now use the function ChargenGetBackgroundSkill() which actually gets the background skill from the backgrounds 2DA file that we edited earlier (recall the last three columns that give a skill depending on background and race). If you need fancier logic than just reading the values form the GDA (e.g. like Bioware’s logic for the Noble background) then you can always go back to hard coding them the way Bioware did.&lt;br /&gt;
&lt;br /&gt;
The second function is ''bdm_Chargen_SetupPlotFlags()'' which does just what it says. Remember the plot we created earlier? Here we set the appropriate flag based on race and background.&lt;br /&gt;
&lt;br /&gt;
{{TutorialRef|Script}}&lt;br /&gt;
&lt;br /&gt;
== Testing that everything works ==&lt;br /&gt;
Now compile your scripts and export your module. Also, make sure that you export your talk table.&lt;br /&gt;
&lt;br /&gt;
'''IMPORTANT!''' ''Always make sure you empty your \Dragon Age\packages\core\override folder after doing an export. Due to a bug in the current toolset your single player game will become damaged if you don’t do this before playing.''&lt;br /&gt;
&lt;br /&gt;
You should now be able to run your game and see the backgrounds you created appear in character generation. If you want to test that the background plots have been set correctly, add an NPC to the start area and create a conversation for them in which each line is switched according to a background plot flag. You can also check that the character is receiving the abilities that we set in the 2DAs.&lt;br /&gt;
&lt;br /&gt;
'''NOTE''' ''There seems to be no way to change the popup message that comes up at the beginning of character generation. Altering the Pre-chargen string ID in the loadhints GDA does not seem to do anything.''&lt;br /&gt;
&lt;br /&gt;
{{TutorialRef|Exporting a module}}&lt;br /&gt;
&lt;br /&gt;
== Optional extras ==&lt;br /&gt;
There are a couple of other Bioware scripts that reference the background constants. They are not essential to modify because they are not used anywhere by default. The genev_tutorial script uses a background check but unless you plan on firing the tutorial from your module then you won’t have need of it. Also there is at least one debug script that makes use of the original single player backgrounds (to grant a background plot flag to the PC) so if you want similar debug functionality you may have to roll your own function.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
In this tutorial we have demonstrated a way to modify the backgrounds used in the game without altering any of the core scripts. It is expected that a similar approach could be taken to modding other aspects of the game such as adding classes or races. In these cases the scripts that were created in this tutorial could be extended to handle other parts of the character generation process such as class and race selection.&lt;br /&gt;
&lt;br /&gt;
[[Category:Character generation]]&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>TrueKeaton</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Backgrounds_tutorial&amp;diff=12718</id>
		<title>Backgrounds tutorial</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Backgrounds_tutorial&amp;diff=12718"/>
				<updated>2010-03-19T15:56:53Z</updated>
		
		<summary type="html">&lt;p&gt;TrueKeaton: /* Modifying the 2DAs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This tutorial shows you how to modify the character backgrounds that can be selected during character generation. This is likely only of use if you are creating your own module or campaign as there would be no point to changing the background in the single player campaign unless you were also going to make extensive additions to support the new backgrounds  (e.g a completely new origin story). So the example we will use for this tutorial is a new stand alone module in which we completely replace the existing backgrounds. Changing backgrounds is especially useful if your module is set in a different lore to the main Dragon Age game or if you simply want to reduce the scope of the number of different backgrounds.&lt;br /&gt;
&lt;br /&gt;
We will also demonstrate some important principals that can be followed when modifying other core rules such as available races or classes. Most importantly we will add the new backgrounds in a way that doesn’t require any editing of core resources. By leaving the core resources alone we make our changes compatible with future patches which might otherwise overwrite our work. Furthermore keeping the core resources in tact allows us to make different modifications to different modules within the same toolset.&lt;br /&gt;
&lt;br /&gt;
It is recommended that the reader should have some experience with scripting or coding in order to carry out the operations involved. The more you are relying on just copy pasting these instructions the more likely you are to make mistakes that you won’t know how to fix.&lt;br /&gt;
&lt;br /&gt;
== The backgrounds demo module ==&lt;br /&gt;
Any basic module will do for the purposes of this tutorial. If you want to create a test module for this tutorial then just create a simple module with a single area and a starting location. Make sure that the only thing selected in the module’s hierarchy is ''Core game resources''. This will ensure that the module is a stand alone module rather than an add-in to the single player campaign or some other module. For the purposes of this tutorial we will assume the module is called ''Backgrounds demo'' and I will prefix my resources with ''bdm_'' to be sure that they are distinct from any that are already in existence.&lt;br /&gt;
&lt;br /&gt;
We are going to completely replace the existing backgrounds with 3 new ones of our own. You can use new backgrounds in your module however you see fit. You could create entire origin stories for each one like in the single player campaign (possibly a major undertaking depending on length) or you can just use them to influence dialogue and plot options in the main part of your game.&lt;br /&gt;
&lt;br /&gt;
For our demo we are creating a  module in which the player starts off in a small human village (we will not be creating the details of this module so this is just for the purpose of an example). There is a wizard in this village who plays a pivotal role in the story. We allow the player to start as the wizard’s apprentice (if they are a mage) or as his servant (if they are human or elven and not a mage) or as a wandering traveller who has come to visit the wizard (if they are not human and not a mage). So the three backgrounds will be:&lt;br /&gt;
&lt;br /&gt;
* Servant&lt;br /&gt;
* Apprentice&lt;br /&gt;
* Traveller&lt;br /&gt;
&lt;br /&gt;
== Creating the background strings ==&lt;br /&gt;
Before we start modifying the 2DA files we are going to create some strings. Open the string editor in the toolset and create the following strings in your ‘Backgrounds demo’ talk table:&lt;br /&gt;
&lt;br /&gt;
[[Image:Back_tut_talk_table.png]]&lt;br /&gt;
&lt;br /&gt;
Your string IDs might be different to these so be sure to reference the right string ID in the instructions that follow. Simply replace these string Ids with your own.&lt;br /&gt;
&lt;br /&gt;
'''IMPORTANT!''' ''There is currently a bug in the game that causes it to crash if a background description ID has a value greater than 109 912 680. To get around this you can go into your module’s properties and change the start and end IDs for strings to be less than that. After that the string editor will generate IDs in a range that won’t crash. You can always put those values back again after you create the background descriptions (that way you have less to alter once Bioware fix this). Hopefully Bioware will fix this bug soon as the official string range for non-Bioware / certified modules is over 610 000 000.''&lt;br /&gt;
&lt;br /&gt;
You may have noticed that we have given two different names and descriptions for the traveller background depending on the PC’s race. We will say more about that in the following section.&lt;br /&gt;
&lt;br /&gt;
{{TutorialRef|String editor}}&lt;br /&gt;
&lt;br /&gt;
== Modifying the 2DAs ==&lt;br /&gt;
The next thing we need to do is to modify the worksheets in backgrounds.xls. Be sure to make a copy of the spreadsheet first so that you leave the original intact. See LINK for general information about editing 2DA files. The first worksheet is called ‘backgrounds’; modify it to look like the following:&lt;br /&gt;
&lt;br /&gt;
[[Image:back_tut_backgrounds.png]]&lt;br /&gt;
&lt;br /&gt;
Note that since 2DAs combine together to form M2DAs, and we don’t want the existing backgrounds in our game, we have overwritten the last two slots as unused1 and unused2,  even though we won’t be using them. The name and desc  string refs on this tab will be overwritten by the race specific ones on the names tab so we can leave those blank (AFAIK these string refs are not used providing the ones on the names tab are provided - also the tooltip string ref seems not to be used anywhere – if you prefer you can set these to something just to be safe).&lt;br /&gt;
&lt;br /&gt;
The three race columns determine which backgrounds can be selected by which race and the 3 class columns determine which background can be selected by which class. So, as you can see from the picture our Servant background is accessible to elf or human warriors and rogues, the Apprentice background can be selected by elf or human mages and the Traveller background by elf or dwarf warriors and rogues.&lt;br /&gt;
&lt;br /&gt;
The last three tabs indicate a starting ability for each background by race. Note that by default these columns are not hooked up into the character generation script (instead they are hard coded in the script) and are not used, but we will correct that later on when we do the scripting. You have to be careful here because the columns relate to the race IDs, so 1=dwarf, 2=elf and 3=human, which is in a different order to the other race columns in this table. The number in the column is an ability ID as given in ABI_base.xls. For this demo we have just given the same skill for each race for a given background. Servants get combat tactics, Apprentices get persuade and Travellers get survival.&lt;br /&gt;
&lt;br /&gt;
The next tab table to modify is background_names.&lt;br /&gt;
&lt;br /&gt;
[[Image:back_tut_bg_names.png]]&lt;br /&gt;
&lt;br /&gt;
Make sure that the IDs here match the IDs in your string table. Note that for Apprentices and Servants we use the same strings regardless of race, but for the Traveller background we use different strings. This is to illustrate how you can divide a single background up into multiple names and descriptions. Internally they are both stored as the same background ID but during character generation a different name, description and icon can be shown to the player. In the single player game this was done with the Noble background by splitting it into human and dwarf Noble variations.&lt;br /&gt;
&lt;br /&gt;
NOTE – you must be careful when splitting a single background into different parts for each race. You must make both the names and descriptions different! If you don’t make the descriptions different then the engine will not recognise them as different even if they have different names.&lt;br /&gt;
&lt;br /&gt;
Now modify the background_desc table as follows&lt;br /&gt;
&lt;br /&gt;
[[Image:back_tut_bg_desc.png]]&lt;br /&gt;
&lt;br /&gt;
Again note the distinct descriptions for the Traveller background.&lt;br /&gt;
&lt;br /&gt;
Now for the background_icons table. For this demo we will just use some of the existing icons but you may want to create your own icons to add here.&lt;br /&gt;
&lt;br /&gt;
[[Image:back_tut_bg_icons.png]]&lt;br /&gt;
&lt;br /&gt;
The background_defaults table must have an entry for each race, background and class combination that is allowed. The ID column must be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
1000 * raceID  + 100 * classID + backgroundID&lt;br /&gt;
&lt;br /&gt;
[[Image:back_tute_bg_defaults.png]]&lt;br /&gt;
&lt;br /&gt;
The label column should give a description of the row (AFAIK this is not used anywhere).&lt;br /&gt;
For this simple demo we will have each background combination spawn in the same place (the module default start location) but if you wanted different origins to spawn in different places then you can use the next two columns to specify this (AFAIK you have to write your own scripts to accomplish this though).&lt;br /&gt;
&lt;br /&gt;
In the template column you can put the name of a creature resource that you want to use as a template for this race/background/class combination. In the picture you can see that we have just used some default templates that shipped with the toolset but you can easily create your own. Note that only the inventory is copied across to the PC so if you want to create your own templates you do not need to alter anything on the creature except for their inventory.&lt;br /&gt;
&lt;br /&gt;
The name columns take string Ids. If you want to add your own names then you’ll have to create new strings in the string editor.&lt;br /&gt;
&lt;br /&gt;
Finally we have the ability column. As with the skill columns in the backgrounds table these IDs correspond to entries in the ABI_base.xls file. It should be noted that race, class and background are all possible sources of starting abilities so before you decide what to put in this column you should familiarise yourself with what skills are already being added in different parts of character generation in order to ensure that you don’t duplicate an ability somewhere.&lt;br /&gt;
&lt;br /&gt;
The final table is the chargen_preload table. The two columns here should exactly match the entries from the ID and Template columns of the previous table.&lt;br /&gt;
&lt;br /&gt;
[[Image:back_tut_chargen_preload.png]]&lt;br /&gt;
&lt;br /&gt;
{{TutorialRef|2DA|2DA#Excel file formatting|Background.xls}}&lt;br /&gt;
&lt;br /&gt;
== Compiling and fixing the GDAs ==&lt;br /&gt;
Now compile backgrounds.xls and place the resulting GDAs into your ''AddIns\module_name\module\override'' directory.&lt;br /&gt;
Never place anything in your ''AddIns\module_name\core\override'' directory or it will affect other modules than the one you are editing.&lt;br /&gt;
&lt;br /&gt;
There used to be a [[Bug: ExcelProcessor doesn't handle row IDs above 8.3 million correctly|bug]] that prevented large string IDs from compiling correctly. This is now fixed. For the record, the old workaround was to edit the GDA files in the toolset to correct the string IDs manually, but you should now see that the string IDs are correct.&lt;br /&gt;
&lt;br /&gt;
{{TutorialRef|Compiling 2DAs|GDA}}&lt;br /&gt;
&lt;br /&gt;
== Creating the backgrounds plot ==&lt;br /&gt;
The background plot is used for keeping track of a PC’s background and can be used to affect conversation options.&lt;br /&gt;
 &lt;br /&gt;
The single player game uses a plot called gen00pt_backgrounds to keep track of the PC background. You can find it in the ''\_Global\Generic'' folder of the plots tab if you want to take a look. We will create a similar plot for our custom backgrounds. Create a new plot and call it ''bdm_000pt_backgrounds'' (My naming convention is to use 000 to indicate a resource that isn’t tied to any particular area – feel free to use your own convention but remember to update any references later in the tutorial). Add main plot flags as indicated in the picture below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Back_tut_bg_plot.png]]&lt;br /&gt;
&lt;br /&gt;
You could also add some defined flags if you wanted. Defined flags can be used to return some combination of the main flags such as TRAVELLER or add some extra condition like FEMALE_APPRENTICE or ELVEN_APPRENTICE. Defined flags are beyond the scope of this tutorial however.&lt;br /&gt;
&lt;br /&gt;
{{TutorialRef|Designer Resources|Plot}}&lt;br /&gt;
&lt;br /&gt;
== Creating the scripts ==&lt;br /&gt;
We are not going to edit any of the original core game scripts, we will only be adding new scripts of our own. As we discuss how to do this you should examine the core scripts that are referred to, but under no circumstances should you make any changes to those files. By leaving the core scripts as they are we make our modification more compatible with any future patches that may be released. If you modified the core scripts and then a patch was released that overwrote those scripts you would lose your changes. Also keeping your modification contained within your own module allows you to make different modifications to different modules within the one toolset.&lt;br /&gt;
&lt;br /&gt;
Lets start off with a script to handle the character generation events that are normally handled by the module_core script. Create a new script called ''bdm_module_core''. It is up to you what directory structure to use for your scripts but it can be a good idea to keep all your scripts in a directory with your module name to make them distinct from the core scripts. Then if you are emulating the functionality of  a particular core script you can mirror the original directory structure underneath your main module folder. So in this case the module_core script is contained in the ''\_Core Scripts'' folder so we will put our bdm_module_core in ''\Backgrounds demo\_Core Scripts'' (the underscore ensures the core directories come first – looks like Bioware accidentally created one without it! I’m pretty sure Core and _Core are meant to be the same directory). Organising things this way will really help with keeping track of your scripts.&lt;br /&gt;
&lt;br /&gt;
The ''bdm_module_core'' script should contain the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
#include &amp;quot;global_objects_h&amp;quot;&lt;br /&gt;
void main(){&lt;br /&gt;
    event ev = GetCurrentEvent();&lt;br /&gt;
    int nEvent = GetEventType(ev); //extract event type from current event&lt;br /&gt;
    int nEventHandled = FALSE; //keep track of whether the event has been handled&lt;br /&gt;
    switch(nEvent){&lt;br /&gt;
        case EVENT_TYPE_MODULE_START:{&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            // Initiate character generation.&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            PreloadCharGen(); //preloads resources for character generation&lt;br /&gt;
            StartCharGen(GetHero(),0,TRUE); //initiates character generation&lt;br /&gt;
            break;&lt;br /&gt;
        }&lt;br /&gt;
        default:&lt;br /&gt;
        {&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            // Handle character generation events sent by the engine.&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            if ((nEvent &amp;gt;= EVENT_TYPE_CHARGEN_START &amp;amp;&amp;amp; nEvent &amp;lt;= EVENT_TYPE_CHARGEN_END) &lt;br /&gt;
                || nEvent == EVENT_TYPE_PLAYERLEVELUP )&lt;br /&gt;
            {&lt;br /&gt;
                HandleEvent(ev, R&amp;quot;bdm_sys_chargen.ncs&amp;quot;);&lt;br /&gt;
                nEventHandled = TRUE;&lt;br /&gt;
            }&lt;br /&gt;
            break;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
    if (!nEventHandled) { //If this event wasn't handled by this script, let the core script try&lt;br /&gt;
        HandleEvent(ev, RESOURCE_SCRIPT_MODULE_CORE);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go to ''file &amp;gt; manage modules'' and open the properties for your module and set the script property to point at this script.&lt;br /&gt;
&lt;br /&gt;
Our new script handles some of the events that are usually handled by the module_core script. Once it has handled the event it chooses whether or not to pass the event on to module_core. The first event that we handle is EVENT_TYPE_MODULE_START, which is where we initiate character generation. In this case we pass the event on to the core script to handle after we have done what we need to.&lt;br /&gt;
&lt;br /&gt;
The second thing we handle is actually a group of events. If you look in the module_core script you will see that right down the bottom in the default event handler is some code that looks just like the code we have added in our default event, with a couple of little differences. Instead of passing the character generation events to the sys_chargen.ncs script we are going to pass it to our own script called ''bdm_sys_chargen.ncs'' which we will write shortly. If we catch one of those character generation events then we want to handle it ourselves and prevent the core script from handling it so we set nEventHandled = TRUE. Note that any other event that is caught by the default handler but isn’t a character generation event is going to go straight on through to the core script.&lt;br /&gt;
&lt;br /&gt;
Before we create the ''bdm_sys_chargen'' script we are going to need some new constants defined. Create a new script called ''bdm_2da_constants_h'' and put it in folder ''\Backgrounds demo\_Core Includes''. Now add the following to this script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
// -----------------------------------------------------------------------------&lt;br /&gt;
// Backgrounds - rules/backgrounds.xls&lt;br /&gt;
// -----------------------------------------------------------------------------&lt;br /&gt;
const int BACKGROUND_SERVANT = 1;&lt;br /&gt;
const int BACKGROUND_APPRENTICE = 2;&lt;br /&gt;
const int BACKGROUND_TRAVELLER = 3;&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These constants provide a way for us to refer to the background IDs that we defined in the 2DA files without having to remember the numbers. Constants like this also make your code more readable.  If you need to add more new items to 2DAs when you are modding something else you can also add constants for them here. From now on we will be using these background constants instead of the original single player background constants that you can find in the ''2da_constants_h'' script. That means we’d better find all the places where those constants are used and update them with our own scripts.&lt;br /&gt;
&lt;br /&gt;
Create another new script and call it ''bdm_sys_chargen'' and put it in a folder called ''\Backgrounds demo\_Systems''. Put the following code in it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
#include &amp;quot;bdm_sys_chargen_h&amp;quot;&lt;br /&gt;
#include &amp;quot;log_h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
const int CHARGEN_QUICKSTART_QUICK = 0;&lt;br /&gt;
const int CHARGEN_QUICKSTART_NORMAL = 1;&lt;br /&gt;
const int CHARGEN_QUICKSTART_ADVANCED = 2;&lt;br /&gt;
&lt;br /&gt;
void _RunChargen(int nRace, int nClass, object oChar, int nBackground)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    Chargen_InitializeCharacter(oChar);&lt;br /&gt;
    Chargen_SelectGender(oChar,GENDER_MALE);&lt;br /&gt;
    Chargen_SelectRace(oChar,nRace);&lt;br /&gt;
    Chargen_SelectCoreClass(oChar,nClass);&lt;br /&gt;
    Chargen_SelectBackground(oChar, nBackground,FALSE);&lt;br /&gt;
&lt;br /&gt;
    int nEquipIdx = Chargen_GetEquipIndex(nRace, nClass, nBackground);&lt;br /&gt;
    Chargen_InitInventory(oChar,0,nEquipIdx);&lt;br /&gt;
    Chargen_SpendAttributePoints(oChar,PROPERTY_ATTRIBUTE_STRENGTH, 3,FALSE);&lt;br /&gt;
    Chargen_SpendAttributePoints(oChar,PROPERTY_ATTRIBUTE_DEXTERITY, 2,FALSE);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void main(){&lt;br /&gt;
    event   ev              =   GetCurrentEvent();&lt;br /&gt;
    int     nEventType      =   GetEventType(ev);&lt;br /&gt;
    object  oChar           =   GetEventObject(ev,0);&lt;br /&gt;
&lt;br /&gt;
    int nMode;&lt;br /&gt;
    int nInt0 = GetEventInteger(ev,0);&lt;br /&gt;
    int nInt1 = GetEventInteger(ev,1);&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // Debug Data.&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    Log_Trace(LOG_CHANNEL_EVENTS_CHARGEN,&amp;quot;bdm_sys_chargen&amp;quot;,&amp;quot;Chargen Event:&amp;quot; + Log_GetEventNameById (nEventType) &lt;br /&gt;
               + &amp;quot; &amp;quot; + ToString(nInt0) + &amp;quot;,&amp;quot; + ToString(nInt1), oChar);&lt;br /&gt;
&lt;br /&gt;
    int nEventHandled = FALSE;&lt;br /&gt;
&lt;br /&gt;
    switch (nEventType)&lt;br /&gt;
    {&lt;br /&gt;
        // ----------------------------------------------------------------------&lt;br /&gt;
        // This fires when the player selects the icon corresponding to any of&lt;br /&gt;
        // the available backgrounds&lt;br /&gt;
        //&lt;br /&gt;
        // nInt0 - Constant BACKGROUND_* integer&lt;br /&gt;
        // ----------------------------------------------------------------------&lt;br /&gt;
        case EVENT_TYPE_CHARGEN_SELECT_BACKGROUND: {&lt;br /&gt;
            int nBackground = nInt0;&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            // Set the background on the player and reinitialize plot flags&lt;br /&gt;
            // for the background&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            Chargen_InitializeCharacter(oChar,TRUE);&lt;br /&gt;
            Chargen_SelectGender(oChar,GetCreatureGender(oChar));&lt;br /&gt;
            Chargen_SelectRace(oChar,GetCreatureRacialType(oChar));&lt;br /&gt;
            Chargen_SelectCoreClass(oChar,GetCreatureCoreClass(oChar));&lt;br /&gt;
&lt;br /&gt;
            bdm_Chargen_SelectBackground(oChar, nBackground, FALSE);&lt;br /&gt;
            bdm_Chargen_SetupPlotFlags(oChar);&lt;br /&gt;
&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            // Generate the index into the equipment template 2da and&lt;br /&gt;
            // then load the starting equipment based on the data returned.&lt;br /&gt;
            // -----------------------------------------------------------------&lt;br /&gt;
            int nClass = GetCreatureCoreClass(oChar);&lt;br /&gt;
            int nRace = GetCreatureRacialType(oChar);&lt;br /&gt;
            int nEquipIdx = Chargen_GetEquipIndex(nRace, nClass, nBackground);&lt;br /&gt;
           Chargen_InitInventory(oChar,0,nEquipIdx);&lt;br /&gt;
            nEventHandled = TRUE;&lt;br /&gt;
            break;&lt;br /&gt;
        }&lt;br /&gt;
        case EVENT_TYPE_CHARGEN_END: {&lt;br /&gt;
            nMode = nInt0;&lt;br /&gt;
            int nQuickStart = nInt1;&lt;br /&gt;
            // 0 - quickstart&lt;br /&gt;
            // 1 - normal    \&lt;br /&gt;
            // 2 - advanced  / treat as the same&lt;br /&gt;
            Log_Trace(LOG_CHANNEL_CHARACTER,&amp;quot;bdm_sys_chargen&amp;quot;,&amp;quot;MODE: &amp;quot; + IntToString(nMode) &lt;br /&gt;
                       + &amp;quot;, Quick Start: &amp;quot; + IntToString(nQuickStart));&lt;br /&gt;
            if (nMode == CHARGEN_MODE_CREATE &amp;amp;&amp;amp; nQuickStart == CHARGEN_QUICKSTART_QUICK){&lt;br /&gt;
                Log_Trace(LOG_CHANNEL_CHARACTER,&amp;quot;bdm_sys_chargen&amp;quot;,&amp;quot;Setting default values for player character&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
                    int nRandClass = abs((GetLowResTimer()%3)+1);&lt;br /&gt;
&lt;br /&gt;
                    if(nRandClass == CLASS_ROGUE || nRandClass == CLASS_WARRIOR)&lt;br /&gt;
                    {&lt;br /&gt;
                        _RunChargen(RACE_HUMAN, nRandClass, oChar, BACKGROUND_SERVANT );&lt;br /&gt;
&lt;br /&gt;
                        WR_SetPlotFlag(PLT_BDM_000PT_BACKGROUNDS, BDM_GEN_BACK_SERVANT, TRUE);&lt;br /&gt;
                    }&lt;br /&gt;
                    else // mage&lt;br /&gt;
                    {&lt;br /&gt;
                        _RunChargen(RACE_HUMAN, nRandClass, oChar, BACKGROUND_APPRENTICE );&lt;br /&gt;
                        WR_SetPlotFlag(PLT_BDM_000PT_BACKGROUNDS, BDM_GEN_BACK_APPRENTICE, TRUE);&lt;br /&gt;
                    }&lt;br /&gt;
                    Chargen_SetNumTactics(oChar);&lt;br /&gt;
                    SetCanLevelUp(oChar,Chargen_HasPointsToSpend(oChar));&lt;br /&gt;
                    SendEventModuleChargenDone(&amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
                    nEventHandled = TRUE;&lt;br /&gt;
            }&lt;br /&gt;
            break;&lt;br /&gt;
        }&lt;br /&gt;
    }    //end switch&lt;br /&gt;
&lt;br /&gt;
    if (!nEventHandled){&lt;br /&gt;
        HandleEvent(ev, R&amp;quot;sys_chargen.ncs&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are two events in the original sys_chargen script that we need to replace because they deal with backgrounds. The first of these is EVENT_TYPE_CHARGEN_SELECT_BACKGROUND and the other is EVENT_TYPE_CHARGEN_END. For the second event we only need to change the case where the character is being created in quickstart mode, so we just handle that section of the code. The objective here is to change only as much as we need to and then pass any remaining events through to the original sys_chargen script. Take some time to compare the new script with Bioware’s ''sys_chargen'' script .&lt;br /&gt;
&lt;br /&gt;
You will notice that we include a script called ''bdm_sys_chargen_h'' and that we use some functions with a ''bdm_'' prefix. Those functions are contained in that include file which we’ll write now. Essentially these are modifications of a couple of functions from the ''sys_chargen_h'' include file. Create a new script and call it ''bdm_sys_chargen_h''. Put it in folder ''\Backgrounds demo\_Systems\Includes'' and add the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
#include &amp;quot;sys_chargen_h&amp;quot;&lt;br /&gt;
#include &amp;quot;bdm_2da_constants_h&amp;quot;&lt;br /&gt;
#include &amp;quot;wrappers_h&amp;quot;&lt;br /&gt;
#include &amp;quot;plt_bdm_000pt_backgrounds&amp;quot;&lt;br /&gt;
&lt;br /&gt;
void bdm_Chargen_SelectBackground(object oChar, int nBackground, int bUnApply = FALSE)&lt;br /&gt;
{&lt;br /&gt;
     Log_Chargen(&amp;quot;bdm_Chargen_SelectBackground&amp;quot;,&amp;quot;-- &amp;quot; + (bUnApply?&amp;quot;Un&amp;quot;:&amp;quot;&amp;quot;) +&amp;quot;Selecting BG: &amp;quot; + ToString(nBackground),oChar);&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // 1. Set the background variable&lt;br /&gt;
    //          - Create creature property (or check what we used so far&lt;br /&gt;
    //          - We don't set backgrounds on non player generated chars.&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    if (bUnApply)&lt;br /&gt;
    {&lt;br /&gt;
        SetCreatureProperty(oChar, PROPERTY_SIMPLE_BACKGROUND, 0.0, PROPERTY_VALUE_BASE);&lt;br /&gt;
    }&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
       SetCreatureProperty(oChar, PROPERTY_SIMPLE_BACKGROUND, IntToFloat(nBackground), PROPERTY_VALUE_BASE);&lt;br /&gt;
    }&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    // 2. Give one skill&lt;br /&gt;
    //    - retrieve the skill that is granted by the background from backgrounds.xls&lt;br /&gt;
    //    - give it to the player.&lt;br /&gt;
    // -------------------------------------------------------------------------&lt;br /&gt;
    int nAbility = ChargenGetBackgroundSkill(GetCreatureRacialType(oChar), nBackground);&lt;br /&gt;
    if (nAbility)&lt;br /&gt;
    {&lt;br /&gt;
        _AddAbility (oChar, nAbility, bUnApply);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void bdm_Chargen_SetupPlotFlags(object oChar)&lt;br /&gt;
{&lt;br /&gt;
    int nRace       =  GetCreatureRacialType(oChar);&lt;br /&gt;
    int nBackground = GetPlayerBackground(oChar);&lt;br /&gt;
&lt;br /&gt;
    Log_Trace(LOG_CHANNEL_CHARACTER,&amp;quot;bdm_sys_chargen_h&amp;quot;,&amp;quot;Setting plot flags, race: &amp;quot; &lt;br /&gt;
               + IntToString(nRace) + &amp;quot;, background: &amp;quot; + IntToString(nBackground));&lt;br /&gt;
&lt;br /&gt;
    // First, init all flags (debug setup)&lt;br /&gt;
    WR_SetPlotFlag(PLT_BDM_000PT_BACKGROUNDS, BDM_GEN_BACK_SERVANT,FALSE);&lt;br /&gt;
    WR_SetPlotFlag(PLT_BDM_000PT_BACKGROUNDS, BDM_GEN_BACK_APPRENTICE,FALSE);&lt;br /&gt;
    WR_SetPlotFlag(PLT_BDM_000PT_BACKGROUNDS, BDM_GEN_BACK_DWARF_TRAVELLER,FALSE);&lt;br /&gt;
    WR_SetPlotFlag(PLT_BDM_000PT_BACKGROUNDS, BDM_GEN_BACK_ELF_TRAVELLER,FALSE);&lt;br /&gt;
&lt;br /&gt;
    switch (nBackground)&lt;br /&gt;
    {&lt;br /&gt;
        case BACKGROUND_SERVANT:&lt;br /&gt;
        {&lt;br /&gt;
            WR_SetPlotFlag(PLT_BDM_000PT_BACKGROUNDS, BDM_GEN_BACK_SERVANT,TRUE); break;&lt;br /&gt;
            break;&lt;br /&gt;
        }&lt;br /&gt;
        case BACKGROUND_APPRENTICE:&lt;br /&gt;
        {&lt;br /&gt;
            WR_SetPlotFlag(PLT_BDM_000PT_BACKGROUNDS, BDM_GEN_BACK_APPRENTICE,TRUE); break;&lt;br /&gt;
            break;&lt;br /&gt;
        }&lt;br /&gt;
        case BACKGROUND_TRAVELLER:&lt;br /&gt;
        {&lt;br /&gt;
            switch(nRace)&lt;br /&gt;
            {&lt;br /&gt;
                case RACE_DWARF: WR_SetPlotFlag(PLT_BDM_000PT_BACKGROUNDS, BDM_GEN_BACK_DWARF_TRAVELLER,TRUE); break;&lt;br /&gt;
                case RACE_ELF: WR_SetPlotFlag(PLT_BDM_000PT_BACKGROUNDS, BDM_GEN_BACK_ELF_TRAVELLER,TRUE); break;&lt;br /&gt;
            }&lt;br /&gt;
            break;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lets examine these two functions. First you should compare them to their original versions. For ''bdm_Chargen_SelectBackground()'' we have actually made a more generic version of the function that should work with any backgrounds. We have removed the hard coded values for the background abilities and now use the function ChargenGetBackgroundSkill() which actually gets the background skill from the backgrounds 2DA file that we edited earlier (recall the last three columns that give a skill depending on background and race). If you need fancier logic than just reading the values form the GDA (e.g. like Bioware’s logic for the Noble background) then you can always go back to hard coding them the way Bioware did.&lt;br /&gt;
&lt;br /&gt;
The second function is ''bdm_Chargen_SetupPlotFlags()'' which does just what it says. Remember the plot we created earlier? Here we set the appropriate flag based on race and background.&lt;br /&gt;
&lt;br /&gt;
{{TutorialRef|Script}}&lt;br /&gt;
&lt;br /&gt;
== Testing that everything works ==&lt;br /&gt;
Now compile your scripts and export your module. Also, make sure that you export your talk table.&lt;br /&gt;
&lt;br /&gt;
'''IMPORTANT!''' ''Always make sure you empty your \Dragon Age\packages\core\override folder after doing an export. Due to a bug in the current toolset your single player game will become damaged if you don’t do this before playing.''&lt;br /&gt;
&lt;br /&gt;
You should now be able to run your game and see the backgrounds you created appear in character generation. If you want to test that the background plots have been set correctly, add an NPC to the start area and create a conversation for them in which each line is switched according to a background plot flag. You can also check that the character is receiving the abilities that we set in the 2DAs.&lt;br /&gt;
&lt;br /&gt;
'''NOTE''' ''There seems to be no way to change the popup message that comes up at the beginning of character generation. Altering the Pre-chargen string ID in the loadhints GDA does not seem to do anything.''&lt;br /&gt;
&lt;br /&gt;
{{TutorialRef|Exporting a module}}&lt;br /&gt;
&lt;br /&gt;
== Optional extras ==&lt;br /&gt;
There are a couple of other Bioware scripts that reference the background constants. They are not essential to modify because they are not used anywhere by default. The genev_tutorial script uses a background check but unless you plan on firing the tutorial from your module then you won’t have need of it. Also there is at least one debug script that makes use of the original single player backgrounds (to grant a background plot flag to the PC) so if you want similar debug functionality you may have to roll your own function.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
In this tutorial we have demonstrated a way to modify the backgrounds used in the game without altering any of the core scripts. It is expected that a similar approach could be taken to modding other aspects of the game such as adding classes or races. In these cases the scripts that were created in this tutorial could be extended to handle other parts of the character generation process such as class and race selection.&lt;br /&gt;
&lt;br /&gt;
[[Category:Character generation]]&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>TrueKeaton</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Adding_custom_items_to_custom_modules_tutorial&amp;diff=12715</id>
		<title>Adding custom items to custom modules tutorial</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Adding_custom_items_to_custom_modules_tutorial&amp;diff=12715"/>
				<updated>2010-03-18T18:24:37Z</updated>
		
		<summary type="html">&lt;p&gt;TrueKeaton: are != our&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This guide will show you the easiest way to create a custom item and add it to your inventory by using a console command '''runscript aa_give_item'''.&lt;br /&gt;
&lt;br /&gt;
There are people who say that using the default 'singleplayer' module is a source for future problems so we'll be using our own module.&lt;br /&gt;
&lt;br /&gt;
I hope this tutorial helps.&lt;br /&gt;
&lt;br /&gt;
Author: RandyG [mailto:randy@pcwinsupport.com Email Me]&lt;br /&gt;
&lt;br /&gt;
Revised by LazyMonk.&lt;br /&gt;
&lt;br /&gt;
Thanks LazyMonk, I'll probably add pictures later to make it easier&lt;br /&gt;
&lt;br /&gt;
== Things needed ==&lt;br /&gt;
*1. Dragon age origins game.&lt;br /&gt;
*2. Access to the console in-game ([http://dragonage.wikia.com/wiki/Console Instructions on accessing console]).&lt;br /&gt;
*3. Dragon age origins Toolset.&lt;br /&gt;
*4. Ability to follow instructions.&lt;br /&gt;
&lt;br /&gt;
== Creating a new module ==&lt;br /&gt;
*1. Open the toolset and click on '''File -&amp;gt; Manage Modules'''.&lt;br /&gt;
*2. Click '''New'''.&lt;br /&gt;
*3. Enter 'my_module' in ''Name'' and ''UID'' fields, ignore the rest. Click '''OK'''.&lt;br /&gt;
*4. Double-click 'my_module' that was added to the list.&lt;br /&gt;
&lt;br /&gt;
{{TutorialRef|Module|Module#Creating a new module}}&lt;br /&gt;
&lt;br /&gt;
== Creating an item ==&lt;br /&gt;
&lt;br /&gt;
*1. On the palette window select items (the sword icon).&lt;br /&gt;
*2. Choose an item under global.&lt;br /&gt;
*3. Right click on the item and select '''Duplicate'''.&lt;br /&gt;
*4. A window will popup, ignore all fields except resource name.&lt;br /&gt;
*5. Name your item in the resource name field (only letters, numbers and '_').&lt;br /&gt;
*6. In the main tab you will see your item, modify it to your liking. Editing the item's additional effects is in 'Item properties'.&lt;br /&gt;
*7. Once finished: click '''Tools -&amp;gt; save'''.&lt;br /&gt;
*8. look above at the tab's title, it should be '''custom_resource_name.uti''' (with your selected name).&lt;br /&gt;
*9. Right click on it again and select '''Export -&amp;gt; Export without dependent resources'''.&lt;br /&gt;
&lt;br /&gt;
{{TutorialRef|Designer Resources#Creating new resources|Item|Module#Exporting a module}}&lt;br /&gt;
&lt;br /&gt;
== Creating a script to summon your item ==&lt;br /&gt;
&lt;br /&gt;
*1. Click on '''File -&amp;gt; new -&amp;gt; Script'''.&lt;br /&gt;
*2. A window will popup, ignore all fields except resource name.&lt;br /&gt;
*3. Enter a custom name, '''aa_give_item''' (only letters, numbers and '_'), click Ok.&lt;br /&gt;
*4. Copy the following to the blank script window:&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
void main() {&lt;br /&gt;
  CreateItemOnObject(R&amp;quot;Item file.uti&amp;quot;, OBJECT_SELF, 1, &amp;quot;&amp;quot;, TRUE);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
*5. Replace '''Item file.uti''' with your '''custom_resource_name.uti''' (the title on your item's tab).&lt;br /&gt;
*6. Click '''File -&amp;gt; save''' (saving automatically compiles the script).&lt;br /&gt;
'''Notice:''' If you make more than one item you can duplicate the script line for each item with it's file name. No need for a script for every item.&lt;br /&gt;
&lt;br /&gt;
{{TutorialRef|Script}}&lt;br /&gt;
&lt;br /&gt;
== Last Steps ==&lt;br /&gt;
*1. Goto folder: My Documents\BioWare\Dragon Age\AddIns\my_module\core\override\toolsetexport.&lt;br /&gt;
*2. look for the '''custom_resource_name.uti''' file.&lt;br /&gt;
*3. Goto folder: My Documents\BioWare\Dragon Age\AddIns\my_module\module\override\toolsetexport.&lt;br /&gt;
*4. look for two files named '''aa_give_item''', of types '''nss''' and '''ncs'''.&lt;br /&gt;
*5. Move the '''uti''' and '''ncs''' to folder: My Documents\BioWare\Dragon Age\packages\core\override.&lt;br /&gt;
*6. Delete the '''nss''' file.&lt;br /&gt;
*7. Load a saved game and enter a console command '''runscript aa_give_item''' ([http://dragonage.wikia.com/wiki/Console Instructions on accessing console]). Comment - you may find that [[PRCSCR]] is a better method.&lt;br /&gt;
*8. Your custom item should be in your inventory. Enjoy.&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>TrueKeaton</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Follower_tutorial&amp;diff=12514</id>
		<title>Follower tutorial</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Follower_tutorial&amp;diff=12514"/>
				<updated>2010-03-11T21:35:23Z</updated>
		
		<summary type="html">&lt;p&gt;TrueKeaton: /* Create a New Hire Function Include */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Simple Follower Creation ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to create a follower that&lt;br /&gt;
&lt;br /&gt;
- Levels up with a default package&lt;br /&gt;
&lt;br /&gt;
- Can be chosen from the party picker&lt;br /&gt;
&lt;br /&gt;
- Can gain XP&lt;br /&gt;
&lt;br /&gt;
This guide assumes you know how to create a creature and are comfortable with basic scripting.&lt;br /&gt;
&lt;br /&gt;
You should only use this simple method if you are sure there will be empty space in the active party when your follower is recruited.&lt;br /&gt;
&lt;br /&gt;
A more comprehensive approach when there are more than three potential party members is discussed in the FAQ below. It's worth taking the time to understand the basics first, though. &lt;br /&gt;
&lt;br /&gt;
=== Create the creature ===&lt;br /&gt;
&lt;br /&gt;
Create a creature to act as your follower.  Set its name, appearance, gender, head morph, conversation, inventory etc as you want them to behave in-game.&lt;br /&gt;
&lt;br /&gt;
Set an appropriate '''Tag''' (you'll be using it a lot).  I suggest &amp;quot;party_charname&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Make sure you choose a '''Class'''.  For most followers this should be Rogue, Warrior or Wizard.&lt;br /&gt;
&lt;br /&gt;
[[File:class.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Under Package/Scaling set:&lt;br /&gt;
&lt;br /&gt;
'''General Package Type''' to be '''Party Members'''&lt;br /&gt;
&lt;br /&gt;
'''Package''' to be an appropriate value (probably &amp;quot;Generic - Wizard&amp;quot; or similar)&lt;br /&gt;
&lt;br /&gt;
'''Package AI''' (there should only be one choice)&lt;br /&gt;
&lt;br /&gt;
'''Rank''' to be '''Player'''&lt;br /&gt;
&lt;br /&gt;
[[File:package.jpg]]&lt;br /&gt;
&lt;br /&gt;
Save and export your character as normal.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Overlay char_stage ===&lt;br /&gt;
&lt;br /&gt;
In the official campaign, the party picker uses a special area called char_stage. Whether you're extending the official campaign or making a standalone campaign, there is a function that allows you to overlap the offical stage with your own, so that both stages are active simultaneously in game.&lt;br /&gt;
&lt;br /&gt;
In your resource palette, right-click char_stage under the Global folder and select Duplicate to make a copy of the stage with a new resource name, e.g. my_char_stage. In the resource properties, ensure that both Module and Owner Module are set to your module, and the folder of your choice.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:area_palette.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Create a new waypoint for your follower to appear on the party picker.  This waypoint '''must''' have a tag in the form of &amp;quot;char_&amp;quot; followed by the exact tag of your follower.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:char_stage.jpg]]&lt;br /&gt;
&lt;br /&gt;
In this example the tag of my follower is '''bc_party_miera''' so her waypoint tag must be '''char_bc_party_miera'''&lt;br /&gt;
&lt;br /&gt;
For a standalone module (such as in this example), put your waypoint wherever you please.  The illustrated one is directly on top of Morrigan's.  For an add-in to the main campaign, you should position your wp appropriately relative to the core party members.&lt;br /&gt;
&lt;br /&gt;
Save and export the area.&lt;br /&gt;
&lt;br /&gt;
Add the following to your module event script:&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
case EVENT_TYPE_MODULE_GETCHARSTAGE:&lt;br /&gt;
{&lt;br /&gt;
   // Overlay the existing stage with my stage&lt;br /&gt;
   // &amp;quot;my_char_stage&amp;quot; is the resource name of the overlay area&lt;br /&gt;
   // &amp;quot;partypicker&amp;quot; is the name of the default GDA&lt;br /&gt;
   SetPartyPickerStage(&amp;quot;my_char_stage&amp;quot;, &amp;quot;partypicker&amp;quot;);&lt;br /&gt;
   break;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Create m2DAs for the Party Picker ===&lt;br /&gt;
&lt;br /&gt;
You will need to create two Excel spreadsheets.&lt;br /&gt;
&lt;br /&gt;
The first should be named (both worksheet and file) '''partypicker_''' with a unique suffix.  In this example, my first spreadsheet is named partypicker_fofbc.xls with a worksheet name of partypicker_fofbc - the suffix being the acronym of my module.&lt;br /&gt;
&lt;br /&gt;
Set up your columns as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:partypickerm2da.jpg]]&lt;br /&gt;
&lt;br /&gt;
The '''ID''' for your follower must be '''12 or higher'''.  11 is the highest value used in the base 2DA.  12 is fine for standalone modules, add-ins will probably want to use an arbitrarily high number to avoid potential conflicts.&lt;br /&gt;
&lt;br /&gt;
The '''Label''' should be the follower's name as you wish it to appear on the party picker.&lt;br /&gt;
&lt;br /&gt;
The '''Tag''' must be your follower's tag.&lt;br /&gt;
&lt;br /&gt;
All other values are non-functioning defaults and should be specified as in the image above unless you know explicitly what you're doing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NOTE - ON SELECTION ANIMATIONS'''&lt;br /&gt;
 &lt;br /&gt;
Add Animation and Remove Animation are actually Id numbers of different animations, taken from anim_base.gda&lt;br /&gt;
&lt;br /&gt;
Enter and Exit version of animations are generally the best ones to use, altough one can try others. NOT ALL ANIMATIONS WILL WORK, since some require special conditions.&lt;br /&gt;
Here are some examples you can use:&lt;br /&gt;
&lt;br /&gt;
819 - talk cursing&lt;br /&gt;
&lt;br /&gt;
629 - reading a book (doesn't work, since it probably requires a book object)&lt;br /&gt;
&lt;br /&gt;
844 - hands behind back (848 and 849 are Enter and Exit versions respectfully)&lt;br /&gt;
&lt;br /&gt;
850 - chest pounding salute&lt;br /&gt;
&lt;br /&gt;
811 - fist pounding&lt;br /&gt;
&lt;br /&gt;
277 - dance&lt;br /&gt;
&lt;br /&gt;
247 - cast area spell&lt;br /&gt;
&lt;br /&gt;
500 - vfx cast&lt;br /&gt;
&lt;br /&gt;
600 - surprised&lt;br /&gt;
&lt;br /&gt;
603 - praying&lt;br /&gt;
&lt;br /&gt;
607 - head bow&lt;br /&gt;
&lt;br /&gt;
609 - standing at attention&lt;br /&gt;
&lt;br /&gt;
651,652 - crouch pray (Enter and exit)&lt;br /&gt;
&lt;br /&gt;
808 - point forward&lt;br /&gt;
&lt;br /&gt;
825 - nodding&lt;br /&gt;
&lt;br /&gt;
840 - hand chop or frustration&lt;br /&gt;
&lt;br /&gt;
905,906 - crouch (Enter, Exit)&lt;br /&gt;
&lt;br /&gt;
919,920 - sit on ground (enter, exit)&lt;br /&gt;
&lt;br /&gt;
965 - kneel down loop&lt;br /&gt;
&lt;br /&gt;
972 - wipe nose&lt;br /&gt;
&lt;br /&gt;
976,977 - squat (Enter, Exit)&lt;br /&gt;
&lt;br /&gt;
986 - wipe eyes&lt;br /&gt;
&lt;br /&gt;
998,999 - hands clasped (Enter, exit)&lt;br /&gt;
&lt;br /&gt;
3029 - inspect nails&lt;br /&gt;
&lt;br /&gt;
3031,3032 - playful (enter, exit)&lt;br /&gt;
&lt;br /&gt;
3054,3056 - slouch (enter, exit)&lt;br /&gt;
255 - in-place fly&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NOTE - ON SELECTION VFX''' &lt;br /&gt;
&lt;br /&gt;
The VFX column is the ID of the vFX effect taken from vFx_base.gda. This one is a bit more tricky, since it also references the BlendTree value from the same file.&lt;br /&gt;
Find the ID of the spell effect and look for the BlendTreeName column (should the the 12th columun) and enter BOTH into the respective columns for your character in the partypicker file.&lt;br /&gt;
&lt;br /&gt;
Some examples:&lt;br /&gt;
&lt;br /&gt;
ID      ---      BLENDTREENAME      ---   EFFECT&lt;br /&gt;
&lt;br /&gt;
6039    ---     fxm_energy_up_p    ---    Lady of the Forest pillar of light&lt;br /&gt;
&lt;br /&gt;
6040    ---     fxm_power_in_p      ---   Branka - power in&lt;br /&gt;
&lt;br /&gt;
3054    ---     fxc_lotf_c          ---   Lady of the Forest - swirling leaves&lt;br /&gt;
&lt;br /&gt;
3009    ---     fxc_succubus_c     ---    Succubus crust&lt;br /&gt;
&lt;br /&gt;
1549    ---     fxa_hly_imp_c       ---   Holy Impact crust&lt;br /&gt;
&lt;br /&gt;
1076    ---     fxa_spi_aur_mht_c   ---   Spirit - Aura Might crust&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second spreadsheet should be named '''party_picker_''' (note middle underscore).  Once again append your unique suffix (in this example party_picker_fofbc.xls with party_picker_fofbc as its worksheet).&lt;br /&gt;
&lt;br /&gt;
Set up your columns and data like so:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:party_pickerm2da.jpg]]&lt;br /&gt;
&lt;br /&gt;
'''ID''' and '''Tag''' should match what you did in the first spreadsheet.  Specify INVALID COLUMN for the third column.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you're familiar with m2DAs, generate them from these files, copy them to your module's override directory, and skip to the next step.  Otherwise, read on:&lt;br /&gt;
&lt;br /&gt;
- Go to '''\Program Files\Dragon Age\tools\ResourceBuild\Processors''' (or wherever you installed Dragon Age)&lt;br /&gt;
&lt;br /&gt;
- Copy '''ExcelProcessor.exe''' from that folder to whichever folder has the excel sheets you just created.&lt;br /&gt;
&lt;br /&gt;
- Drag and drop your xls files onto ExcelProcessor.  This will create .gda files.&lt;br /&gt;
&lt;br /&gt;
- Copy these .gda files to your module's export directory (probably \Documents\Bioware\Dragon Age\AddIns\yourModule\module\override\toolsetexport).  Make sure they are included in your .dazip when the time comes to build your module.&lt;br /&gt;
&lt;br /&gt;
If you are an OpenOffice user and have trouble with ExcelProcessor, you can use [http://social.bioware.com/project/755/ GDApp] to directly create the 2DAs.  It rocks!&lt;br /&gt;
&lt;br /&gt;
=== Capture the EVENT_TYPE_PARTYMEMBER_ADDED Event ===&lt;br /&gt;
&lt;br /&gt;
Amusingly enough, the Party Picker does not actually add followers to the party.  However it raises an event that allows you to do so.  Your module script needs to capture this event and execute some code.&lt;br /&gt;
&lt;br /&gt;
The following example shows what to do with the event.  The full script would work as a module script for an add-in (assuming it didn't need to do anything else), but otherwise you'll have to incorporate the event into your own module script.  &lt;br /&gt;
&lt;br /&gt;
If you're not sure how to set a module script, go to '''File''' then '''Manage Modules,''' select your module and click '''Properties.'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
#include &amp;quot;utility_h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    event ev = GetCurrentEvent();&lt;br /&gt;
    int nEventType = GetEventType(ev);&lt;br /&gt;
    switch(nEventType)&lt;br /&gt;
    {&lt;br /&gt;
        case EVENT_TYPE_PARTYMEMBER_ADDED:&lt;br /&gt;
        {&lt;br /&gt;
            object oFollower = GetEventObject(ev, 0);&lt;br /&gt;
            SetLocalInt(oFollower, CREATURE_REWARD_FLAGS, 0);  //Allows the follower to gain XP&lt;br /&gt;
            AddCommand(oFollower, CommandJumpToLocation(GetLocation(GetHero())));   //Ensures follower appears at PC's location.&lt;br /&gt;
            SetFollowerState(oFollower, FOLLOWER_STATE_ACTIVE);  //Adds follower to the active party&lt;br /&gt;
            break;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''SetFollowerState(oFollower, FOLLOWER_STATE_ACTIVE)''' is the key statement to add the follower to the active party.  You must have this.&lt;br /&gt;
&lt;br /&gt;
'''SetLocalInt(oFollower, CREATURE_REWARD_FLAGS, 0)''' is a bug-fix, as followers hired with UT_HireFollower() do not receive XP by default.  This statement fixes that, and I consider it best practice to keep it in this event to ensure it is always set.  You will not wish to do this if you want a follower that should not gain XP to be on the party picker.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that you do not need to intercept the corresponding event for a party member being removed - the party picker handles spawning/despawning, and thus will successfully remove members.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Remember to save and export your module script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you're not sure how to set a module script, go to '''File''' then '''Manage Modules,''' select your module and click '''Properties.'''  The module script is in the General category, as seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:module_script.jpg]]&lt;br /&gt;
&lt;br /&gt;
You can set this to any script you've created.  See [[Scripting tutorial]] and [[Character generation]] for more background and some simple examples of event-handling scripts.  In general, you will want to make sure standalone module scripts pass events through to module_core (as in the [[Character generation]] examples) and add-in scripts do not (as in the example above).&lt;br /&gt;
&lt;br /&gt;
=== Create Your Hiring Script ===&lt;br /&gt;
&lt;br /&gt;
Now all that remains is to actually hire the follower :)&lt;br /&gt;
&lt;br /&gt;
Create a script to handle the hiring (which will most likely be fired from a conversation).  The script is quite simple:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
#include &amp;quot;utility_h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
void main() {&lt;br /&gt;
&lt;br /&gt;
        object oFollower = GetObjectByTag(&amp;quot;bc_party_miera&amp;quot;); //Use CreateObject() if the creature isn't present in the module yet&lt;br /&gt;
&lt;br /&gt;
        UT_HireFollower(oFollower);   //Hires the follower&lt;br /&gt;
&lt;br /&gt;
        SetPartyPickerGUIStatus(2);&lt;br /&gt;
&lt;br /&gt;
        ShowPartyPickerGUI();  //Shows the Party Picker; necessary for the follower to gain XP&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure you use your own follower's tag and not the example one :)&lt;br /&gt;
&lt;br /&gt;
This script fires the party picker after hiring the follower.  That is absolutely necessary via this method, as we have put the XP fix onto an event fired by the party picker.  You cannot put the XP fix into this script, it must be called from a later one (the bug is caused by an errant call to an event in player_core, which will be executed AFTER this script).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The easiest way to use this script is directly from conversation, putting it as an action on a line of dialogue where the PC invites the follower to join them.  If you're not sure how to associate a script with a dialogue line, see the following image:&lt;br /&gt;
&lt;br /&gt;
[[File:hire_conv.jpg]]&lt;br /&gt;
&lt;br /&gt;
Create your dialogue as normal, select the line you want to fire the script, and click the '''Plots and Scripting''' tab.  Use the '''Script''' file chooser in the Action section to browse to the script you created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If everything worked, you should see something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:picker_success.jpg|thumb|200px|center]]&lt;br /&gt;
&lt;br /&gt;
== Advanced Follower Creation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Follow these steps to have full control over the creation of your follower, with options such as:&lt;br /&gt;
&lt;br /&gt;
- Unique level-up template&lt;br /&gt;
&lt;br /&gt;
- Class and specialisation chosen via script&lt;br /&gt;
&lt;br /&gt;
- Any starting state&lt;br /&gt;
&lt;br /&gt;
- Level higher than the PC&lt;br /&gt;
&lt;br /&gt;
- Starts with a specialisation point rather than a specific specialisation&lt;br /&gt;
&lt;br /&gt;
- Set plot flags in the call to the hire script&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Prepare Creature, char_stage and Party Picker m2DAs ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Follow the same steps to create your follower creature, char_stage and Party Picker m2DAs as above.&lt;br /&gt;
&lt;br /&gt;
=== Create Party Plot ===&lt;br /&gt;
&lt;br /&gt;
While not necessary, it's very helpful to have plot flags set when a follower is hired or joins/leaves the active party.  This makes conversation interjections and the like very easy.&lt;br /&gt;
&lt;br /&gt;
Create a plot with appropriate flags.  There's no real need to associate journal text with them:&lt;br /&gt;
&lt;br /&gt;
[[File:follower_plot.jpg]]&lt;br /&gt;
&lt;br /&gt;
See FAQ for an alternative approach to plots when there are more than three potential party members.&lt;br /&gt;
&lt;br /&gt;
=== Add Plot Flags to Party Picker Event Intercept ===&lt;br /&gt;
&lt;br /&gt;
We then update our module script to make use of that plot, like so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
#include &amp;quot;utility_h&amp;quot;&lt;br /&gt;
#include &amp;quot;wrappers_h&amp;quot;&lt;br /&gt;
#include &amp;quot;plt_bc_create_party&amp;quot;   //make sure you include your own plot, not mine&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    event ev = GetCurrentEvent();&lt;br /&gt;
    int nEventType = GetEventType(ev);&lt;br /&gt;
    switch(nEventType)&lt;br /&gt;
    {&lt;br /&gt;
        case EVENT_TYPE_PARTYMEMBER_ADDED:&lt;br /&gt;
        {&lt;br /&gt;
            object oFollower = GetEventObject(ev, 0);&lt;br /&gt;
            SetLocalInt(oFollower, CREATURE_REWARD_FLAGS, 0);&lt;br /&gt;
            SetFollowerState(oFollower, FOLLOWER_STATE_ACTIVE);&lt;br /&gt;
&lt;br /&gt;
            AddCommand(oFollower, CommandJumpToLocation(GetLocation(GetHero())));   //Ensures follower appears at PC's location.&lt;br /&gt;
            &lt;br /&gt;
            if (GetTag(oFollower) == &amp;quot;bc_party_miera&amp;quot;) {               //You must explicitly test for your follower's tag.&lt;br /&gt;
                WR_SetPlotFlag(PLT_BC_CREATE_PARTY, PARTY_MIERA_IN_PARTY, TRUE);     //Make sure you use your own flags!&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            break;&lt;br /&gt;
        }  &lt;br /&gt;
        &lt;br /&gt;
        case EVENT_TYPE_PARTYMEMBER_DROPPED:                    &lt;br /&gt;
        {&lt;br /&gt;
              object oFollower = GetEventObject(ev, 0); &lt;br /&gt;
              &lt;br /&gt;
              if (GetTag(oFollower) == &amp;quot;bc_party_miera&amp;quot;) { &lt;br /&gt;
                WR_SetPlotFlag(PLT_BC_CREATE_PARTY, PARTY_MIERA_IN_PARTY, FALSE);     //As above, but set false.&lt;br /&gt;
              }&lt;br /&gt;
            &lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Create a Level Up Template ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can skip this step if you're content to use one of the generic Rogue, Wizard or Warrior templates, but I don't recommend it.  Making a template that suits your character is easy and will almost always be better for the player than a generic one that spends points poorly.&lt;br /&gt;
&lt;br /&gt;
Go to \Program Files\Dragon Age\tools\Source\2DA (or wherever you installed Dragon Age).&lt;br /&gt;
&lt;br /&gt;
You should see a number of excel sheets of the form '''ALCharacter.xls''' (such as ALAlistair.xls, ALLeliana.xls, ALRogue_Default.xls etc).  Open the one closest to your character (ie Morrigan or Wynne for a wizard, Leliana or Zevran for a rogue).  Save a copy as '''ALYourcharacter.xls''' in whatever directory you're using to create your 2DAs, remembering to rename the worksheet '''ALYourcharacter''' (in this example, ALMiera.xls with ALMiera as its worksheet).&lt;br /&gt;
&lt;br /&gt;
It should look something like this:&lt;br /&gt;
&lt;br /&gt;
[[File:ALtable.jpg|thumb|500px|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Columns B''' and '''C''' are the talents/spells available to this character.  Do not change them.&lt;br /&gt;
&lt;br /&gt;
'''Columns F''' and '''G''' are the skills available to this character.  Do not change them.&lt;br /&gt;
&lt;br /&gt;
We will edit the remaining columns like so:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Setting Stat Weights ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The stat weights in '''column J''' determine how the follower will spend their attribute points, in a rough ratio.  So if Dexterity is set to 1.5 and Intelligence to 1, you should expect to see 3 points of Dex for every 2 points of Cunning in-game (note Intelligence is the label used in the toolset for Cunning).&lt;br /&gt;
&lt;br /&gt;
Simply change the values in J to reflect how you'd like the character to spend their points.  In this example we're creating a wizard, so we're not going to mess around:&lt;br /&gt;
&lt;br /&gt;
[[File:miera_stat_weights.jpg]]&lt;br /&gt;
&lt;br /&gt;
This character will only raise magic.  I set the value to 5 rather than something like 1 to provide room underneath for the other stats while still overwhelmingly favouring magic, but in practice I only really ever want that one stat. &lt;br /&gt;
&lt;br /&gt;
In a note left on this column in the existing templates, Bioware's Georg Zoeller writes, &amp;quot;This is the weight of each attribute (row id links into properties.xls.id). 1.0 means 'try to keep this attribute level' (spend 1 point per level). 0.5 means 'try to spend 1 point every two levels' and so on.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The default Mage, Rogue and Warrior templates include '''column L''' labeled &amp;quot;AttInit.&amp;quot; Editing these values seems to have no effect on followers set to use these templates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Setting Talent and Skill Priorities ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Columns D''' and '''E''' are the talents/spells that the character will buy, in preference order from top to bottom.&lt;br /&gt;
&lt;br /&gt;
'''Columns H''' and '''I''' are the skills that the character will buy, in preference order from top to bottom.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To change these, just copy the appropriate two cells from columns B&amp;amp;C or F&amp;amp;G over the ones you want to replace.&lt;br /&gt;
&lt;br /&gt;
For example, here we're copying Morrigan's template.  Morrigan has Spider Shape high in her preferences, which we do not want.&lt;br /&gt;
&lt;br /&gt;
[[File:AlMori_talent_pref.jpg]]&lt;br /&gt;
&lt;br /&gt;
We decide we'd prefer Flame Blast, so we find it in columns B&amp;amp;C and copy both cells:&lt;br /&gt;
&lt;br /&gt;
[[File:ALMori_copy.jpg]]&lt;br /&gt;
&lt;br /&gt;
Then we select the cells we want to replace in columns D&amp;amp;E and paste over them:&lt;br /&gt;
&lt;br /&gt;
[[File:ALMori_paste.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Continue this process until your priorities list for both skills and talents/spells is exactly as you want it.  Make sure you have at least as many priorities as the core follower you're copying - points that cannot be spent according to these priorities have a habit of vanishing.&lt;br /&gt;
&lt;br /&gt;
If you used any abilities from a specialisation, make sure you remember to set that specialisation with the function we'll introduce later.  The autolevel scripts will add specialisation abilities to a character regardless of whether they have that spec or not.&lt;br /&gt;
&lt;br /&gt;
==== Create a M2DA_base_ m2DA ====&lt;br /&gt;
&lt;br /&gt;
Dragon Age will need to know where to find your autolevel template.  We tell it by extending M2DA_base.gda&lt;br /&gt;
&lt;br /&gt;
Create a spreadsheet with the name and worksheet name in the form '''M2DA_base_''' with your unique suffix (in this example, M2DA_base_fofbc.xls with M2DA_base_fofbc as a worksheet).&lt;br /&gt;
&lt;br /&gt;
Set up its columns and data like so (note I used GDApp because Open Office wasn't cooperating for this one!):&lt;br /&gt;
&lt;br /&gt;
[[File:m2da_base_fofbc.jpg]]&lt;br /&gt;
&lt;br /&gt;
The '''ID''' should be very high to avoid conflicts.  I've arbitrarily chosen 50,000+ here.  Carefully note the ID you've chosen for your character, you will need it later.&lt;br /&gt;
&lt;br /&gt;
Set the '''Label''' and '''Worksheet''' to be the name of your autolevel template worksheet (ALCharactername if you've been following this).&lt;br /&gt;
&lt;br /&gt;
Set the '''PackageIDForAI''' to be 0, it shouldn't be needed for followers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When you're done, use ExcelProcessor to make GDAs of both spreadsheets and copy them to your module's export folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FOR AUTOLEVEL TO WORK AFTER RECRUITING:&lt;br /&gt;
&lt;br /&gt;
Look in packages.xls. &lt;br /&gt;
There is a column called LevelupTable. That links to a corresponding AL* table. For instance,  row 81 is for Leliana. Her LevelupTable value is 258. If you look that up in 2DA_base, you'll see it links to ALLeliana.&lt;br /&gt;
(alternatively, you could try packages_base.gda)&lt;br /&gt;
&lt;br /&gt;
=== Create a New Hire Function Include ===&lt;br /&gt;
&lt;br /&gt;
Many vital steps of follower addition happen inside an event in player_core.  Followers tend to be extremely buggy (no skill tree, for example) if this event does not fire.&lt;br /&gt;
&lt;br /&gt;
However, that event is not very flexible.  In order to control it to our requirements, we need to replicate its functionality inside our own script.  This is probably much safer than messing with player_core directly!&lt;br /&gt;
&lt;br /&gt;
Create a new script file, naming it something like '''hireCustomFollower_h'''.  We will be including this wherever we want to hire a follower.&lt;br /&gt;
&lt;br /&gt;
Paste in the following script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
#include &amp;quot;sys_chargen_h&amp;quot;&lt;br /&gt;
#include &amp;quot;wrappers_h&amp;quot;&lt;br /&gt;
#include &amp;quot;utility_h&amp;quot;&lt;br /&gt;
#include &amp;quot;sys_rewards_h&amp;quot;&lt;br /&gt;
#include &amp;quot;approval_h&amp;quot;&lt;br /&gt;
#include &amp;quot;sys_autolevelup_h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/*  Jye Nicolson 5-Jan-2010&lt;br /&gt;
This function set duplicates the full functionality chain of UT_HireFollower, with the following exceptions:&lt;br /&gt;
&lt;br /&gt;
-  Followers can gain XP&lt;br /&gt;
-  Autolevel status can be set (default off)&lt;br /&gt;
-  Followers can be set to any starting state (default Available) and will still be properly initalised and added to the party pool&lt;br /&gt;
-  Autolevel tables for non-core followers can be explicitly set.&lt;br /&gt;
-  Class and Specialisation can be chosen via script&lt;br /&gt;
-  Followers without specialisations are granted a spec point by default.&lt;br /&gt;
&lt;br /&gt;
It should only ever be called once each for characters you intend to be full followers.&lt;br /&gt;
Much of the protective code handling summoned creatures etc. in player_core is not present here.&lt;br /&gt;
&lt;br /&gt;
Calling the function:&lt;br /&gt;
&lt;br /&gt;
Simple:&lt;br /&gt;
&lt;br /&gt;
hireCustomFollower(oFollower, CLASS_WARRIOR);&lt;br /&gt;
&lt;br /&gt;
Change the class to CLASS_WIZARD or CLASS_ROGUE as appropriate.  &lt;br /&gt;
This will hire your follower and make them available.  &lt;br /&gt;
They will auto level up with a default package, and receive a free spec point.&lt;br /&gt;
&lt;br /&gt;
Best Practice:&lt;br /&gt;
&lt;br /&gt;
hireCustomFollower(oFollower, CLASS_WARRIOR, PLT_YOUR_PARTY_PLOT, YOUR_FOLLOWER_JOINED_FLAG, ABILITY_TALENT_HIDDEN_CHAMPION);&lt;br /&gt;
&lt;br /&gt;
Where the plot and flag are those for your module (remember to create the plot and include it on the calling script), and ABILITY_TALENT_HIDDEN etc is the desired spec.&lt;br /&gt;
&lt;br /&gt;
You should also have a custom ALTable set up.  &lt;br /&gt;
See wiki for details, and remember to edit it in to GetCustomFollowerALTable below or pass it directly as an argument to hireCustomFollower.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Full argument list:&lt;br /&gt;
&lt;br /&gt;
void hireCustomFollower (&lt;br /&gt;
        object oFollower,   //Pass your follower object, mandatory&lt;br /&gt;
        &lt;br /&gt;
        int nForceClass,    //Pass a Class constant here, usually CLASS_ROGUE, CLASS_WARRIOR, CLASS_WIZARD.  Mandatory due to a bug.&lt;br /&gt;
        &lt;br /&gt;
        string sPlot = &amp;quot;&amp;quot;,   //It's recommended you have a plot flag to be set when the follower joins.  Pass the plot constant here.  Remember to #include in calling script&lt;br /&gt;
        &lt;br /&gt;
        int nPlotFlag = &amp;quot;&amp;quot;,  //And then pass the flag constant.  Will be set to TRUE if available.&lt;br /&gt;
        &lt;br /&gt;
        int nForceSpec = 0,  //This is the ID of the Specialisation you want.  Note they are NOT classes, but abilities.  The full list is:&lt;br /&gt;
                             //ABILITY_SPELL_HIDDEN_ARCANE_WARRIOR, ABILITY_SPELL_HIDDEN_BLOODMAGE, ABILITY_SPELL_HIDDEN_SHAPESHIFTER, ABILITY_SPELL_HIDDEN_SPIRIT_HEALER&lt;br /&gt;
                             //ABILITY_SPELL_HIDDEN_BARD, ABILITY_TALENT_HIDDEN_ASSASSIN, ABILITY_TALENT_HIDDEN_DUELIST, ABILITY_TALENT_HIDDEN_RANGER&lt;br /&gt;
                             //ABILITY_TALENT_HIDDEN_BERSERKER, ABILITY_TALENT_HIDDEN_CHAMPION, ABILITY_TALENT_HIDDEN_REAVER, ABILITY_TALENT_HIDDEN_TEMPLAR&lt;br /&gt;
                             //I recommended forcing a spec, particularly if your ALTable includes abilities from one.&lt;br /&gt;
        &lt;br /&gt;
        int nALTable = 0,    //This is the ID of an ALTable from 2DA_base.GDA or your module's m2DA_base_*.GDA  I recommended the latter, but you can edit that into GetCustomFollowerALTable below rather than passing it.&lt;br /&gt;
        &lt;br /&gt;
        int bInvokePicker = FALSE,  //Sets whether the party picker should be opened on hiring.  I think it's cleaner to call the picker outside this script, particularly if you have multiple hires at once.&lt;br /&gt;
        &lt;br /&gt;
        int nInitialState = FOLLOWER_STATE_AVAILABLE,  //This sets whether the follower joins the active party or not.  Options are:&lt;br /&gt;
                                                       //FOLLOWER_STATE_ACTIVE (put them in the active party)&lt;br /&gt;
                                                       //FOLLOWER_STATE_LOCKEDACTIVE (force them into the active party and keep them there, remember to change this later.&lt;br /&gt;
                                                       //FOLLOWER_STATE_AVAILABLE (make them available on the party picker (if you've set it up for them), but not in the active party)&lt;br /&gt;
                                                       //Plus some others you're unlikely to need at this time.  Defaults to AVAILABLE because having 4+ active followers is screwy.&lt;br /&gt;
                                                       &lt;br /&gt;
        string sCurrPlot = &amp;quot;&amp;quot;,  //If you set FOLLOWER_STATE_ACTIVE or FOLLOWER_STATE_LOCKEDACTIVE, the script will check to see if you passed this.&lt;br /&gt;
                                //It is recommended that you have a plot flag set for a given follower being in the active party, this makes conversation interjection etc. much easier.&lt;br /&gt;
&lt;br /&gt;
        int nCurrPlotFlag = 0,  //This flag will be set if FOLLOWER_STATE_ACTIVE or FOLLOWER_STATE_LOCKEDACTIVE are true&lt;br /&gt;
                                //AND sCurrPlot has a value AND nCurrPlotFlag is &amp;gt; 0.  &lt;br /&gt;
                                //ie if you added someone to the active party and have a plot flag to cope with it.&lt;br /&gt;
&lt;br /&gt;
        int nAutolevel = 0,     //Sets the Autolevel flag on the character sheet.  0 is off, 1 is on, 2 forces it on and removes it so the player can't turn it off.&lt;br /&gt;
        &lt;br /&gt;
        &lt;br /&gt;
        bFreeSpecPoint = TRUE,  //This grants a specialisation point to the follower if they do not have a specialisation.  &lt;br /&gt;
                                //It's important to set this false for classes that do not have specs, such as CLASS_DOG.&lt;br /&gt;
                                &lt;br /&gt;
        int nTargetLevel = 0,   //If you want a specific level, set this.  Generally not worthwhile unless you set it higher than the player, since they'll just get XP from the party picker anyway.&lt;br /&gt;
        &lt;br /&gt;
        int nMinLevel = 0       //Set this if there's a specific level you don't want the follower to go below.  Probably only useful if the PC might be very low level but not necessarily so. &lt;br /&gt;
        &lt;br /&gt;
        )&lt;br /&gt;
*/       &lt;br /&gt;
/* GetCustomFollowerALTable()  &lt;br /&gt;
This function is where you put your custom table assignments.&lt;br /&gt;
&lt;br /&gt;
You should explicitly test for the tag of your follower (not mine!) and assign a value to nTable from your m2DA extension to M2DA_base &lt;br /&gt;
&lt;br /&gt;
See wiki for details on how to do this, or ignore it to get the default Warrior/Rogue/Wizard AL tables.&lt;br /&gt;
&lt;br /&gt;
NOTE: you MUST explicitly set a table for non-Warrior/Rogue/Wizards, eg dogs.  Use TABLE_AL_DOG for a default Mabari.&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
int GetCustomFollowerALTable(object oFollower) {&lt;br /&gt;
    int nTable = _GetTableToUseForAL(oFollower);&lt;br /&gt;
    &lt;br /&gt;
    if (GetTag(oFollower) == &amp;quot;bc_party_miera&amp;quot;) {               &lt;br /&gt;
        nTable = 50143;   &lt;br /&gt;
    }   &lt;br /&gt;
    &lt;br /&gt;
    if (GetTag(oFollower) == &amp;quot;bc_party_jysavin&amp;quot;) {&lt;br /&gt;
        nTable = 50144;   &lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    if (GetTag(oFollower) == &amp;quot;bc_party_geldual&amp;quot;) {&lt;br /&gt;
        nTable = 50145;   &lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    if (GetTag(oFollower) == &amp;quot;bc_party_braghon&amp;quot;) {&lt;br /&gt;
        nTable = 50146;   &lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    return nTable;    &lt;br /&gt;
}   &lt;br /&gt;
&lt;br /&gt;
// This just cleans up the main function a little&lt;br /&gt;
&lt;br /&gt;
int GetCustomFollowerTargetLevel(object oFollower, object oHero, int nPackage, int nMinLevel = 0) {&lt;br /&gt;
            int nPlayerLevel = GetLevel(oHero);&lt;br /&gt;
            int nTargetLevel = 0;&lt;br /&gt;
&lt;br /&gt;
            if((nPlayerLevel &amp;gt;= 13) || (nPlayerLevel == 1) || (!_UT_GetIsPlotFollower(oFollower))) {&lt;br /&gt;
               nTargetLevel = nPlayerLevel;&lt;br /&gt;
            } else {&lt;br /&gt;
               nTargetLevel = nPlayerLevel + 1;&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            if (nMinLevel == 0) {  //If nMinLevel is not specified, checks package 2DA for a value&lt;br /&gt;
              nMinLevel = GetM2DAInt(TABLE_PACKAGES, &amp;quot;MinLevel&amp;quot;, nPackage);&lt;br /&gt;
             }&lt;br /&gt;
            if(nMinLevel &amp;gt; 0 &amp;amp;&amp;amp; nMinLevel &amp;gt; nTargetLevel) {&lt;br /&gt;
               nTargetLevel = nMinLevel;&lt;br /&gt;
            }          &lt;br /&gt;
            &lt;br /&gt;
            return nTargetLevel;&lt;br /&gt;
    &lt;br /&gt;
}   &lt;br /&gt;
&lt;br /&gt;
// Moving this black box out :)  I don't really understand it, but it should function if you have tactics set up in a package.&lt;br /&gt;
&lt;br /&gt;
void InitCustomFollowerTactics(object oFollower, int nPackage) {&lt;br /&gt;
         int nTableID = GetM2DAInt(TABLE_PACKAGES, &amp;quot;FollowerTacticsTable&amp;quot;, nPackage);&lt;br /&gt;
         if (nTableID != -1)&lt;br /&gt;
            {&lt;br /&gt;
             int nRows = GetM2DARows(nTableID);&lt;br /&gt;
             int nMaxTactics = GetNumTactics(oFollower);&lt;br /&gt;
&lt;br /&gt;
             int nTacticsEntry = 1;&lt;br /&gt;
             int i;&lt;br /&gt;
             for (i = 1; i &amp;lt;= nRows &amp;amp;&amp;amp; nTacticsEntry &amp;lt;= nMaxTactics; ++i)&lt;br /&gt;
                {&lt;br /&gt;
                        int bAddEntry = FALSE;&lt;br /&gt;
                        int nTargetType = GetM2DAInt(nTableID, &amp;quot;TargetType&amp;quot;, i);&lt;br /&gt;
                        int nCondition = GetM2DAInt(nTableID, &amp;quot;Condition&amp;quot;, i);&lt;br /&gt;
                        int nCommandType = GetM2DAInt(nTableID, &amp;quot;Command&amp;quot;, i);&lt;br /&gt;
                        int nCommandParam = GetM2DAInt(nTableID, &amp;quot;SubCommand&amp;quot;, i);&lt;br /&gt;
&lt;br /&gt;
                        int nUseType = GetM2DAInt(TABLE_COMMAND_TYPES, &amp;quot;UseType&amp;quot;, nCommandType);&lt;br /&gt;
                        if (nUseType == 0)&lt;br /&gt;
                        {&lt;br /&gt;
                            bAddEntry = TRUE;&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                        {&lt;br /&gt;
                            bAddEntry = HasAbility(oFollower, nCommandParam);&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        if (bAddEntry)&lt;br /&gt;
                        {&lt;br /&gt;
                            SetTacticEntry(oFollower, nTacticsEntry, TRUE, nTargetType, nCondition, nCommandType, nCommandParam);&lt;br /&gt;
                            ++nTacticsEntry;&lt;br /&gt;
                        }&lt;br /&gt;
                    }&lt;br /&gt;
                }&lt;br /&gt;
}  &lt;br /&gt;
&lt;br /&gt;
/* InitCustomFollowerSpec:&lt;br /&gt;
&lt;br /&gt;
This function tries to set the forced Specialisation.  If there is none, it checks the package for one.  &lt;br /&gt;
&lt;br /&gt;
If there isn't either of those, it grants a free spec point if bFreeSpecPoint is true.&lt;br /&gt;
&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
void InitCustomFollowerSpec(object oFollower, int nPackage, int nForceSpec, int bFreeSpecPoint) {&lt;br /&gt;
    // Find specialization, and optionally add a spec point if none is found.&lt;br /&gt;
&lt;br /&gt;
        if (nForceSpec == 0) {&lt;br /&gt;
    &lt;br /&gt;
        int nSpecAbility = GetM2DAInt(TABLE_PACKAGES, &amp;quot;switch1_class&amp;quot;, nPackage); // followers can have only 1 advanced class&lt;br /&gt;
         if(nSpecAbility &amp;gt; 0)&lt;br /&gt;
         {&lt;br /&gt;
          AddAbility(oFollower, nSpecAbility);&lt;br /&gt;
         } else {&lt;br /&gt;
             if (bFreeSpecPoint) {&lt;br /&gt;
                 SetCreatureProperty(oFollower, 38, 1.00);&lt;br /&gt;
             }&lt;br /&gt;
         }                    &lt;br /&gt;
        &lt;br /&gt;
        } else {&lt;br /&gt;
         &lt;br /&gt;
             AddAbility(oFollower, nForceSpec);&lt;br /&gt;
            &lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* hireCustomFollower()  (See doco at top of page)&lt;br /&gt;
&lt;br /&gt;
I strongly suggest you reorder the parameters if you're adding many followers with advanced options.&lt;br /&gt;
&lt;br /&gt;
Feel free to leave them alone if you only want to set class, plot, spec or don't mind long declarations.&lt;br /&gt;
&lt;br /&gt;
Note nForceClass is currently compulsory due to flakiness with GetCreatureCoreClass()&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
void hireCustomFollower(object oFollower, int nForceClass, string sPlot = &amp;quot;&amp;quot;, int nPlotFlag = 0, int nForceSpec = 0, &lt;br /&gt;
int nALTable = 0, int bInvokePicker = FALSE, int nInitialState = FOLLOWER_STATE_AVAILABLE, string sCurrPlot = &amp;quot;&amp;quot;, &lt;br /&gt;
int nCurrPlotFlag = 0, int nAutolevel = 0, int bFreeSpecPoint = TRUE, int nTargetLevel = 0, int nMinLevel = 0) &lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
        object oHero = GetHero();&lt;br /&gt;
&lt;br /&gt;
        /* #################  BEGIN BASIC FOLLOWER JOIN BLOCK   ###################&lt;br /&gt;
&lt;br /&gt;
        This loosely replicates WR_SetFollowerState.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        */    &lt;br /&gt;
        &lt;br /&gt;
        if (nForceClass == 0) {&lt;br /&gt;
            nForceClass = GetCreatureCoreClass(oFollower);           //This is not working.  Hence nForceClass mandatory.&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
        SetGroupId(oFollower, GetGroupId(oHero));      //Puts the follower in the pc's Group.&lt;br /&gt;
        SetEventScript(oFollower, RESOURCE_SCRIPT_PLAYER_CORE);  //This makes them act like a player.&lt;br /&gt;
        SetFollowerState(oFollower, nInitialState);  //This sets whether they are available, in the active party etc.&lt;br /&gt;
&lt;br /&gt;
        /* #################  END BASIC FOLLOWER JOIN BLOCK ##################### */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        /* #################  BEGIN PLAYER_CORE EVENT_TYPE_PARTY_MEMBER_HIRED EMULATION #################&lt;br /&gt;
         This replicates the EVENT_TYPE_PARTY_MEMBER_HIRED handler from player_core, stripped down for simplicity and allowing our custom options.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        */&lt;br /&gt;
&lt;br /&gt;
        Chargen_EnableTacticsPresets(oFollower);    //I assume this is important.&lt;br /&gt;
        &lt;br /&gt;
        SetLocalInt(oFollower, FOLLOWER_SCALED, 1);  //This should prevent the follower being rescaled by player_core or what have you&lt;br /&gt;
        &lt;br /&gt;
        int nPackage = GetPackage(oFollower);  //Gets the package, which will be used to find a number of 2DA IDs.&lt;br /&gt;
        int nPackageClass = GetM2DAInt(TABLE_PACKAGES, &amp;quot;StartingClass&amp;quot;, nPackage);  //I don't think this is used, even by player_core&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        // set behavior according to package&lt;br /&gt;
        int nBehavior = GetM2DAInt(TABLE_PACKAGES, &amp;quot;FollowerBehavior&amp;quot;, nPackage);&lt;br /&gt;
&lt;br /&gt;
        if(nBehavior &amp;gt;= 0) {&lt;br /&gt;
            SetAIBehavior(oFollower, nBehavior);&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        Chargen_InitializeCharacter(oFollower);      //We initialise the follower and choose race/class.&lt;br /&gt;
        &lt;br /&gt;
        Chargen_SelectRace(oFollower,GetCreatureRacialType(oFollower));&lt;br /&gt;
        Chargen_SelectCoreClass(oFollower,nForceClass);        &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
         if (nTargetLevel == 0) {   //This block picks a target level if not specified&lt;br /&gt;
            &lt;br /&gt;
              nTargetLevel = GetCustomFollowerTargetLevel(oFollower, oHero, nPackage, nMinLevel);&lt;br /&gt;
         }&lt;br /&gt;
&lt;br /&gt;
         int nXp = RW_GetXPNeededForLevel(Max(nTargetLevel, 1));      //Here is where the XP is calculated and rewarded&lt;br /&gt;
         RewardXP(oFollower, nXp, FALSE, FALSE);&lt;br /&gt;
&lt;br /&gt;
         // -------------------------------------------------------------&lt;br /&gt;
         // add hidden approval talents - (JN: I don't know how to set these yet, but when I figure it out this should make it work)&lt;br /&gt;
         // -------------------------------------------------------------&lt;br /&gt;
         int nIndex = Approval_GetFollowerIndex(oFollower);&lt;br /&gt;
         Approval_AddFollowerBonusAbility(nIndex, 0);&lt;br /&gt;
        &lt;br /&gt;
          //Handle Specialisation&lt;br /&gt;
          InitCustomFollowerSpec(oFollower, nPackage, nForceSpec, bFreeSpecPoint);&lt;br /&gt;
&lt;br /&gt;
         // -------------------------------------------------------------&lt;br /&gt;
         // This spends all available attribute and stat points on the&lt;br /&gt;
         // creature according to the levelup table.  (JN:  this replicates AL_DoAutoLevelUp but with our choice of table)&lt;br /&gt;
         // -------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
         if (nALTable == 0) {&lt;br /&gt;
            nALTable = GetCustomFollowerALTable(oFollower);&lt;br /&gt;
         }&lt;br /&gt;
&lt;br /&gt;
         AL_SpendAttributePoints(oFollower, nALTable, FALSE);&lt;br /&gt;
         AL_SpendSkillPoints(oFollower, nALTable, TRUE);&lt;br /&gt;
         AL_SpendSpecializationPoints(oFollower, nALTable);&lt;br /&gt;
         AL_SpendTalentSpellPoints(oFollower, nALTable, TRUE);&lt;br /&gt;
&lt;br /&gt;
        // -------------------------------------------------------------------------&lt;br /&gt;
        // Update various UIs&lt;br /&gt;
        // -------------------------------------------------------------------------&lt;br /&gt;
        Chargen_SetNumTactics(oFollower);&lt;br /&gt;
        SetCanLevelUp(oFollower,Chargen_HasPointsToSpend(oFollower));&lt;br /&gt;
&lt;br /&gt;
        // load tactics&lt;br /&gt;
         InitCustomFollowerTactics(oFollower, nPackage);&lt;br /&gt;
&lt;br /&gt;
         /* #################  END PLAYER_CORE EVENT_TYPE_PARTY_MEMBER_HIRED EMULATION ################# */     &lt;br /&gt;
             &lt;br /&gt;
         &lt;br /&gt;
         SetAutoLevelUp(oFollower, nAutolevel);         //This is the autolevel flag on the character sheet.&lt;br /&gt;
         &lt;br /&gt;
         //Set plot flags&lt;br /&gt;
         &lt;br /&gt;
         if (!((sPlot == &amp;quot;&amp;quot;) || (nPlotFlag == 0))) {           //Joined Party&lt;br /&gt;
            WR_SetPlotFlag(sPlot, nPlotFlag, TRUE);   &lt;br /&gt;
         }&lt;br /&gt;
&lt;br /&gt;
         if ((nInitialState == FOLLOWER_STATE_ACTIVE) || (nInitialState == FOLLOWER_STATE_LOCKEDACTIVE)) {&lt;br /&gt;
            if (!((sCurrPlot == &amp;quot;&amp;quot;) || (nCurrPlotFlag == 0))) {&lt;br /&gt;
                WR_SetPlotFlag(sCurrPlot, nCurrPlotFlag, TRUE);   //Currently in Party&lt;br /&gt;
            }&lt;br /&gt;
         }&lt;br /&gt;
                     &lt;br /&gt;
        // Invoke picker if requested.&lt;br /&gt;
&lt;br /&gt;
        if (bInvokePicker) {&lt;br /&gt;
             SetPartyPickerGUIStatus(2);&lt;br /&gt;
             ShowPartyPickerGUI();&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Yeah, I know.  It can't really be any smaller.  Feel free to modify it if you're confident with scripting.&lt;br /&gt;
==== Add Your Custom Autolevel Template to GetCustomFollowerALTable() ====&lt;br /&gt;
While you can pass the ID you made for your autolevel template to that monster function as an argument, it's better to have them all in one place if you have multiple followers.&lt;br /&gt;
&lt;br /&gt;
GetCustomFollowerALTable() is the first function in our include, and you can add an explicit if test for your follower there to assign the correct table id (the one from your M2DA_base_ m2DA).  There is a function very much like it in sys_autolevel_h.nss for the core followers, so we'll copy Bioware's practice.&lt;br /&gt;
&lt;br /&gt;
Let's take a look at the function by itself:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
int GetCustomFollowerALTable(object oFollower) {&lt;br /&gt;
    int nTable = _GetTableToUseForAL(oFollower);&lt;br /&gt;
    &lt;br /&gt;
    if (GetTag(oFollower) == &amp;quot;bc_party_miera&amp;quot;) {               &lt;br /&gt;
        nTable = 50143;   &lt;br /&gt;
    }   &lt;br /&gt;
    &lt;br /&gt;
    if (GetTag(oFollower) == &amp;quot;bc_party_jysavin&amp;quot;) {&lt;br /&gt;
        nTable = 50144;   &lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    if (GetTag(oFollower) == &amp;quot;bc_party_geldual&amp;quot;) {&lt;br /&gt;
        nTable = 50145;   &lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    if (GetTag(oFollower) == &amp;quot;bc_party_braghon&amp;quot;) {&lt;br /&gt;
        nTable = 50146;   &lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    return nTable;    &lt;br /&gt;
    &lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So we have a test for each follower tag from my module, matching up to an ID which is assigned to nTable.  All you need to do is change a tag from my follower to yours, and my ID to the correct one from your M2DA_base_* m2DA.  Then you should delete the rest of the example if statements :)&lt;br /&gt;
&lt;br /&gt;
Save and export the script.  Ignore the compiler error about lack of main();&lt;br /&gt;
&lt;br /&gt;
=== Include Function In Your Hire Script and Call It ===&lt;br /&gt;
&lt;br /&gt;
So instead of a hire script that calls UT_HireFollower(), we want one that includes our shiny new function and calls it.&lt;br /&gt;
&lt;br /&gt;
Take a look at the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
#include &amp;quot;plt_bc_create_party&amp;quot;   //Make sure you include your party handling plot&lt;br /&gt;
#include &amp;quot;hireCustomFollower_h&amp;quot;  // And include the function script - which will in turn include a bunch of stuff&lt;br /&gt;
&lt;br /&gt;
void main() {&lt;br /&gt;
&lt;br /&gt;
                    //Initialising my objects, not super-relevant to the example &lt;br /&gt;
                     &lt;br /&gt;
                    object oHero = GetHero();&lt;br /&gt;
                    object oMiera = CreateObject(OBJECT_TYPE_CREATURE, R&amp;quot;bc_party_miera.utc&amp;quot;, GetLocation(oHero));&lt;br /&gt;
                    object oJysavin = CreateObject(OBJECT_TYPE_CREATURE, R&amp;quot;bc_party_jysavin.utc&amp;quot;, GetLocation(oHero));&lt;br /&gt;
                    object oBraghon = CreateObject(OBJECT_TYPE_CREATURE, R&amp;quot;bc_party_braghon.utc&amp;quot;, GetLocation(oHero));&lt;br /&gt;
                    object oSpider = CreateObject(OBJECT_TYPE_CREATURE, R&amp;quot;bc_party_geldual.utc&amp;quot;, GetLocation(oHero));&lt;br /&gt;
&lt;br /&gt;
                    //Simplest hire call - adds to the party as a wizard.  Class is currently compulsory due to a bug.&lt;br /&gt;
                    hireCustomFollower(oMiera, CLASS_WIZARD);&lt;br /&gt;
&lt;br /&gt;
                    //Add to the party and set joining plot flags&lt;br /&gt;
                    hireCustomFollower(oJysavin, CLASS_WARRIOR, PLT_BC_CREATE_PARTY, PARTY_JYSAVIN_JOINED);&lt;br /&gt;
&lt;br /&gt;
                    //Add to the party, set plot flags, force a specialisation&lt;br /&gt;
                    hireCustomFollower(oBraghon, CLASS_ROGUE, PLT_BC_CREATE_PARTY, PARTY_BRAGHON_JOINED, ABILITY_TALENT_HIDDEN_ASSASSIN);&lt;br /&gt;
&lt;br /&gt;
                    //More complex example - Follower added as a unique class (Dog), not granted a specialisation or spec point.  &lt;br /&gt;
                    //Note unique classes must have an ALTable passed here or specified in GetCustomFollowerALTable() or they won't work&lt;br /&gt;
                    hireCustomFollower(oSpider, CLASS_DOG, PLT_BC_CREATE_PARTY, PARTY_GELDUAL_JOINED, 0, 0, FALSE, FOLLOWER_STATE_AVAILABLE, &amp;quot;&amp;quot;, 0, 0, FALSE);&lt;br /&gt;
                   &lt;br /&gt;
                    //Show the party picker to let the player choose from their new companions!&lt;br /&gt;
                    SetPartyPickerGUIStatus(2);&lt;br /&gt;
                    ShowPartyPickerGUI();                                                                                                                    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The example shows several of the more simple ways of invoking the function.  Check the comments at the start of the function for a full list of arguments.&lt;br /&gt;
&lt;br /&gt;
I would suggest best practice for most followers would be to call as follows:&lt;br /&gt;
&lt;br /&gt;
'''hireCustomFollower(oFollower, CLASS, PLOT, PLOT_FLAG, SPECIALISATION)'''&lt;br /&gt;
&lt;br /&gt;
This will safely set the follower up as the desired class and specialisation (doubly important if there are spec abilities in their ALTable) while setting your plot flag for them being in the party.  hireCustomFollower(oFollower, CLASS, PLOT, PLOT_FLAG, SPECIALISATION, 0, TRUE) will do the same while invoking the Party Picker automatically.&lt;br /&gt;
&lt;br /&gt;
Note that the specialisations are abilities and not classes - you'll find them as ABILITY_HIDDEN_ constants.&lt;br /&gt;
&lt;br /&gt;
If it's all worked, you should find you can now add followers with a lot more flexibility!&lt;br /&gt;
&lt;br /&gt;
[[File:picker_advanced.jpg|thumb|500px|center]]&lt;br /&gt;
&lt;br /&gt;
== Common Follower Problems &amp;amp; FAQ ==&lt;br /&gt;
&lt;br /&gt;
====Why don't my followers gain XP?====&lt;br /&gt;
There is a bug in UT_HireFollower. For now the best/easiest approach to take might be to make a copy of UT_HireFollower in an include file and rename it something like UT_HireFollower_Fixed, then make the following change:&lt;br /&gt;
    WR_SetFollowerState(oFollower, FOLLOWER_STATE_ACTIVE, TRUE, 0, TRUE);&lt;br /&gt;
to&lt;br /&gt;
    WR_SetFollowerState(oFollower, FOLLOWER_STATE_ACTIVE, TRUE, 0, bPreventLevelup);&lt;br /&gt;
(Note: Be aware if you use the name UT_HireFollower_Fixed you may end up finding your include file conflicting with someone else who has named it the same in their include.)&lt;br /&gt;
&lt;br /&gt;
Alternately you need to clear a flag in a separate script to the one in which they're hired.&lt;br /&gt;
&lt;br /&gt;
You must use the '''SetLocalInt(oFollower, CREATURE_REWARD_FLAGS, 0);''' statement in a script you can be sure will run soon after your hiring script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====When I choose followers from the Party Picker, they spawn into the area but do not join.====&lt;br /&gt;
&lt;br /&gt;
You need to intercept the EVENT_TYPE_PARTYMEMBER_ADDED event and set the follower to FOLLOWER_STATE_ACTIVE.  See Simple Follower Creation earlier in this document.&lt;br /&gt;
&lt;br /&gt;
====My followers don't have skill trees!====&lt;br /&gt;
&lt;br /&gt;
If a follower hasn't been through an initial chargen/autolevel event (via player_core/sys_autolevel_h) then the skill tree doesn't show.  You're probably trying to be clever and get around UT_HireFollower without going all the way (see monster function above ^_^).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====My followers don't have a class====&lt;br /&gt;
&lt;br /&gt;
GetCreatureCoreClass() seems flaky under some conditions.  It's best to explicitly set the class yourself; this is why class is currently a mandatory argument to hireCustomFollower()&lt;br /&gt;
&lt;br /&gt;
====Dog talents don't work====&lt;br /&gt;
Symptoms: dog talents appear on the talents screen but remain greyed out on level up. Warrior talents appear in the quickslots.&lt;br /&gt;
&lt;br /&gt;
Line 78 of packages_base in packages.xls (Dog) should have the LevelUpTable column set to 257 which is the ALDog table.&lt;br /&gt;
&lt;br /&gt;
====Isn't there an easier way to do this?====&lt;br /&gt;
&lt;br /&gt;
Possibly.  There is a way of recruiting a follower by setting a plot flag.  However I don't understand it, and I expect it still doesn't allow custom autolevel templates, full control over specialisations etc.  There's still a fair bit of stuff hardcoded for the core followers, I'm not sure putting a custom follower through the same process as Al, Leli et al will have good results.&lt;br /&gt;
&lt;br /&gt;
The next section answers this question, up to a point.&lt;br /&gt;
&lt;br /&gt;
==== What if there are more than three potential followers? ====&lt;br /&gt;
This example handles larger numbers of followers, and doesn't force the player to use the party picker unless the party is already full.&lt;br /&gt;
&lt;br /&gt;
If you're making a new campaign, to keep life simple, allocate a unique number to each follower. You could either use a creature variable or a script, e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Party member id (e.g. 1=Alicia, 2=Godwin...)&lt;br /&gt;
int cocPartyMemberID(object oPartyMember)&lt;br /&gt;
{&lt;br /&gt;
  string sPartyMember = GetTag(oPartyMember);&lt;br /&gt;
&lt;br /&gt;
  if (sPartyMember == &amp;quot;coccr_alicia&amp;quot;) return 1;&lt;br /&gt;
  if (sPartyMember == &amp;quot;coccr_godwin&amp;quot;) return 2;&lt;br /&gt;
  if (sPartyMember == &amp;quot;coccr_harold&amp;quot;) return 3;&lt;br /&gt;
  if (sPartyMember == &amp;quot;coccr_lara&amp;quot;  ) return 4;&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make two separate plots, e.g. cocpt_hired for when a follower is first recruited, and cocpt_party to flag whether they're currently in the party. Use flag values that correspond to the unique follower id, e.g. COCPT_HIRED_GODWIN will be 2.&lt;br /&gt;
&lt;br /&gt;
If you're modifying the official campaign, you won't be able to make this simplification - you'll need a set of plot flags for your new party members, similar to the official ones. The logic of what follows is still correct, it just means that instead of having one set of common code that works for everyone, you have to explicitly script each party member individually using their personal plot flags.&lt;br /&gt;
&lt;br /&gt;
Follower conversation is now very simple. In Godwin's dialogue, the hiring line will be conditional - when COCPT_HIRED_GODWIN is clear - and it will set COCPT_HIRED_GODWIN.  No conversation script is necessary. Instead, in the properties of the plot cocpt_hired, we add a plot event script, as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// PARTY HIRE PLOT SCRIPT&lt;br /&gt;
//&lt;br /&gt;
// This is called in conversation when a party member is hired for the first time.&lt;br /&gt;
// If the party is full, the party picker is displayed, which forces the PARTYMEMBER_ADDED&lt;br /&gt;
// module event.&lt;br /&gt;
//&lt;br /&gt;
// The flag value is never referenced, because the code is common for all party members.&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;events_h&amp;quot;&lt;br /&gt;
#include &amp;quot;global_objects_h&amp;quot;&lt;br /&gt;
#include &amp;quot;utility_h&amp;quot;&lt;br /&gt;
#include &amp;quot;sys_rewards_h&amp;quot;&lt;br /&gt;
#include &amp;quot;log_h&amp;quot;&lt;br /&gt;
#include &amp;quot;utility_h&amp;quot;&lt;br /&gt;
#include &amp;quot;wrappers_h&amp;quot;&lt;br /&gt;
#include &amp;quot;plot_h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;coc_h&amp;quot;                  // A header containing the cocPartyMemberID function&lt;br /&gt;
#include &amp;quot;plt_cocpt_hired&amp;quot;&lt;br /&gt;
#include &amp;quot;plt_cocpt_party&amp;quot;&lt;br /&gt;
&lt;br /&gt;
int StartingConditional()&lt;br /&gt;
{&lt;br /&gt;
    event  eParms             = GetCurrentEvent();&lt;br /&gt;
    int    nType              = GetEventType(eParms);       // GET or SET&lt;br /&gt;
    string strPlot            = GetEventString(eParms, 0);  // Plot GUID&lt;br /&gt;
    int    nFlag              = GetEventInteger(eParms, 1); // Plot flag&lt;br /&gt;
    object oParty             = GetEventCreator(eParms);    // Plot table owner&lt;br /&gt;
    object oFollower          = GetEventObject(eParms, 0);  // Conversation owner (if any)&lt;br /&gt;
    int    nPlotType          = GetEventInteger(eParms, 5); // Plot type&lt;br /&gt;
&lt;br /&gt;
    int    bIsTutorial        = GetM2DAInt(TABLE_PLOT_TYPES, &amp;quot;IsTutorial&amp;quot;, nPlotType);&lt;br /&gt;
    int    bIsCodex           = GetM2DAInt(TABLE_PLOT_TYPES, &amp;quot;IsCodex&amp;quot;, nPlotType);&lt;br /&gt;
&lt;br /&gt;
    int    nResult            = FALSE;                      // return value for DEFINED GET&lt;br /&gt;
    object oPC                = GetPartyLeader();&lt;br /&gt;
&lt;br /&gt;
    plot_GlobalPlotHandler(eParms); // any global plot operations, including debug info&lt;br /&gt;
&lt;br /&gt;
    if (nType == EVENT_TYPE_SET_PLOT) // actions -&amp;gt; normal flags only&lt;br /&gt;
    {&lt;br /&gt;
        int nValue    = GetEventInteger(eParms, 2); // 0=Clear 1=Set&lt;br /&gt;
        int nOldValue = GetEventInteger(eParms, 3); // Current flag value&lt;br /&gt;
&lt;br /&gt;
        if (nValue)&lt;br /&gt;
          {&lt;br /&gt;
            if (GetArraySize(GetPartyList(oPC)) &amp;lt; 4)&lt;br /&gt;
              {&lt;br /&gt;
                UT_HireFollower(oFollower);&lt;br /&gt;
                SetLocalInt(oFollower, CREATURE_REWARD_FLAGS, 0);&lt;br /&gt;
                AddCommand(oFollower, CommandJumpToLocation(GetLocation(GetHero())));&lt;br /&gt;
                SetFollowerState(oFollower, FOLLOWER_STATE_ACTIVE);&lt;br /&gt;
                WR_SetPlotFlag(PLT_COCPT_PARTY, cocPartyMemberID(oFollower), TRUE);&lt;br /&gt;
              }&lt;br /&gt;
            else&lt;br /&gt;
              {&lt;br /&gt;
                WR_SetFollowerState(oFollower, FOLLOWER_STATE_AVAILABLE, FALSE);&lt;br /&gt;
                SetEventScript(oFollower, RESOURCE_SCRIPT_PLAYER_CORE);&lt;br /&gt;
                SendPartyMemberHiredEvent(oFollower, TRUE);&lt;br /&gt;
//                SetPartyPickerGUIStatus(PP_GUI_STATUS_USE);&lt;br /&gt;
//                ShowPartyPickerGUI();&lt;br /&gt;
              }&lt;br /&gt;
          }&lt;br /&gt;
     }&lt;br /&gt;
     else // EVENT_TYPE_GET_PLOT -&amp;gt; defined conditions only&lt;br /&gt;
     {&lt;br /&gt;
        switch(nFlag)&lt;br /&gt;
        {&lt;br /&gt;
&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    plot_OutputDefinedFlag(eParms, nResult);&lt;br /&gt;
    return nResult;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We still need to handle the party picker events in our module event script:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
         // PARTY MEMBER ADDED - Allow XP gain. Come here, follow me, flag as party member.&lt;br /&gt;
         case EVENT_TYPE_PARTYMEMBER_ADDED:&lt;br /&gt;
         {&lt;br /&gt;
            object oFollower = GetEventObject(ev, 0);&lt;br /&gt;
            SetLocalInt(oFollower, CREATURE_REWARD_FLAGS, 0);&lt;br /&gt;
            AddCommand(oFollower, CommandJumpToLocation(GetLocation(GetHero())));&lt;br /&gt;
            SetFollowerState(oFollower, FOLLOWER_STATE_ACTIVE);&lt;br /&gt;
            WR_SetPlotFlag(PLT_COCPT_PARTY, cocPartyMemberID(oFollower), TRUE);&lt;br /&gt;
            break;&lt;br /&gt;
         }&lt;br /&gt;
         // PARTY MEMBER DROPPED - flag as not party member.&lt;br /&gt;
         case EVENT_TYPE_PARTYMEMBER_DROPPED:&lt;br /&gt;
        {&lt;br /&gt;
            object oFollower = GetEventObject(ev, 0);&lt;br /&gt;
            WR_SetPlotFlag(PLT_COCPT_PARTY, cocPartyMemberID(oFollower), FALSE);&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
When we need to refer to a particular follower explicitly, we can still do so - for example, the flag COCPT_PARTY_GODWIN will tell use whether Godwin is currently in the party or not. &lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>TrueKeaton</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Scripting_tutorial&amp;diff=12513</id>
		<title>Scripting tutorial</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Scripting_tutorial&amp;diff=12513"/>
				<updated>2010-03-11T21:33:16Z</updated>
		
		<summary type="html">&lt;p&gt;TrueKeaton: /* Interacting with plots */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox script}}&lt;br /&gt;
The final piece of the puzzle in our little tutorial game is getting the &amp;lt;code&amp;gt;MONSTERS_SLAIN&amp;lt;/code&amp;gt; flag set on our plot so that when the hero succeeds in his quest, the quest giver will know about it. This is done via scripting.&lt;br /&gt;
&lt;br /&gt;
Scripting is a programming language with a syntax similar to C. This tutorial assumes a small amount of programming knowledge but hopefully it will be possible even for one with no experience to pick up the basics here.&lt;br /&gt;
&lt;br /&gt;
== Dragon Age's event-driven model ==&lt;br /&gt;
&lt;br /&gt;
In Dragon Age scripts are primarily event-driven. An &amp;quot;event&amp;quot; is a package of information in a special format that gets passed around in the game to trigger behaviour. They are generated by other scripts or the game engine and are passed to an object's event-handling script.&lt;br /&gt;
&lt;br /&gt;
Events have a type, a target object, a time delay and a package of parameters (arbitrary number of ints, objects, floats and strings).&lt;br /&gt;
&lt;br /&gt;
As an example, the &amp;quot;&amp;lt;code&amp;gt;[[EVENT_TYPE_ATTACK_IMPACT]]&amp;lt;/code&amp;gt;&amp;quot; event is sent by the game engine whenever an attack hits a target. It contains the identities of the attacker and the target, whether the attack was a critical hit, and the amount of damage that the attack did. It is sent to an event-handling script attached to the attacker, which takes the information it contains and handles it in whatever way is appropriate (reducing the target's hit points, usually).&lt;br /&gt;
&lt;br /&gt;
For our purposes right now we're not going to need to generate any events of our own. We have set all of the hut monsters to be members of team 1, and the game has a built-in feature that will generate an event when all of the members of a particular team of creatures has been killed. Our new script will respond to that event by setting the plot flag so that when the hut monsters are all defeated, the plot will change to indicate the quest objective has been accomplished.&lt;br /&gt;
&lt;br /&gt;
An enormous list of events for all occasions can be found at the [[Event (dascript type)|event]] page. The one we're going to want our script to look for is &amp;lt;code&amp;gt;[[EVENT_TYPE_TEAM_DESTROYED]]&amp;lt;/code&amp;gt;, which is sent when the last member of a team of creatures is destroyed. The event contains the team number within it.&lt;br /&gt;
&lt;br /&gt;
== Creating a basic event-handling script ==&lt;br /&gt;
&lt;br /&gt;
Start by creating a new script resource. We'll call our script &amp;quot;&amp;lt;code&amp;gt;hut_monsters_slain&amp;lt;/code&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In most cases when a script is run the scripting engine will start with a function named &amp;quot;&amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt;&amp;quot;. So for most scripts you'll want to start with this very basic beginning:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The code that will perform our tasks will be inserted between the { and } brackets. &amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt; doesn't return any results directly, so the function's return type is &amp;quot;&amp;lt;code&amp;gt;[[void]]&amp;lt;/code&amp;gt;&amp;quot;, and it takes no parameters, so the parameter list is an empty ().&lt;br /&gt;
&lt;br /&gt;
=== Event type constants ===&lt;br /&gt;
&lt;br /&gt;
Next we're going to need to make sure the script will know what we're talking about when we make references to events. The tag that tells us the type of each event is actually represented internally by a number, but since it would be impossible for a programmer to keep track of all the different event numbers without making hard-to-find mistakes Dragon Age has instead used named constants to represent them in a more human-readable name.&lt;br /&gt;
&lt;br /&gt;
Those constants are defined in the script &amp;lt;code&amp;gt;events_h&amp;lt;/code&amp;gt;.  The &amp;quot;&amp;lt;code&amp;gt;_h&amp;lt;/code&amp;gt;&amp;quot; suffix stands for &amp;quot;header&amp;quot;, which is a special class of script that contains only various definitions meant to be included in other scripts and doesn't do anything on its own.&lt;br /&gt;
&lt;br /&gt;
To include the header file, add this line to the top of our script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#include &amp;quot;events_h&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All &amp;lt;code&amp;gt;#include&amp;lt;/code&amp;gt; commands should be at the top of your script before anything else, but if there's more than one it shouldn't matter what order they are in.&lt;br /&gt;
&lt;br /&gt;
To see whether our script now knows what &amp;lt;code&amp;gt;[[EVENT_TYPE_TEAM_DESTROYED]]&amp;lt;/code&amp;gt; means you can use the constant browser on the right edge of the script editor to check if it's listed. The browser defaults to showing a list of all defined functions (the &amp;quot;f()&amp;quot; button), to set it to show all defined constants click on the &amp;quot;C&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scripting constant browser.png]]&lt;br /&gt;
&lt;br /&gt;
Even without any included files the list of defined constants is going to be quite long, and for scripts with many include files it can be very difficult to find any particular constant - especially if you aren't sure exactly what its name is. To find constants more easily, type any part of its name into the filter field at the top.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scripting constant browser filtered.png]]&lt;br /&gt;
&lt;br /&gt;
To insert the constant into the script at the location where the cursor is currently located, simply double-click on the constant in the constant browser. This avoids any risk of making a typo. You can also type the beginning of the constant (or any function, etc.) and press Ctrl-Space to see a list of matching values.&lt;br /&gt;
&lt;br /&gt;
=== Extracting information about the current event ===&lt;br /&gt;
&lt;br /&gt;
When an event is sent to a script the script's &amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt; function will be run, but it won't know anything about the event that caused it to be run without some explicit instructions.&lt;br /&gt;
&lt;br /&gt;
First, you will need to retrieve the package of data that is the event. We'll define a variable named &amp;lt;code&amp;gt;ev&amp;lt;/code&amp;gt; that will hold this package, and set it to the &amp;quot;&amp;lt;code&amp;gt;event&amp;lt;/code&amp;gt;&amp;quot; data type. To retrieve the current event and stick it into that variable, we'll use the engine-defined function &amp;lt;code&amp;gt;[[GetCurrentEvent]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The first line of the main function will therefore be:&lt;br /&gt;
&amp;lt;code&amp;gt;event ev = GetCurrentEvent();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Every event will have an event type. As described above, this event type is represented internally by an integer. We'll create an integer variable named &amp;lt;code&amp;gt;nEventType&amp;lt;/code&amp;gt; to hold it, and use the &amp;lt;code&amp;gt;GetEventType&amp;lt;/code&amp;gt; function to extract it from &amp;lt;code&amp;gt;ev&amp;lt;/code&amp;gt;. The next line will be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;int nEventType = [[GetEventType]](ev);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rest of the information packaged with the event depends on exactly what kind of event it is, so the rest of the code we write will be event-specific. To make sure only the correct code is run we'll use a &amp;lt;code&amp;gt;switch&amp;lt;/code&amp;gt; statement. We're only looking for one particular event so we could just as easily have used an &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement but a &amp;lt;code&amp;gt;switch&amp;lt;/code&amp;gt; is more extendable for future use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
switch(nEventType)&lt;br /&gt;
    {&lt;br /&gt;
         case EVENT_TYPE_TEAM_DESTROYED:&lt;br /&gt;
         {&lt;br /&gt;
             //our event-specific code goes here&lt;br /&gt;
             break;&lt;br /&gt;
         }&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We know from the documentation for the &amp;lt;code&amp;gt;[[EVENT_TYPE_TEAM_DESTROYED]]&amp;lt;/code&amp;gt; event, that it comes with a single piece of information; the team number. It's an integer, so we can extract it with the &amp;lt;code&amp;gt;[[GetEventInteger]]&amp;lt;/code&amp;gt; function. &amp;lt;code&amp;gt;[[GetEventInteger]]&amp;lt;/code&amp;gt; takes two parameters, the event object (which we've stored in the variable &amp;lt;code&amp;gt;ev&amp;lt;/code&amp;gt;) and the index of the integer we want, in this case 0 (this is listed in the documentation).&lt;br /&gt;
&lt;br /&gt;
We also know that the team number we gave the hut monsters is 1, so we want to update the plot only when we receive an event indicating that team number 1 has been destroyed. We can do this with an &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (GetEventInteger(ev,0) == 1)&lt;br /&gt;
{&lt;br /&gt;
    //code to update the plot here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interacting with plots ==&lt;br /&gt;
&lt;br /&gt;
To interact with a plot's flags you'll need to have some way for the script to know where the plot flags are and what they're named. This is done in a similar manner to how we told the script what the event types were named; by including the plot file in the script.&lt;br /&gt;
&lt;br /&gt;
Plots are not the same as regular scripts, though, so when including them they are distinguished from regular scripts through the use of a &amp;lt;code&amp;gt;plt_&amp;lt;/code&amp;gt; prefix in their name. The plot we wish to interact with is called &amp;lt;code&amp;gt;clear_the_hut&amp;lt;/code&amp;gt;, so at the top of the script file you'll need to put the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#include &amp;quot;plt_clear_the_hut&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now your script will have access to the plot's flags and will be able to read or change them. You'll find that several new constants have been defined; &amp;lt;code&amp;gt;PLT_CLEAR_THE_HUT&amp;lt;/code&amp;gt; contains the plot object, and the integer constants &amp;lt;code&amp;gt;MONSTERS_SLAIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;QUEST_ACCEPTED&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;REWARD_RECEIVED&amp;lt;/code&amp;gt; identify the flags within the plot.&lt;br /&gt;
&lt;br /&gt;
Changing the state of the flags is done with the &amp;lt;code&amp;gt;WR_SetPlotFlag&amp;lt;/code&amp;gt; function that is defined in the include file &amp;lt;code&amp;gt;wrappers_h&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;wrappers_h&amp;lt;/code&amp;gt; contains a variety of utility functions that handle operations requiring low-level access to the game. Add &amp;lt;code&amp;gt;#include &amp;quot;wrappers_h&amp;quot;&amp;lt;/code&amp;gt; to the top of your script). In our case, we want to set the plot flag &amp;lt;code&amp;gt;MONSTERS_SLAIN&amp;lt;/code&amp;gt;. The &amp;lt;code&amp;gt;WR_SetPlotFlag&amp;lt;/code&amp;gt; function takes three parameters; the plot identifier, the flag identifier, and the state we want to set it to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WR_SetPlotFlag(PLT_CLEAR_THE_HUT, MONSTERS_SLAIN, TRUE);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Associating an event script with an object ==&lt;br /&gt;
&lt;br /&gt;
The script is almost complete now, but until we've linked it up to some object in the game that can receive events it will never actually be run.&lt;br /&gt;
&lt;br /&gt;
Most objects in the game will have a field named &amp;quot;Script&amp;quot; shown in the object inspector. According to the documentation for the &amp;lt;code&amp;gt;EVENT_TYPE_TEAM_DESTROYED&amp;lt;/code&amp;gt; event it is sent to the area object the team is in, so we'll want to open the hut_interior area now and go to its Script entry. The default event script for areas is &amp;lt;code&amp;gt;area_core&amp;lt;/code&amp;gt;, which handles basic area events in a default way.&lt;br /&gt;
&lt;br /&gt;
This is where you'll want to put the &amp;lt;code&amp;gt;hut_monsters_slain&amp;lt;/code&amp;gt; script. Click on the ellipsis ([[Image:ellipsis.png]]) button and select the new script. It will replace &amp;lt;code&amp;gt;area_core&amp;lt;/code&amp;gt;, and now when there are events sent to this area our new script will be triggered and handle them.&lt;br /&gt;
&lt;br /&gt;
=== Passing execution to other event handlers ===&lt;br /&gt;
&lt;br /&gt;
There is just one problem remaining to be resolved now. As mentioned above, the &amp;lt;code&amp;gt;area_core&amp;lt;/code&amp;gt; script normally handles a variety of events that are sent to areas. Now that we've replaced the default event handler with our custom script, and our script only responds to one specific event, there's nothing responding to the rest of the events coming into the area any more. Our custom script has preempted and therefore effectively disabled all the default area event processing by not responding to every possible area event.&lt;br /&gt;
&lt;br /&gt;
We don't want to re-implement all that default event handling in our own script, for a variety of reasons; it's a lot of work, we could make mistakes, and it would be difficult to update the default event handling across all of our areas in the future. Fortunately there's an easy way to tell Dragon Age to use another script to handle events; namely, the &amp;lt;code&amp;gt;[[HandleEvent]]&amp;lt;/code&amp;gt; function. It takes two parameters, the event object to be handled and an identifier for the script that should handle it.&lt;br /&gt;
&lt;br /&gt;
A set of constants defining identifiers for the common default scripts is in the &amp;lt;code&amp;gt;global_objects_h&amp;lt;/code&amp;gt; header file, but we won't need to include that because &amp;lt;code&amp;gt;wrappers_h&amp;lt;/code&amp;gt; includes it already. So all we need to do is insert the following line after our switch statement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(The RESOURCE_SCRIPT_AREA_CORE constant is defined in global_objects_h, which we don't need to include explicitly in this case because it's already included in wrappers_h.)&lt;br /&gt;
&lt;br /&gt;
With this addition, whenever any event is sent to the hut_interior area, first our script will run and process the event, and then it will send it on to &amp;lt;code&amp;gt;area_core&amp;lt;/code&amp;gt; to handle the default area processing normally done when no custom event handling script is being used.&lt;br /&gt;
&lt;br /&gt;
The final text of our script, then, is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;events_h&amp;quot;&lt;br /&gt;
#include &amp;quot;plt_clear_The_hut&amp;quot;&lt;br /&gt;
#include &amp;quot;wrappers_h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{   &lt;br /&gt;
    event ev = GetCurrentEvent();&lt;br /&gt;
    int nEventType = GetEventType(ev);&lt;br /&gt;
    &lt;br /&gt;
    switch(nEventType)&lt;br /&gt;
    {&lt;br /&gt;
         case EVENT_TYPE_TEAM_DESTROYED:&lt;br /&gt;
         {&lt;br /&gt;
              if(GetEventInteger(ev,0) == 1)&lt;br /&gt;
              {&lt;br /&gt;
                   WR_SetPlotFlag(PLT_CLEAR_THE_HUT, MONSTERS_SLAIN, TRUE);&lt;br /&gt;
              }&lt;br /&gt;
              break;&lt;br /&gt;
         }&lt;br /&gt;
    }&lt;br /&gt;
    HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>TrueKeaton</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Scripting_tutorial&amp;diff=12512</id>
		<title>Scripting tutorial</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Scripting_tutorial&amp;diff=12512"/>
				<updated>2010-03-11T21:33:08Z</updated>
		
		<summary type="html">&lt;p&gt;TrueKeaton: /* Passing execution to other event handlers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox script}}&lt;br /&gt;
The final piece of the puzzle in our little tutorial game is getting the &amp;lt;code&amp;gt;MONSTERS_SLAIN&amp;lt;/code&amp;gt; flag set on our plot so that when the hero succeeds in his quest, the quest giver will know about it. This is done via scripting.&lt;br /&gt;
&lt;br /&gt;
Scripting is a programming language with a syntax similar to C. This tutorial assumes a small amount of programming knowledge but hopefully it will be possible even for one with no experience to pick up the basics here.&lt;br /&gt;
&lt;br /&gt;
== Dragon Age's event-driven model ==&lt;br /&gt;
&lt;br /&gt;
In Dragon Age scripts are primarily event-driven. An &amp;quot;event&amp;quot; is a package of information in a special format that gets passed around in the game to trigger behaviour. They are generated by other scripts or the game engine and are passed to an object's event-handling script.&lt;br /&gt;
&lt;br /&gt;
Events have a type, a target object, a time delay and a package of parameters (arbitrary number of ints, objects, floats and strings).&lt;br /&gt;
&lt;br /&gt;
As an example, the &amp;quot;&amp;lt;code&amp;gt;[[EVENT_TYPE_ATTACK_IMPACT]]&amp;lt;/code&amp;gt;&amp;quot; event is sent by the game engine whenever an attack hits a target. It contains the identities of the attacker and the target, whether the attack was a critical hit, and the amount of damage that the attack did. It is sent to an event-handling script attached to the attacker, which takes the information it contains and handles it in whatever way is appropriate (reducing the target's hit points, usually).&lt;br /&gt;
&lt;br /&gt;
For our purposes right now we're not going to need to generate any events of our own. We have set all of the hut monsters to be members of team 1, and the game has a built-in feature that will generate an event when all of the members of a particular team of creatures has been killed. Our new script will respond to that event by setting the plot flag so that when the hut monsters are all defeated, the plot will change to indicate the quest objective has been accomplished.&lt;br /&gt;
&lt;br /&gt;
An enormous list of events for all occasions can be found at the [[Event (dascript type)|event]] page. The one we're going to want our script to look for is &amp;lt;code&amp;gt;[[EVENT_TYPE_TEAM_DESTROYED]]&amp;lt;/code&amp;gt;, which is sent when the last member of a team of creatures is destroyed. The event contains the team number within it.&lt;br /&gt;
&lt;br /&gt;
== Creating a basic event-handling script ==&lt;br /&gt;
&lt;br /&gt;
Start by creating a new script resource. We'll call our script &amp;quot;&amp;lt;code&amp;gt;hut_monsters_slain&amp;lt;/code&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In most cases when a script is run the scripting engine will start with a function named &amp;quot;&amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt;&amp;quot;. So for most scripts you'll want to start with this very basic beginning:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The code that will perform our tasks will be inserted between the { and } brackets. &amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt; doesn't return any results directly, so the function's return type is &amp;quot;&amp;lt;code&amp;gt;[[void]]&amp;lt;/code&amp;gt;&amp;quot;, and it takes no parameters, so the parameter list is an empty ().&lt;br /&gt;
&lt;br /&gt;
=== Event type constants ===&lt;br /&gt;
&lt;br /&gt;
Next we're going to need to make sure the script will know what we're talking about when we make references to events. The tag that tells us the type of each event is actually represented internally by a number, but since it would be impossible for a programmer to keep track of all the different event numbers without making hard-to-find mistakes Dragon Age has instead used named constants to represent them in a more human-readable name.&lt;br /&gt;
&lt;br /&gt;
Those constants are defined in the script &amp;lt;code&amp;gt;events_h&amp;lt;/code&amp;gt;.  The &amp;quot;&amp;lt;code&amp;gt;_h&amp;lt;/code&amp;gt;&amp;quot; suffix stands for &amp;quot;header&amp;quot;, which is a special class of script that contains only various definitions meant to be included in other scripts and doesn't do anything on its own.&lt;br /&gt;
&lt;br /&gt;
To include the header file, add this line to the top of our script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#include &amp;quot;events_h&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All &amp;lt;code&amp;gt;#include&amp;lt;/code&amp;gt; commands should be at the top of your script before anything else, but if there's more than one it shouldn't matter what order they are in.&lt;br /&gt;
&lt;br /&gt;
To see whether our script now knows what &amp;lt;code&amp;gt;[[EVENT_TYPE_TEAM_DESTROYED]]&amp;lt;/code&amp;gt; means you can use the constant browser on the right edge of the script editor to check if it's listed. The browser defaults to showing a list of all defined functions (the &amp;quot;f()&amp;quot; button), to set it to show all defined constants click on the &amp;quot;C&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scripting constant browser.png]]&lt;br /&gt;
&lt;br /&gt;
Even without any included files the list of defined constants is going to be quite long, and for scripts with many include files it can be very difficult to find any particular constant - especially if you aren't sure exactly what its name is. To find constants more easily, type any part of its name into the filter field at the top.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scripting constant browser filtered.png]]&lt;br /&gt;
&lt;br /&gt;
To insert the constant into the script at the location where the cursor is currently located, simply double-click on the constant in the constant browser. This avoids any risk of making a typo. You can also type the beginning of the constant (or any function, etc.) and press Ctrl-Space to see a list of matching values.&lt;br /&gt;
&lt;br /&gt;
=== Extracting information about the current event ===&lt;br /&gt;
&lt;br /&gt;
When an event is sent to a script the script's &amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt; function will be run, but it won't know anything about the event that caused it to be run without some explicit instructions.&lt;br /&gt;
&lt;br /&gt;
First, you will need to retrieve the package of data that is the event. We'll define a variable named &amp;lt;code&amp;gt;ev&amp;lt;/code&amp;gt; that will hold this package, and set it to the &amp;quot;&amp;lt;code&amp;gt;event&amp;lt;/code&amp;gt;&amp;quot; data type. To retrieve the current event and stick it into that variable, we'll use the engine-defined function &amp;lt;code&amp;gt;[[GetCurrentEvent]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The first line of the main function will therefore be:&lt;br /&gt;
&amp;lt;code&amp;gt;event ev = GetCurrentEvent();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Every event will have an event type. As described above, this event type is represented internally by an integer. We'll create an integer variable named &amp;lt;code&amp;gt;nEventType&amp;lt;/code&amp;gt; to hold it, and use the &amp;lt;code&amp;gt;GetEventType&amp;lt;/code&amp;gt; function to extract it from &amp;lt;code&amp;gt;ev&amp;lt;/code&amp;gt;. The next line will be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;int nEventType = [[GetEventType]](ev);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rest of the information packaged with the event depends on exactly what kind of event it is, so the rest of the code we write will be event-specific. To make sure only the correct code is run we'll use a &amp;lt;code&amp;gt;switch&amp;lt;/code&amp;gt; statement. We're only looking for one particular event so we could just as easily have used an &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement but a &amp;lt;code&amp;gt;switch&amp;lt;/code&amp;gt; is more extendable for future use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
switch(nEventType)&lt;br /&gt;
    {&lt;br /&gt;
         case EVENT_TYPE_TEAM_DESTROYED:&lt;br /&gt;
         {&lt;br /&gt;
             //our event-specific code goes here&lt;br /&gt;
             break;&lt;br /&gt;
         }&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We know from the documentation for the &amp;lt;code&amp;gt;[[EVENT_TYPE_TEAM_DESTROYED]]&amp;lt;/code&amp;gt; event, that it comes with a single piece of information; the team number. It's an integer, so we can extract it with the &amp;lt;code&amp;gt;[[GetEventInteger]]&amp;lt;/code&amp;gt; function. &amp;lt;code&amp;gt;[[GetEventInteger]]&amp;lt;/code&amp;gt; takes two parameters, the event object (which we've stored in the variable &amp;lt;code&amp;gt;ev&amp;lt;/code&amp;gt;) and the index of the integer we want, in this case 0 (this is listed in the documentation).&lt;br /&gt;
&lt;br /&gt;
We also know that the team number we gave the hut monsters is 1, so we want to update the plot only when we receive an event indicating that team number 1 has been destroyed. We can do this with an &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (GetEventInteger(ev,0) == 1)&lt;br /&gt;
{&lt;br /&gt;
    //code to update the plot here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interacting with plots ==&lt;br /&gt;
&lt;br /&gt;
To interact with a plot's flags you'll need to have some way for the script to know where the plot flags are and what they're named. This is done in a similar manner to how we told the script what the event types were named; by including the plot file in the script.&lt;br /&gt;
&lt;br /&gt;
Plots are not the same as regular scripts, though, so when including them they are distinguished from regular scripts through the use of a &amp;lt;code&amp;gt;plt_&amp;lt;/code&amp;gt; prefix in their name. The plot we wish to interact with is called &amp;lt;code&amp;gt;clear_the_hut&amp;lt;/code&amp;gt;, so at the top of the script file you'll need to put the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#include &amp;quot;plt_clear_the_hut&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now your script will have access to the plot's flags and will be able to read or change them. You'll find that several new constants have been defined; &amp;lt;code&amp;gt;PLT_CLEAR_THE_HUT&amp;lt;/code&amp;gt; contains the plot object, and the integer constants &amp;lt;code&amp;gt;MONSTERS_SLAIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;QUEST_ACCEPTED&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;REWARD_RECEIVED&amp;lt;/code&amp;gt; identify the flags within the plot.&lt;br /&gt;
&lt;br /&gt;
Changing the state of the flags is done with the &amp;lt;code&amp;gt;WR_SetPlotFlag&amp;lt;/code&amp;gt; function that is defined in the include file &amp;lt;code&amp;gt;wrappers_h&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;wrappers_h&amp;lt;/code&amp;gt; contains a variety of utility functions that handle operations requiring low-level access to the game. Add &amp;lt;code&amp;gt;#include &amp;quot;wrappers_h&amp;quot;&amp;lt;/code&amp;gt; to the top of your script). In our case, we want to set the plot flag &amp;lt;code&amp;gt;MONSTERS_SLAIN&amp;lt;/code&amp;gt;. The &amp;lt;code&amp;gt;WR_SetPlotFlag&amp;lt;/code&amp;gt; function takes three parameters; the plot identifier, the flag identifier, and the state we want to set it to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WR_SetPlotFlag(&amp;quot;PLT_CLEAR_THE_HUT&amp;quot;, MONSTERS_SLAIN, TRUE);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Associating an event script with an object ==&lt;br /&gt;
&lt;br /&gt;
The script is almost complete now, but until we've linked it up to some object in the game that can receive events it will never actually be run.&lt;br /&gt;
&lt;br /&gt;
Most objects in the game will have a field named &amp;quot;Script&amp;quot; shown in the object inspector. According to the documentation for the &amp;lt;code&amp;gt;EVENT_TYPE_TEAM_DESTROYED&amp;lt;/code&amp;gt; event it is sent to the area object the team is in, so we'll want to open the hut_interior area now and go to its Script entry. The default event script for areas is &amp;lt;code&amp;gt;area_core&amp;lt;/code&amp;gt;, which handles basic area events in a default way.&lt;br /&gt;
&lt;br /&gt;
This is where you'll want to put the &amp;lt;code&amp;gt;hut_monsters_slain&amp;lt;/code&amp;gt; script. Click on the ellipsis ([[Image:ellipsis.png]]) button and select the new script. It will replace &amp;lt;code&amp;gt;area_core&amp;lt;/code&amp;gt;, and now when there are events sent to this area our new script will be triggered and handle them.&lt;br /&gt;
&lt;br /&gt;
=== Passing execution to other event handlers ===&lt;br /&gt;
&lt;br /&gt;
There is just one problem remaining to be resolved now. As mentioned above, the &amp;lt;code&amp;gt;area_core&amp;lt;/code&amp;gt; script normally handles a variety of events that are sent to areas. Now that we've replaced the default event handler with our custom script, and our script only responds to one specific event, there's nothing responding to the rest of the events coming into the area any more. Our custom script has preempted and therefore effectively disabled all the default area event processing by not responding to every possible area event.&lt;br /&gt;
&lt;br /&gt;
We don't want to re-implement all that default event handling in our own script, for a variety of reasons; it's a lot of work, we could make mistakes, and it would be difficult to update the default event handling across all of our areas in the future. Fortunately there's an easy way to tell Dragon Age to use another script to handle events; namely, the &amp;lt;code&amp;gt;[[HandleEvent]]&amp;lt;/code&amp;gt; function. It takes two parameters, the event object to be handled and an identifier for the script that should handle it.&lt;br /&gt;
&lt;br /&gt;
A set of constants defining identifiers for the common default scripts is in the &amp;lt;code&amp;gt;global_objects_h&amp;lt;/code&amp;gt; header file, but we won't need to include that because &amp;lt;code&amp;gt;wrappers_h&amp;lt;/code&amp;gt; includes it already. So all we need to do is insert the following line after our switch statement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(The RESOURCE_SCRIPT_AREA_CORE constant is defined in global_objects_h, which we don't need to include explicitly in this case because it's already included in wrappers_h.)&lt;br /&gt;
&lt;br /&gt;
With this addition, whenever any event is sent to the hut_interior area, first our script will run and process the event, and then it will send it on to &amp;lt;code&amp;gt;area_core&amp;lt;/code&amp;gt; to handle the default area processing normally done when no custom event handling script is being used.&lt;br /&gt;
&lt;br /&gt;
The final text of our script, then, is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;events_h&amp;quot;&lt;br /&gt;
#include &amp;quot;plt_clear_The_hut&amp;quot;&lt;br /&gt;
#include &amp;quot;wrappers_h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{   &lt;br /&gt;
    event ev = GetCurrentEvent();&lt;br /&gt;
    int nEventType = GetEventType(ev);&lt;br /&gt;
    &lt;br /&gt;
    switch(nEventType)&lt;br /&gt;
    {&lt;br /&gt;
         case EVENT_TYPE_TEAM_DESTROYED:&lt;br /&gt;
         {&lt;br /&gt;
              if(GetEventInteger(ev,0) == 1)&lt;br /&gt;
              {&lt;br /&gt;
                   WR_SetPlotFlag(PLT_CLEAR_THE_HUT, MONSTERS_SLAIN, TRUE);&lt;br /&gt;
              }&lt;br /&gt;
              break;&lt;br /&gt;
         }&lt;br /&gt;
    }&lt;br /&gt;
    HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>TrueKeaton</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Scripting_tutorial&amp;diff=12511</id>
		<title>Scripting tutorial</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Scripting_tutorial&amp;diff=12511"/>
				<updated>2010-03-11T21:02:54Z</updated>
		
		<summary type="html">&lt;p&gt;TrueKeaton: /* Interacting with plots */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox script}}&lt;br /&gt;
The final piece of the puzzle in our little tutorial game is getting the &amp;lt;code&amp;gt;MONSTERS_SLAIN&amp;lt;/code&amp;gt; flag set on our plot so that when the hero succeeds in his quest, the quest giver will know about it. This is done via scripting.&lt;br /&gt;
&lt;br /&gt;
Scripting is a programming language with a syntax similar to C. This tutorial assumes a small amount of programming knowledge but hopefully it will be possible even for one with no experience to pick up the basics here.&lt;br /&gt;
&lt;br /&gt;
== Dragon Age's event-driven model ==&lt;br /&gt;
&lt;br /&gt;
In Dragon Age scripts are primarily event-driven. An &amp;quot;event&amp;quot; is a package of information in a special format that gets passed around in the game to trigger behaviour. They are generated by other scripts or the game engine and are passed to an object's event-handling script.&lt;br /&gt;
&lt;br /&gt;
Events have a type, a target object, a time delay and a package of parameters (arbitrary number of ints, objects, floats and strings).&lt;br /&gt;
&lt;br /&gt;
As an example, the &amp;quot;&amp;lt;code&amp;gt;[[EVENT_TYPE_ATTACK_IMPACT]]&amp;lt;/code&amp;gt;&amp;quot; event is sent by the game engine whenever an attack hits a target. It contains the identities of the attacker and the target, whether the attack was a critical hit, and the amount of damage that the attack did. It is sent to an event-handling script attached to the attacker, which takes the information it contains and handles it in whatever way is appropriate (reducing the target's hit points, usually).&lt;br /&gt;
&lt;br /&gt;
For our purposes right now we're not going to need to generate any events of our own. We have set all of the hut monsters to be members of team 1, and the game has a built-in feature that will generate an event when all of the members of a particular team of creatures has been killed. Our new script will respond to that event by setting the plot flag so that when the hut monsters are all defeated, the plot will change to indicate the quest objective has been accomplished.&lt;br /&gt;
&lt;br /&gt;
An enormous list of events for all occasions can be found at the [[Event (dascript type)|event]] page. The one we're going to want our script to look for is &amp;lt;code&amp;gt;[[EVENT_TYPE_TEAM_DESTROYED]]&amp;lt;/code&amp;gt;, which is sent when the last member of a team of creatures is destroyed. The event contains the team number within it.&lt;br /&gt;
&lt;br /&gt;
== Creating a basic event-handling script ==&lt;br /&gt;
&lt;br /&gt;
Start by creating a new script resource. We'll call our script &amp;quot;&amp;lt;code&amp;gt;hut_monsters_slain&amp;lt;/code&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In most cases when a script is run the scripting engine will start with a function named &amp;quot;&amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt;&amp;quot;. So for most scripts you'll want to start with this very basic beginning:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The code that will perform our tasks will be inserted between the { and } brackets. &amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt; doesn't return any results directly, so the function's return type is &amp;quot;&amp;lt;code&amp;gt;[[void]]&amp;lt;/code&amp;gt;&amp;quot;, and it takes no parameters, so the parameter list is an empty ().&lt;br /&gt;
&lt;br /&gt;
=== Event type constants ===&lt;br /&gt;
&lt;br /&gt;
Next we're going to need to make sure the script will know what we're talking about when we make references to events. The tag that tells us the type of each event is actually represented internally by a number, but since it would be impossible for a programmer to keep track of all the different event numbers without making hard-to-find mistakes Dragon Age has instead used named constants to represent them in a more human-readable name.&lt;br /&gt;
&lt;br /&gt;
Those constants are defined in the script &amp;lt;code&amp;gt;events_h&amp;lt;/code&amp;gt;.  The &amp;quot;&amp;lt;code&amp;gt;_h&amp;lt;/code&amp;gt;&amp;quot; suffix stands for &amp;quot;header&amp;quot;, which is a special class of script that contains only various definitions meant to be included in other scripts and doesn't do anything on its own.&lt;br /&gt;
&lt;br /&gt;
To include the header file, add this line to the top of our script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#include &amp;quot;events_h&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All &amp;lt;code&amp;gt;#include&amp;lt;/code&amp;gt; commands should be at the top of your script before anything else, but if there's more than one it shouldn't matter what order they are in.&lt;br /&gt;
&lt;br /&gt;
To see whether our script now knows what &amp;lt;code&amp;gt;[[EVENT_TYPE_TEAM_DESTROYED]]&amp;lt;/code&amp;gt; means you can use the constant browser on the right edge of the script editor to check if it's listed. The browser defaults to showing a list of all defined functions (the &amp;quot;f()&amp;quot; button), to set it to show all defined constants click on the &amp;quot;C&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scripting constant browser.png]]&lt;br /&gt;
&lt;br /&gt;
Even without any included files the list of defined constants is going to be quite long, and for scripts with many include files it can be very difficult to find any particular constant - especially if you aren't sure exactly what its name is. To find constants more easily, type any part of its name into the filter field at the top.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scripting constant browser filtered.png]]&lt;br /&gt;
&lt;br /&gt;
To insert the constant into the script at the location where the cursor is currently located, simply double-click on the constant in the constant browser. This avoids any risk of making a typo. You can also type the beginning of the constant (or any function, etc.) and press Ctrl-Space to see a list of matching values.&lt;br /&gt;
&lt;br /&gt;
=== Extracting information about the current event ===&lt;br /&gt;
&lt;br /&gt;
When an event is sent to a script the script's &amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt; function will be run, but it won't know anything about the event that caused it to be run without some explicit instructions.&lt;br /&gt;
&lt;br /&gt;
First, you will need to retrieve the package of data that is the event. We'll define a variable named &amp;lt;code&amp;gt;ev&amp;lt;/code&amp;gt; that will hold this package, and set it to the &amp;quot;&amp;lt;code&amp;gt;event&amp;lt;/code&amp;gt;&amp;quot; data type. To retrieve the current event and stick it into that variable, we'll use the engine-defined function &amp;lt;code&amp;gt;[[GetCurrentEvent]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The first line of the main function will therefore be:&lt;br /&gt;
&amp;lt;code&amp;gt;event ev = GetCurrentEvent();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Every event will have an event type. As described above, this event type is represented internally by an integer. We'll create an integer variable named &amp;lt;code&amp;gt;nEventType&amp;lt;/code&amp;gt; to hold it, and use the &amp;lt;code&amp;gt;GetEventType&amp;lt;/code&amp;gt; function to extract it from &amp;lt;code&amp;gt;ev&amp;lt;/code&amp;gt;. The next line will be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;int nEventType = [[GetEventType]](ev);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rest of the information packaged with the event depends on exactly what kind of event it is, so the rest of the code we write will be event-specific. To make sure only the correct code is run we'll use a &amp;lt;code&amp;gt;switch&amp;lt;/code&amp;gt; statement. We're only looking for one particular event so we could just as easily have used an &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement but a &amp;lt;code&amp;gt;switch&amp;lt;/code&amp;gt; is more extendable for future use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
switch(nEventType)&lt;br /&gt;
    {&lt;br /&gt;
         case EVENT_TYPE_TEAM_DESTROYED:&lt;br /&gt;
         {&lt;br /&gt;
             //our event-specific code goes here&lt;br /&gt;
             break;&lt;br /&gt;
         }&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We know from the documentation for the &amp;lt;code&amp;gt;[[EVENT_TYPE_TEAM_DESTROYED]]&amp;lt;/code&amp;gt; event, that it comes with a single piece of information; the team number. It's an integer, so we can extract it with the &amp;lt;code&amp;gt;[[GetEventInteger]]&amp;lt;/code&amp;gt; function. &amp;lt;code&amp;gt;[[GetEventInteger]]&amp;lt;/code&amp;gt; takes two parameters, the event object (which we've stored in the variable &amp;lt;code&amp;gt;ev&amp;lt;/code&amp;gt;) and the index of the integer we want, in this case 0 (this is listed in the documentation).&lt;br /&gt;
&lt;br /&gt;
We also know that the team number we gave the hut monsters is 1, so we want to update the plot only when we receive an event indicating that team number 1 has been destroyed. We can do this with an &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (GetEventInteger(ev,0) == 1)&lt;br /&gt;
{&lt;br /&gt;
    //code to update the plot here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interacting with plots ==&lt;br /&gt;
&lt;br /&gt;
To interact with a plot's flags you'll need to have some way for the script to know where the plot flags are and what they're named. This is done in a similar manner to how we told the script what the event types were named; by including the plot file in the script.&lt;br /&gt;
&lt;br /&gt;
Plots are not the same as regular scripts, though, so when including them they are distinguished from regular scripts through the use of a &amp;lt;code&amp;gt;plt_&amp;lt;/code&amp;gt; prefix in their name. The plot we wish to interact with is called &amp;lt;code&amp;gt;clear_the_hut&amp;lt;/code&amp;gt;, so at the top of the script file you'll need to put the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#include &amp;quot;plt_clear_the_hut&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now your script will have access to the plot's flags and will be able to read or change them. You'll find that several new constants have been defined; &amp;lt;code&amp;gt;PLT_CLEAR_THE_HUT&amp;lt;/code&amp;gt; contains the plot object, and the integer constants &amp;lt;code&amp;gt;MONSTERS_SLAIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;QUEST_ACCEPTED&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;REWARD_RECEIVED&amp;lt;/code&amp;gt; identify the flags within the plot.&lt;br /&gt;
&lt;br /&gt;
Changing the state of the flags is done with the &amp;lt;code&amp;gt;WR_SetPlotFlag&amp;lt;/code&amp;gt; function that is defined in the include file &amp;lt;code&amp;gt;wrappers_h&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;wrappers_h&amp;lt;/code&amp;gt; contains a variety of utility functions that handle operations requiring low-level access to the game. Add &amp;lt;code&amp;gt;#include &amp;quot;wrappers_h&amp;quot;&amp;lt;/code&amp;gt; to the top of your script). In our case, we want to set the plot flag &amp;lt;code&amp;gt;MONSTERS_SLAIN&amp;lt;/code&amp;gt;. The &amp;lt;code&amp;gt;WR_SetPlotFlag&amp;lt;/code&amp;gt; function takes three parameters; the plot identifier, the flag identifier, and the state we want to set it to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WR_SetPlotFlag(&amp;quot;PLT_CLEAR_THE_HUT&amp;quot;, MONSTERS_SLAIN, TRUE);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Associating an event script with an object ==&lt;br /&gt;
&lt;br /&gt;
The script is almost complete now, but until we've linked it up to some object in the game that can receive events it will never actually be run.&lt;br /&gt;
&lt;br /&gt;
Most objects in the game will have a field named &amp;quot;Script&amp;quot; shown in the object inspector. According to the documentation for the &amp;lt;code&amp;gt;EVENT_TYPE_TEAM_DESTROYED&amp;lt;/code&amp;gt; event it is sent to the area object the team is in, so we'll want to open the hut_interior area now and go to its Script entry. The default event script for areas is &amp;lt;code&amp;gt;area_core&amp;lt;/code&amp;gt;, which handles basic area events in a default way.&lt;br /&gt;
&lt;br /&gt;
This is where you'll want to put the &amp;lt;code&amp;gt;hut_monsters_slain&amp;lt;/code&amp;gt; script. Click on the ellipsis ([[Image:ellipsis.png]]) button and select the new script. It will replace &amp;lt;code&amp;gt;area_core&amp;lt;/code&amp;gt;, and now when there are events sent to this area our new script will be triggered and handle them.&lt;br /&gt;
&lt;br /&gt;
=== Passing execution to other event handlers ===&lt;br /&gt;
&lt;br /&gt;
There is just one problem remaining to be resolved now. As mentioned above, the &amp;lt;code&amp;gt;area_core&amp;lt;/code&amp;gt; script normally handles a variety of events that are sent to areas. Now that we've replaced the default event handler with our custom script, and our script only responds to one specific event, there's nothing responding to the rest of the events coming into the area any more. Our custom script has preempted and therefore effectively disabled all the default area event processing by not responding to every possible area event.&lt;br /&gt;
&lt;br /&gt;
We don't want to re-implement all that default event handling in our own script, for a variety of reasons; it's a lot of work, we could make mistakes, and it would be difficult to update the default event handling across all of our areas in the future. Fortunately there's an easy way to tell Dragon Age to use another script to handle events; namely, the &amp;lt;code&amp;gt;[[HandleEvent]]&amp;lt;/code&amp;gt; function. It takes two parameters, the event object to be handled and an identifier for the script that should handle it.&lt;br /&gt;
&lt;br /&gt;
A set of constants defining identifiers for the common default scripts is in the &amp;lt;code&amp;gt;global_objects_h&amp;lt;/code&amp;gt; header file, but we won't need to include that because &amp;lt;code&amp;gt;wrappers_h&amp;lt;/code&amp;gt; includes it already. So all we need to do is insert the following line after our switch statement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(The RESOURCE_SCRIPT_AREA_CORE constant is defined in global_objects_h, which we don't need to include explicitly in this case because it's already included in wrappers_h.)&lt;br /&gt;
&lt;br /&gt;
With this addition, whenever any event is sent to the hut_interior area, first our script will run and process the event, and then it will send it on to &amp;lt;code&amp;gt;area_core&amp;lt;/code&amp;gt; to handle the default area processing normally done when no custom event handling script is being used.&lt;br /&gt;
&lt;br /&gt;
The final text of our script, then, is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;events_h&amp;quot;&lt;br /&gt;
#include &amp;quot;plt_clear_The_hut&amp;quot;&lt;br /&gt;
#include &amp;quot;wrappers_h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{   &lt;br /&gt;
    event ev = GetCurrentEvent();&lt;br /&gt;
    int nEventType = GetEventType(ev);&lt;br /&gt;
    &lt;br /&gt;
    switch(nEventType)&lt;br /&gt;
    {&lt;br /&gt;
         case EVENT_TYPE_TEAM_DESTROYED:&lt;br /&gt;
         {&lt;br /&gt;
              if(GetEventInteger(ev,0) == 1)&lt;br /&gt;
              {&lt;br /&gt;
                   WR_SetPlotFlag(&amp;quot;PLT_CLEAR_THE_HUT&amp;quot;, MONSTERS_SLAIN, TRUE);&lt;br /&gt;
              }&lt;br /&gt;
              break;&lt;br /&gt;
         }&lt;br /&gt;
    }&lt;br /&gt;
    HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>TrueKeaton</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Scripting_tutorial&amp;diff=12510</id>
		<title>Scripting tutorial</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Scripting_tutorial&amp;diff=12510"/>
				<updated>2010-03-11T21:02:44Z</updated>
		
		<summary type="html">&lt;p&gt;TrueKeaton: /* Passing execution to other event handlers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox script}}&lt;br /&gt;
The final piece of the puzzle in our little tutorial game is getting the &amp;lt;code&amp;gt;MONSTERS_SLAIN&amp;lt;/code&amp;gt; flag set on our plot so that when the hero succeeds in his quest, the quest giver will know about it. This is done via scripting.&lt;br /&gt;
&lt;br /&gt;
Scripting is a programming language with a syntax similar to C. This tutorial assumes a small amount of programming knowledge but hopefully it will be possible even for one with no experience to pick up the basics here.&lt;br /&gt;
&lt;br /&gt;
== Dragon Age's event-driven model ==&lt;br /&gt;
&lt;br /&gt;
In Dragon Age scripts are primarily event-driven. An &amp;quot;event&amp;quot; is a package of information in a special format that gets passed around in the game to trigger behaviour. They are generated by other scripts or the game engine and are passed to an object's event-handling script.&lt;br /&gt;
&lt;br /&gt;
Events have a type, a target object, a time delay and a package of parameters (arbitrary number of ints, objects, floats and strings).&lt;br /&gt;
&lt;br /&gt;
As an example, the &amp;quot;&amp;lt;code&amp;gt;[[EVENT_TYPE_ATTACK_IMPACT]]&amp;lt;/code&amp;gt;&amp;quot; event is sent by the game engine whenever an attack hits a target. It contains the identities of the attacker and the target, whether the attack was a critical hit, and the amount of damage that the attack did. It is sent to an event-handling script attached to the attacker, which takes the information it contains and handles it in whatever way is appropriate (reducing the target's hit points, usually).&lt;br /&gt;
&lt;br /&gt;
For our purposes right now we're not going to need to generate any events of our own. We have set all of the hut monsters to be members of team 1, and the game has a built-in feature that will generate an event when all of the members of a particular team of creatures has been killed. Our new script will respond to that event by setting the plot flag so that when the hut monsters are all defeated, the plot will change to indicate the quest objective has been accomplished.&lt;br /&gt;
&lt;br /&gt;
An enormous list of events for all occasions can be found at the [[Event (dascript type)|event]] page. The one we're going to want our script to look for is &amp;lt;code&amp;gt;[[EVENT_TYPE_TEAM_DESTROYED]]&amp;lt;/code&amp;gt;, which is sent when the last member of a team of creatures is destroyed. The event contains the team number within it.&lt;br /&gt;
&lt;br /&gt;
== Creating a basic event-handling script ==&lt;br /&gt;
&lt;br /&gt;
Start by creating a new script resource. We'll call our script &amp;quot;&amp;lt;code&amp;gt;hut_monsters_slain&amp;lt;/code&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In most cases when a script is run the scripting engine will start with a function named &amp;quot;&amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt;&amp;quot;. So for most scripts you'll want to start with this very basic beginning:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The code that will perform our tasks will be inserted between the { and } brackets. &amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt; doesn't return any results directly, so the function's return type is &amp;quot;&amp;lt;code&amp;gt;[[void]]&amp;lt;/code&amp;gt;&amp;quot;, and it takes no parameters, so the parameter list is an empty ().&lt;br /&gt;
&lt;br /&gt;
=== Event type constants ===&lt;br /&gt;
&lt;br /&gt;
Next we're going to need to make sure the script will know what we're talking about when we make references to events. The tag that tells us the type of each event is actually represented internally by a number, but since it would be impossible for a programmer to keep track of all the different event numbers without making hard-to-find mistakes Dragon Age has instead used named constants to represent them in a more human-readable name.&lt;br /&gt;
&lt;br /&gt;
Those constants are defined in the script &amp;lt;code&amp;gt;events_h&amp;lt;/code&amp;gt;.  The &amp;quot;&amp;lt;code&amp;gt;_h&amp;lt;/code&amp;gt;&amp;quot; suffix stands for &amp;quot;header&amp;quot;, which is a special class of script that contains only various definitions meant to be included in other scripts and doesn't do anything on its own.&lt;br /&gt;
&lt;br /&gt;
To include the header file, add this line to the top of our script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#include &amp;quot;events_h&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All &amp;lt;code&amp;gt;#include&amp;lt;/code&amp;gt; commands should be at the top of your script before anything else, but if there's more than one it shouldn't matter what order they are in.&lt;br /&gt;
&lt;br /&gt;
To see whether our script now knows what &amp;lt;code&amp;gt;[[EVENT_TYPE_TEAM_DESTROYED]]&amp;lt;/code&amp;gt; means you can use the constant browser on the right edge of the script editor to check if it's listed. The browser defaults to showing a list of all defined functions (the &amp;quot;f()&amp;quot; button), to set it to show all defined constants click on the &amp;quot;C&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scripting constant browser.png]]&lt;br /&gt;
&lt;br /&gt;
Even without any included files the list of defined constants is going to be quite long, and for scripts with many include files it can be very difficult to find any particular constant - especially if you aren't sure exactly what its name is. To find constants more easily, type any part of its name into the filter field at the top.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scripting constant browser filtered.png]]&lt;br /&gt;
&lt;br /&gt;
To insert the constant into the script at the location where the cursor is currently located, simply double-click on the constant in the constant browser. This avoids any risk of making a typo. You can also type the beginning of the constant (or any function, etc.) and press Ctrl-Space to see a list of matching values.&lt;br /&gt;
&lt;br /&gt;
=== Extracting information about the current event ===&lt;br /&gt;
&lt;br /&gt;
When an event is sent to a script the script's &amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt; function will be run, but it won't know anything about the event that caused it to be run without some explicit instructions.&lt;br /&gt;
&lt;br /&gt;
First, you will need to retrieve the package of data that is the event. We'll define a variable named &amp;lt;code&amp;gt;ev&amp;lt;/code&amp;gt; that will hold this package, and set it to the &amp;quot;&amp;lt;code&amp;gt;event&amp;lt;/code&amp;gt;&amp;quot; data type. To retrieve the current event and stick it into that variable, we'll use the engine-defined function &amp;lt;code&amp;gt;[[GetCurrentEvent]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The first line of the main function will therefore be:&lt;br /&gt;
&amp;lt;code&amp;gt;event ev = GetCurrentEvent();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Every event will have an event type. As described above, this event type is represented internally by an integer. We'll create an integer variable named &amp;lt;code&amp;gt;nEventType&amp;lt;/code&amp;gt; to hold it, and use the &amp;lt;code&amp;gt;GetEventType&amp;lt;/code&amp;gt; function to extract it from &amp;lt;code&amp;gt;ev&amp;lt;/code&amp;gt;. The next line will be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;int nEventType = [[GetEventType]](ev);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rest of the information packaged with the event depends on exactly what kind of event it is, so the rest of the code we write will be event-specific. To make sure only the correct code is run we'll use a &amp;lt;code&amp;gt;switch&amp;lt;/code&amp;gt; statement. We're only looking for one particular event so we could just as easily have used an &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement but a &amp;lt;code&amp;gt;switch&amp;lt;/code&amp;gt; is more extendable for future use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
switch(nEventType)&lt;br /&gt;
    {&lt;br /&gt;
         case EVENT_TYPE_TEAM_DESTROYED:&lt;br /&gt;
         {&lt;br /&gt;
             //our event-specific code goes here&lt;br /&gt;
             break;&lt;br /&gt;
         }&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We know from the documentation for the &amp;lt;code&amp;gt;[[EVENT_TYPE_TEAM_DESTROYED]]&amp;lt;/code&amp;gt; event, that it comes with a single piece of information; the team number. It's an integer, so we can extract it with the &amp;lt;code&amp;gt;[[GetEventInteger]]&amp;lt;/code&amp;gt; function. &amp;lt;code&amp;gt;[[GetEventInteger]]&amp;lt;/code&amp;gt; takes two parameters, the event object (which we've stored in the variable &amp;lt;code&amp;gt;ev&amp;lt;/code&amp;gt;) and the index of the integer we want, in this case 0 (this is listed in the documentation).&lt;br /&gt;
&lt;br /&gt;
We also know that the team number we gave the hut monsters is 1, so we want to update the plot only when we receive an event indicating that team number 1 has been destroyed. We can do this with an &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (GetEventInteger(ev,0) == 1)&lt;br /&gt;
{&lt;br /&gt;
    //code to update the plot here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interacting with plots ==&lt;br /&gt;
&lt;br /&gt;
To interact with a plot's flags you'll need to have some way for the script to know where the plot flags are and what they're named. This is done in a similar manner to how we told the script what the event types were named; by including the plot file in the script.&lt;br /&gt;
&lt;br /&gt;
Plots are not the same as regular scripts, though, so when including them they are distinguished from regular scripts through the use of a &amp;lt;code&amp;gt;plt_&amp;lt;/code&amp;gt; prefix in their name. The plot we wish to interact with is called &amp;lt;code&amp;gt;clear_the_hut&amp;lt;/code&amp;gt;, so at the top of the script file you'll need to put the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#include &amp;quot;plt_clear_the_hut&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now your script will have access to the plot's flags and will be able to read or change them. You'll find that several new constants have been defined; &amp;lt;code&amp;gt;PLT_CLEAR_THE_HUT&amp;lt;/code&amp;gt; contains the plot object, and the integer constants &amp;lt;code&amp;gt;MONSTERS_SLAIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;QUEST_ACCEPTED&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;REWARD_RECEIVED&amp;lt;/code&amp;gt; identify the flags within the plot.&lt;br /&gt;
&lt;br /&gt;
Changing the state of the flags is done with the &amp;lt;code&amp;gt;WR_SetPlotFlag&amp;lt;/code&amp;gt; function that is defined in the include file &amp;lt;code&amp;gt;wrappers_h&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;wrappers_h&amp;lt;/code&amp;gt; contains a variety of utility functions that handle operations requiring low-level access to the game. Add &amp;lt;code&amp;gt;#include &amp;quot;wrappers_h&amp;quot;&amp;lt;/code&amp;gt; to the top of your script). In our case, we want to set the plot flag &amp;lt;code&amp;gt;MONSTERS_SLAIN&amp;lt;/code&amp;gt;. The &amp;lt;code&amp;gt;WR_SetPlotFlag&amp;lt;/code&amp;gt; function takes three parameters; the plot identifier, the flag identifier, and the state we want to set it to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WR_SetPlotFlag(PLT_CLEAR_THE_HUT, MONSTERS_SLAIN, TRUE);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Associating an event script with an object ==&lt;br /&gt;
&lt;br /&gt;
The script is almost complete now, but until we've linked it up to some object in the game that can receive events it will never actually be run.&lt;br /&gt;
&lt;br /&gt;
Most objects in the game will have a field named &amp;quot;Script&amp;quot; shown in the object inspector. According to the documentation for the &amp;lt;code&amp;gt;EVENT_TYPE_TEAM_DESTROYED&amp;lt;/code&amp;gt; event it is sent to the area object the team is in, so we'll want to open the hut_interior area now and go to its Script entry. The default event script for areas is &amp;lt;code&amp;gt;area_core&amp;lt;/code&amp;gt;, which handles basic area events in a default way.&lt;br /&gt;
&lt;br /&gt;
This is where you'll want to put the &amp;lt;code&amp;gt;hut_monsters_slain&amp;lt;/code&amp;gt; script. Click on the ellipsis ([[Image:ellipsis.png]]) button and select the new script. It will replace &amp;lt;code&amp;gt;area_core&amp;lt;/code&amp;gt;, and now when there are events sent to this area our new script will be triggered and handle them.&lt;br /&gt;
&lt;br /&gt;
=== Passing execution to other event handlers ===&lt;br /&gt;
&lt;br /&gt;
There is just one problem remaining to be resolved now. As mentioned above, the &amp;lt;code&amp;gt;area_core&amp;lt;/code&amp;gt; script normally handles a variety of events that are sent to areas. Now that we've replaced the default event handler with our custom script, and our script only responds to one specific event, there's nothing responding to the rest of the events coming into the area any more. Our custom script has preempted and therefore effectively disabled all the default area event processing by not responding to every possible area event.&lt;br /&gt;
&lt;br /&gt;
We don't want to re-implement all that default event handling in our own script, for a variety of reasons; it's a lot of work, we could make mistakes, and it would be difficult to update the default event handling across all of our areas in the future. Fortunately there's an easy way to tell Dragon Age to use another script to handle events; namely, the &amp;lt;code&amp;gt;[[HandleEvent]]&amp;lt;/code&amp;gt; function. It takes two parameters, the event object to be handled and an identifier for the script that should handle it.&lt;br /&gt;
&lt;br /&gt;
A set of constants defining identifiers for the common default scripts is in the &amp;lt;code&amp;gt;global_objects_h&amp;lt;/code&amp;gt; header file, but we won't need to include that because &amp;lt;code&amp;gt;wrappers_h&amp;lt;/code&amp;gt; includes it already. So all we need to do is insert the following line after our switch statement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(The RESOURCE_SCRIPT_AREA_CORE constant is defined in global_objects_h, which we don't need to include explicitly in this case because it's already included in wrappers_h.)&lt;br /&gt;
&lt;br /&gt;
With this addition, whenever any event is sent to the hut_interior area, first our script will run and process the event, and then it will send it on to &amp;lt;code&amp;gt;area_core&amp;lt;/code&amp;gt; to handle the default area processing normally done when no custom event handling script is being used.&lt;br /&gt;
&lt;br /&gt;
The final text of our script, then, is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;events_h&amp;quot;&lt;br /&gt;
#include &amp;quot;plt_clear_The_hut&amp;quot;&lt;br /&gt;
#include &amp;quot;wrappers_h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{   &lt;br /&gt;
    event ev = GetCurrentEvent();&lt;br /&gt;
    int nEventType = GetEventType(ev);&lt;br /&gt;
    &lt;br /&gt;
    switch(nEventType)&lt;br /&gt;
    {&lt;br /&gt;
         case EVENT_TYPE_TEAM_DESTROYED:&lt;br /&gt;
         {&lt;br /&gt;
              if(GetEventInteger(ev,0) == 1)&lt;br /&gt;
              {&lt;br /&gt;
                   WR_SetPlotFlag(&amp;quot;PLT_CLEAR_THE_HUT&amp;quot;, MONSTERS_SLAIN, TRUE);&lt;br /&gt;
              }&lt;br /&gt;
              break;&lt;br /&gt;
         }&lt;br /&gt;
    }&lt;br /&gt;
    HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>TrueKeaton</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Level_Editor_Tutorial&amp;diff=12508</id>
		<title>Level Editor Tutorial</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Level_Editor_Tutorial&amp;diff=12508"/>
				<updated>2010-03-10T17:07:23Z</updated>
		
		<summary type="html">&lt;p&gt;TrueKeaton: /* Rendering Lightmaps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Building your room (Interior Level)=&lt;br /&gt;
How to create/lightmap a [[Level]] for use in an Interior [[Area]]:&lt;br /&gt;
Objective: Following along with this tutorial, you should be able to create a simple room from scratch in 10 minutes or less&lt;br /&gt;
&lt;br /&gt;
 This was lifted from a posting by St4rdog http://social.bioware.com/forum/1/topic/8/index/150840&lt;br /&gt;
 It needs some additional formatting love, but is as good starting place for people to create usable &lt;br /&gt;
 interior levels&lt;br /&gt;
&lt;br /&gt;
File &amp;gt; New &amp;gt; Level &amp;gt; Room Level&lt;br /&gt;
&lt;br /&gt;
* Click on &amp;quot;New Area&amp;quot; in top-left list &amp;gt; Object Inspector in bottom-right &amp;gt; Layout Name &amp;gt; anything under 8 characters no spaces or special characters (*,&amp;amp;,%, etc).&lt;br /&gt;
&lt;br /&gt;
*Right-click in 3D view and select Insert &amp;gt; New Room.&lt;br /&gt;
*Click Models (blue box) in the Palette in the top-right. These folders contain everything such as floor tiles, walls, etc.&lt;br /&gt;
*Enable Grid Snap with the magnet icon to make sure they line up.&lt;br /&gt;
*The &amp;quot;prp&amp;quot; folder contains things like beds/barrels to clutter your Level.&lt;br /&gt;
 Hint: Use [[DATool]] (3rd party tool downloadable at http://social.bioware.com/project/41/ )to browse &lt;br /&gt;
 through these quickly to find the floors/walls you want.&lt;br /&gt;
&lt;br /&gt;
 Note: If you get &amp;quot;Cannot spawn models into the selected parent object&amp;quot; when trying to place a model &lt;br /&gt;
 then you don't have &amp;quot;New Room&amp;quot; selected.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Working with multiple rooms==&lt;br /&gt;
&lt;br /&gt;
In general it is best to define each building room as a new room in the level. This becomes important when you work on lighting. To physically connect rooms you need to slide them together to get the doors to line up, they do not line up automatically. It takes some trial and error but becomes easier with practice.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Adding lights==&lt;br /&gt;
&lt;br /&gt;
* Right-click on &amp;quot;New Room&amp;quot; in top-left list &amp;gt; Insert &amp;gt; New Light&lt;br /&gt;
&lt;br /&gt;
* Move it up off the floor a little. In Object Inspector &amp;gt; &amp;quot;Color Intensity&amp;quot; 2 or more &amp;gt; &amp;quot;Light Type&amp;quot; Point - Static (lc) &amp;gt; Choose any bright color.&lt;br /&gt;
&lt;br /&gt;
*Copy and paste. In Object Inspector &amp;gt;&amp;quot;Light Type&amp;quot; Ambient - Baked (this light stops your shadows being pitch black) &amp;gt; Choose a dark blue colour and keep the Color Intensity under 2/3.&lt;br /&gt;
&lt;br /&gt;
 Note: I'm not sure what the mix of Baked/Static light is supposed to be. &lt;br /&gt;
 If you just put a Baked + Ambient it complains about not having Static, but if &lt;br /&gt;
 you put a Static + Ambient it seems to work fine, but the wiki says Static is &lt;br /&gt;
 the most expensive.&lt;br /&gt;
&lt;br /&gt;
==Rendering Lightmaps==&lt;br /&gt;
&lt;br /&gt;
*Press the Render Lightmaps icon (you need ActivePython 2.5 installed to default location). When it's done click the Display Lightmaps On/Off icon in the top-left to refresh the results.&lt;br /&gt;
*Uncheck the &amp;quot;View Models Fully Lit&amp;quot; icon in the lop-left. You should see shadows from any objects you've dropped in.&lt;br /&gt;
&lt;br /&gt;
 Note: Lightmap-atlas messages might appear the first time you render. That seems normal.&lt;br /&gt;
 Sometimes re-rendering the lightmaps messes them up badly when Display Lightmaps On/Off is on. It &lt;br /&gt;
 doesn't seem to use the latest lightmaps. Try pressing Display Lightmaps On/Off a few times to &lt;br /&gt;
 update it. If they're still messed up sometimes one of these fixes it (don't know which)&lt;br /&gt;
 unloading/reloading your Area or Level/changing your Area's layout property/posting your Level to &lt;br /&gt;
 Local.&lt;br /&gt;
&lt;br /&gt;
==Exporting==&lt;br /&gt;
&lt;br /&gt;
*Press the Do All Local Posts icon to the right of the lightmapping icons. It will export the name you typed into the &amp;quot;New Area&amp;quot; &amp;quot;Layout Name&amp;quot;. If there's a complaint about walkable/player start then delete your old start then place a new one on a flat area.&lt;br /&gt;
&lt;br /&gt;
*Save your .lvl file. It's not used by the game and the name/location doesn't matter. Only the exported/posted files are used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Using this in an Area==&lt;br /&gt;
&lt;br /&gt;
File &amp;gt; New &amp;gt; Area &amp;gt; Any Name&lt;br /&gt;
&lt;br /&gt;
*In the Object Inspector &amp;gt; Area Layout you should get a &amp;quot;...&amp;quot; box (make sure it's Checked Out) &amp;gt; click then select your &amp;quot;Layout Name&amp;quot; which should now be there.&lt;br /&gt;
&lt;br /&gt;
* Now you have a pretty lightmapped level inside an area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Building your terrain (Exterior Level)=&lt;br /&gt;
How to create/lightmap a [[Level]] for use in an Exterior [[Area]]:&lt;br /&gt;
Objective: Following along with this tutorial, you should be able to create a simple terrain from scratch.&lt;br /&gt;
&lt;br /&gt;
File&amp;gt;New&amp;gt;Level&lt;br /&gt;
&lt;br /&gt;
* Choose Terrain (Landscape) Level and then click Next.&lt;br /&gt;
&lt;br /&gt;
* Accept the default values for the purpose of this tutorial and click Next and then click Finish. You can learn more about what the different terrain options do at the [[Level editor]] page.&lt;br /&gt;
&lt;br /&gt;
You should now see a flat, dark piece of terrain. To move around you hold down the mouse wheel. If you want to rotate the view press the Alt key while holding down the mouse wheel. You will want some light so you can see what you are doing, so we will generate a light source next.&lt;br /&gt;
&lt;br /&gt;
Tip: When choosing the size of your terrain level think about where you are going to put horizon and vista objects, like distant mountains and tree lines. You may need to allow for extra space around your adventure area to place those items.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Grid Size==&lt;br /&gt;
&lt;br /&gt;
If you want to work with a larger grid than the one provided by default you can change the grid size by going to: &lt;br /&gt;
&lt;br /&gt;
Tools/Options/Level Editor/Grid Square Size.&lt;br /&gt;
&lt;br /&gt;
This will not change the actual dimensions of the terrain level that you created, it only changes the size of the squares in the grid.&lt;br /&gt;
&lt;br /&gt;
==Define an area==&lt;br /&gt;
&lt;br /&gt;
Must be done before rendering the lightmap.&lt;br /&gt;
&lt;br /&gt;
* Click on the purple +-sign and click Define Area. Start in one corner and draw the green square to define the area that you will export.&lt;br /&gt;
* Fill in the box Layout Name, max seven characters.&lt;br /&gt;
* Fill in the box Name.&lt;br /&gt;
&lt;br /&gt;
==Lighting==&lt;br /&gt;
&lt;br /&gt;
* Right click on Terrain World to the upper left and choose Insert&amp;gt;New Light. This will spawn a light source in your area.  Make sure you change the Light Type to Ambient - Baked (L).  Be sure to click on the Render Lightmaps button if you want to see how your ambient light is working.&lt;br /&gt;
&lt;br /&gt;
Now that the terrain is lit we can modify it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Modifying Terrain==&lt;br /&gt;
&lt;br /&gt;
The [[Terrain mesh]] tools allow you to modify the terrain by changing elevations, smoothing edges, flatting terrain, or painting textures.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Water==&lt;br /&gt;
&lt;br /&gt;
Please note that as of build 1.0.982.0 water is broken.  You can see it in editor, but it is not making it into the game.&lt;br /&gt;
&lt;br /&gt;
First use the [[Terrain mesh]] tools to make a hole.  It doesn't have to be deep.  Then right-click on Terrain world and select Insert -&amp;gt; New Water Mesh.  Double Click on the Water Mesh to zoom to it.  By default it gets placed in a corner.  Using the 3 Axis Movement tool [[File:moveTool.png]] grab the water and drag it to your hole.  Depending on the size of the hole, you might have to adjust the water mesh size by changing the Size X and Size Y property values.  Once you have the mesh placed, it's time to create the light probe.  Right-click near the water mesh and select Insert -&amp;gt; New Light Probe.  Using the move tool again, drag the light probe so that is roughly centered over the water mesh and slightly above it.  Click on Render Lightmaps, then Render Light Probs.  You might have to toggle Display Lightmaps, but you should now see your water looking like water and reflecting things around it.&lt;br /&gt;
&lt;br /&gt;
==Placing Models==&lt;br /&gt;
&lt;br /&gt;
* Click the blue box in the Palette Window to access the models that come with the game. The [[Model list]] shows pictures of many of the models available.&lt;br /&gt;
&lt;br /&gt;
* The [[Model]] page has more details on how to work with models.&lt;br /&gt;
&lt;br /&gt;
Tip 1: I had to change the Snap Options to make the models go where I wanted them. The settings I use were 0.10 for Snap to Grid and Snap Z Size. I also had to turn off Enable Snap to Surface whenever I wanted to change the vertical position of something (like creating the second floor of a building). Enable Snap to Surface is not applied globally, so once you turn it off and position an object vertically, turning it back on will not move that object unless you select it (or have it selected when you turn it back on).&lt;br /&gt;
&lt;br /&gt;
Tip 2: When placing premade cottages be aware that the door frames you can see attached to those buildings DO NOT have built in door hooks (see [[Area tutorial]] for information on placing doors). You can place a door frame model (for example, fhe_doorfrs_0) over the built in door frame to generate a door hook. The door frame model has to be placed from the Level Editor.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Adding Vegetation and Wind==&lt;br /&gt;
&lt;br /&gt;
The [[Vegetation]] page includes a list with pictures of the various plants available for placement. If you do not see the plants once you place them with the Scatter Object Tool then you may need to adjust your SpeedTree Rendering Distance Selector. This is a drop-down that you will see in the Tool Bar. It lists the distances at which plants will be visible. I set it to Very Far and left it there.&lt;br /&gt;
&lt;br /&gt;
Each level can have one active wind object in it. The location of the wind object doesn't matter. The wind object defines how wind behaves on this level, which is used for such things as flapping banners and swaying trees.&lt;br /&gt;
&lt;br /&gt;
Image:Level editor wind object.png &lt;br /&gt;
&lt;br /&gt;
The Wind Object may be found by right clicking on Terrain World and selecting:&lt;br /&gt;
&lt;br /&gt;
Insert&amp;gt;New Wind Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Visual Effects (VFX)==&lt;br /&gt;
&lt;br /&gt;
Placeable visual effects like flames or smoke are considered to be art assets in the Dragon Age toolset, so you need to place them from within the Level Editor. &lt;br /&gt;
&lt;br /&gt;
The [[VFX Tutorial]] provides guidance on creating and placing visual effects.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Path finding and Obstructions==&lt;br /&gt;
&lt;br /&gt;
The path finding process lays down a grid of points that are marked &amp;quot;accessible&amp;quot; if they can be reached from a path finding start spot via passable terrain. This is essentially a flood-fill algorithm.&lt;br /&gt;
&lt;br /&gt;
You must create an [[Exportable area]] before you can generate any path finding data.&lt;br /&gt;
&lt;br /&gt;
* Click on the purple + in the tool bar ([[File:IconAddExportableArea.png]]). This will open an Area Properties window. The [[Level editor]] page has more details on this process, so I will just keep these steps very basic.&lt;br /&gt;
* Name your Exportable Area in the Layout Name field of the Area Properties window. The name of an exportable area layout is limited to seven characters. BioWare uses the following naming system:&lt;br /&gt;
** Three-letter prefix that describes the region or plot the layout is for. For example, &amp;quot;ost&amp;quot; for Ostagar and environs.&lt;br /&gt;
** Three-digit number that uniquely identifies the layout within that region. Increments of one hundred are commonly used for major areas to allow sub-regions to be grouped together.&lt;br /&gt;
** A single character identifying variants of the layout. For example, a &amp;quot;d&amp;quot; suffix for the &amp;quot;daytime&amp;quot; version of an exterior layout. &amp;quot;d&amp;quot; is also often used to mean &amp;quot;default&amp;quot;, for areas where day and night are irrelevant (deep in a cave, for example).&lt;br /&gt;
* Define your walkable area. Do this by clicking the Define Area button in the Area Properties window. The green box must include any areas that you want players to be able to walk. If you click in a corner of the level the green box will appear there. You can then expand it by dragging the corner.&lt;br /&gt;
* Close the Area Properties window.&lt;br /&gt;
&lt;br /&gt;
In most cases you will want to block off certain areas of your terrain.&lt;br /&gt;
* Turn on the Build Terrain Blocking tool.  It is the middle mountain icon.&lt;br /&gt;
* Using left-click to place and right-click to end chains/delete, place down blocks or 'walls' around areas you don't want the player to enter&lt;br /&gt;
* Be sure to provide visual clues if it isn't obvious why the player can't walk there.&lt;br /&gt;
&lt;br /&gt;
Now that you have your exportable area you can generate path finding data.&lt;br /&gt;
&lt;br /&gt;
* Place a Starting Point in your level. I found that path finding does not work if you place the Starting Point before you have an Exportable Area. To place a Starting Point click on Setup Start Point in the tool bar.&lt;br /&gt;
* Record the name of your Starting Point by clicking on it and looking at the name in the Object Inspector. Do not change the name - changing the name can prevent path finding from working.&lt;br /&gt;
* Click Exportable Area Properties in the tool bar to open the Area Properties window. Put the Start Point name in the appropriate  field and close the window.&lt;br /&gt;
&lt;br /&gt;
You should now be ready to generate pathfinding data by clicking on the Generate Pathfinding for Active Area button in the tool bar.&lt;br /&gt;
&lt;br /&gt;
==Converting Levels into Areas==&lt;br /&gt;
&lt;br /&gt;
Click on Do All Local Posts (you can avoid problems by generating a lightmap and pathfinding before doing local posts). This can be found in the menu at Tools&amp;gt;Export&amp;gt;Do All Local Posts&lt;br /&gt;
&lt;br /&gt;
Your level has now been converted and can be used to make an area. The [[Area tutorial]] will walk you through what to do next.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Tutorials]]&lt;/div&gt;</summary>
		<author><name>TrueKeaton</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Level_Editor_Tutorial&amp;diff=12507</id>
		<title>Level Editor Tutorial</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Level_Editor_Tutorial&amp;diff=12507"/>
				<updated>2010-03-10T17:07:06Z</updated>
		
		<summary type="html">&lt;p&gt;TrueKeaton: /* Adding lights */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Building your room (Interior Level)=&lt;br /&gt;
How to create/lightmap a [[Level]] for use in an Interior [[Area]]:&lt;br /&gt;
Objective: Following along with this tutorial, you should be able to create a simple room from scratch in 10 minutes or less&lt;br /&gt;
&lt;br /&gt;
 This was lifted from a posting by St4rdog http://social.bioware.com/forum/1/topic/8/index/150840&lt;br /&gt;
 It needs some additional formatting love, but is as good starting place for people to create usable &lt;br /&gt;
 interior levels&lt;br /&gt;
&lt;br /&gt;
File &amp;gt; New &amp;gt; Level &amp;gt; Room Level&lt;br /&gt;
&lt;br /&gt;
* Click on &amp;quot;New Area&amp;quot; in top-left list &amp;gt; Object Inspector in bottom-right &amp;gt; Layout Name &amp;gt; anything under 8 characters no spaces or special characters (*,&amp;amp;,%, etc).&lt;br /&gt;
&lt;br /&gt;
*Right-click in 3D view and select Insert &amp;gt; New Room.&lt;br /&gt;
*Click Models (blue box) in the Palette in the top-right. These folders contain everything such as floor tiles, walls, etc.&lt;br /&gt;
*Enable Grid Snap with the magnet icon to make sure they line up.&lt;br /&gt;
*The &amp;quot;prp&amp;quot; folder contains things like beds/barrels to clutter your Level.&lt;br /&gt;
 Hint: Use [[DATool]] (3rd party tool downloadable at http://social.bioware.com/project/41/ )to browse &lt;br /&gt;
 through these quickly to find the floors/walls you want.&lt;br /&gt;
&lt;br /&gt;
 Note: If you get &amp;quot;Cannot spawn models into the selected parent object&amp;quot; when trying to place a model &lt;br /&gt;
 then you don't have &amp;quot;New Room&amp;quot; selected.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Working with multiple rooms==&lt;br /&gt;
&lt;br /&gt;
In general it is best to define each building room as a new room in the level. This becomes important when you work on lighting. To physically connect rooms you need to slide them together to get the doors to line up, they do not line up automatically. It takes some trial and error but becomes easier with practice.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Adding lights==&lt;br /&gt;
&lt;br /&gt;
* Right-click on &amp;quot;New Room&amp;quot; in top-left list &amp;gt; Insert &amp;gt; New Light&lt;br /&gt;
&lt;br /&gt;
* Move it up off the floor a little. In Object Inspector &amp;gt; &amp;quot;Color Intensity&amp;quot; 2 or more &amp;gt; &amp;quot;Light Type&amp;quot; Point - Static (lc) &amp;gt; Choose any bright color.&lt;br /&gt;
&lt;br /&gt;
*Copy and paste. In Object Inspector &amp;gt;&amp;quot;Light Type&amp;quot; Ambient - Baked (this light stops your shadows being pitch black) &amp;gt; Choose a dark blue colour and keep the Color Intensity under 2/3.&lt;br /&gt;
&lt;br /&gt;
 Note: I'm not sure what the mix of Baked/Static light is supposed to be. &lt;br /&gt;
 If you just put a Baked + Ambient it complains about not having Static, but if &lt;br /&gt;
 you put a Static + Ambient it seems to work fine, but the wiki says Static is &lt;br /&gt;
 the most expensive.&lt;br /&gt;
&lt;br /&gt;
==Rendering Lightmaps==&lt;br /&gt;
&lt;br /&gt;
*Press the Render Lightmaps icon (you need ActivePython 2.5 installed to default location). When it's done click the Display&lt;br /&gt;
Lightmaps On/Off icon in the top-left to refresh the results.&lt;br /&gt;
*Uncheck the &amp;quot;View Models Fully Lit&amp;quot; icon in the lop-left. You should see shadows from any objects you've dropped in.&lt;br /&gt;
&lt;br /&gt;
 Note: Lightmap-atlas messages might appear the first time you render. That seems normal.&lt;br /&gt;
 Sometimes re-rendering the lightmaps messes them up badly when Display Lightmaps On/Off is on. It &lt;br /&gt;
 doesn't seem to use the latest lightmaps. Try pressing Display Lightmaps On/Off a few times to &lt;br /&gt;
 update it. If they're still messed up sometimes one of these fixes it (don't know which)&lt;br /&gt;
 unloading/reloading your Area or Level/changing your Area's layout property/posting your Level to &lt;br /&gt;
 Local.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Exporting==&lt;br /&gt;
&lt;br /&gt;
*Press the Do All Local Posts icon to the right of the lightmapping icons. It will export the name you typed into the &amp;quot;New Area&amp;quot; &amp;quot;Layout Name&amp;quot;. If there's a complaint about walkable/player start then delete your old start then place a new one on a flat area.&lt;br /&gt;
&lt;br /&gt;
*Save your .lvl file. It's not used by the game and the name/location doesn't matter. Only the exported/posted files are used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Using this in an Area==&lt;br /&gt;
&lt;br /&gt;
File &amp;gt; New &amp;gt; Area &amp;gt; Any Name&lt;br /&gt;
&lt;br /&gt;
*In the Object Inspector &amp;gt; Area Layout you should get a &amp;quot;...&amp;quot; box (make sure it's Checked Out) &amp;gt; click then select your &amp;quot;Layout Name&amp;quot; which should now be there.&lt;br /&gt;
&lt;br /&gt;
* Now you have a pretty lightmapped level inside an area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Building your terrain (Exterior Level)=&lt;br /&gt;
How to create/lightmap a [[Level]] for use in an Exterior [[Area]]:&lt;br /&gt;
Objective: Following along with this tutorial, you should be able to create a simple terrain from scratch.&lt;br /&gt;
&lt;br /&gt;
File&amp;gt;New&amp;gt;Level&lt;br /&gt;
&lt;br /&gt;
* Choose Terrain (Landscape) Level and then click Next.&lt;br /&gt;
&lt;br /&gt;
* Accept the default values for the purpose of this tutorial and click Next and then click Finish. You can learn more about what the different terrain options do at the [[Level editor]] page.&lt;br /&gt;
&lt;br /&gt;
You should now see a flat, dark piece of terrain. To move around you hold down the mouse wheel. If you want to rotate the view press the Alt key while holding down the mouse wheel. You will want some light so you can see what you are doing, so we will generate a light source next.&lt;br /&gt;
&lt;br /&gt;
Tip: When choosing the size of your terrain level think about where you are going to put horizon and vista objects, like distant mountains and tree lines. You may need to allow for extra space around your adventure area to place those items.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Grid Size==&lt;br /&gt;
&lt;br /&gt;
If you want to work with a larger grid than the one provided by default you can change the grid size by going to: &lt;br /&gt;
&lt;br /&gt;
Tools/Options/Level Editor/Grid Square Size.&lt;br /&gt;
&lt;br /&gt;
This will not change the actual dimensions of the terrain level that you created, it only changes the size of the squares in the grid.&lt;br /&gt;
&lt;br /&gt;
==Define an area==&lt;br /&gt;
&lt;br /&gt;
Must be done before rendering the lightmap.&lt;br /&gt;
&lt;br /&gt;
* Click on the purple +-sign and click Define Area. Start in one corner and draw the green square to define the area that you will export.&lt;br /&gt;
* Fill in the box Layout Name, max seven characters.&lt;br /&gt;
* Fill in the box Name.&lt;br /&gt;
&lt;br /&gt;
==Lighting==&lt;br /&gt;
&lt;br /&gt;
* Right click on Terrain World to the upper left and choose Insert&amp;gt;New Light. This will spawn a light source in your area.  Make sure you change the Light Type to Ambient - Baked (L).  Be sure to click on the Render Lightmaps button if you want to see how your ambient light is working.&lt;br /&gt;
&lt;br /&gt;
Now that the terrain is lit we can modify it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Modifying Terrain==&lt;br /&gt;
&lt;br /&gt;
The [[Terrain mesh]] tools allow you to modify the terrain by changing elevations, smoothing edges, flatting terrain, or painting textures.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Water==&lt;br /&gt;
&lt;br /&gt;
Please note that as of build 1.0.982.0 water is broken.  You can see it in editor, but it is not making it into the game.&lt;br /&gt;
&lt;br /&gt;
First use the [[Terrain mesh]] tools to make a hole.  It doesn't have to be deep.  Then right-click on Terrain world and select Insert -&amp;gt; New Water Mesh.  Double Click on the Water Mesh to zoom to it.  By default it gets placed in a corner.  Using the 3 Axis Movement tool [[File:moveTool.png]] grab the water and drag it to your hole.  Depending on the size of the hole, you might have to adjust the water mesh size by changing the Size X and Size Y property values.  Once you have the mesh placed, it's time to create the light probe.  Right-click near the water mesh and select Insert -&amp;gt; New Light Probe.  Using the move tool again, drag the light probe so that is roughly centered over the water mesh and slightly above it.  Click on Render Lightmaps, then Render Light Probs.  You might have to toggle Display Lightmaps, but you should now see your water looking like water and reflecting things around it.&lt;br /&gt;
&lt;br /&gt;
==Placing Models==&lt;br /&gt;
&lt;br /&gt;
* Click the blue box in the Palette Window to access the models that come with the game. The [[Model list]] shows pictures of many of the models available.&lt;br /&gt;
&lt;br /&gt;
* The [[Model]] page has more details on how to work with models.&lt;br /&gt;
&lt;br /&gt;
Tip 1: I had to change the Snap Options to make the models go where I wanted them. The settings I use were 0.10 for Snap to Grid and Snap Z Size. I also had to turn off Enable Snap to Surface whenever I wanted to change the vertical position of something (like creating the second floor of a building). Enable Snap to Surface is not applied globally, so once you turn it off and position an object vertically, turning it back on will not move that object unless you select it (or have it selected when you turn it back on).&lt;br /&gt;
&lt;br /&gt;
Tip 2: When placing premade cottages be aware that the door frames you can see attached to those buildings DO NOT have built in door hooks (see [[Area tutorial]] for information on placing doors). You can place a door frame model (for example, fhe_doorfrs_0) over the built in door frame to generate a door hook. The door frame model has to be placed from the Level Editor.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Adding Vegetation and Wind==&lt;br /&gt;
&lt;br /&gt;
The [[Vegetation]] page includes a list with pictures of the various plants available for placement. If you do not see the plants once you place them with the Scatter Object Tool then you may need to adjust your SpeedTree Rendering Distance Selector. This is a drop-down that you will see in the Tool Bar. It lists the distances at which plants will be visible. I set it to Very Far and left it there.&lt;br /&gt;
&lt;br /&gt;
Each level can have one active wind object in it. The location of the wind object doesn't matter. The wind object defines how wind behaves on this level, which is used for such things as flapping banners and swaying trees.&lt;br /&gt;
&lt;br /&gt;
Image:Level editor wind object.png &lt;br /&gt;
&lt;br /&gt;
The Wind Object may be found by right clicking on Terrain World and selecting:&lt;br /&gt;
&lt;br /&gt;
Insert&amp;gt;New Wind Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Visual Effects (VFX)==&lt;br /&gt;
&lt;br /&gt;
Placeable visual effects like flames or smoke are considered to be art assets in the Dragon Age toolset, so you need to place them from within the Level Editor. &lt;br /&gt;
&lt;br /&gt;
The [[VFX Tutorial]] provides guidance on creating and placing visual effects.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Path finding and Obstructions==&lt;br /&gt;
&lt;br /&gt;
The path finding process lays down a grid of points that are marked &amp;quot;accessible&amp;quot; if they can be reached from a path finding start spot via passable terrain. This is essentially a flood-fill algorithm.&lt;br /&gt;
&lt;br /&gt;
You must create an [[Exportable area]] before you can generate any path finding data.&lt;br /&gt;
&lt;br /&gt;
* Click on the purple + in the tool bar ([[File:IconAddExportableArea.png]]). This will open an Area Properties window. The [[Level editor]] page has more details on this process, so I will just keep these steps very basic.&lt;br /&gt;
* Name your Exportable Area in the Layout Name field of the Area Properties window. The name of an exportable area layout is limited to seven characters. BioWare uses the following naming system:&lt;br /&gt;
** Three-letter prefix that describes the region or plot the layout is for. For example, &amp;quot;ost&amp;quot; for Ostagar and environs.&lt;br /&gt;
** Three-digit number that uniquely identifies the layout within that region. Increments of one hundred are commonly used for major areas to allow sub-regions to be grouped together.&lt;br /&gt;
** A single character identifying variants of the layout. For example, a &amp;quot;d&amp;quot; suffix for the &amp;quot;daytime&amp;quot; version of an exterior layout. &amp;quot;d&amp;quot; is also often used to mean &amp;quot;default&amp;quot;, for areas where day and night are irrelevant (deep in a cave, for example).&lt;br /&gt;
* Define your walkable area. Do this by clicking the Define Area button in the Area Properties window. The green box must include any areas that you want players to be able to walk. If you click in a corner of the level the green box will appear there. You can then expand it by dragging the corner.&lt;br /&gt;
* Close the Area Properties window.&lt;br /&gt;
&lt;br /&gt;
In most cases you will want to block off certain areas of your terrain.&lt;br /&gt;
* Turn on the Build Terrain Blocking tool.  It is the middle mountain icon.&lt;br /&gt;
* Using left-click to place and right-click to end chains/delete, place down blocks or 'walls' around areas you don't want the player to enter&lt;br /&gt;
* Be sure to provide visual clues if it isn't obvious why the player can't walk there.&lt;br /&gt;
&lt;br /&gt;
Now that you have your exportable area you can generate path finding data.&lt;br /&gt;
&lt;br /&gt;
* Place a Starting Point in your level. I found that path finding does not work if you place the Starting Point before you have an Exportable Area. To place a Starting Point click on Setup Start Point in the tool bar.&lt;br /&gt;
* Record the name of your Starting Point by clicking on it and looking at the name in the Object Inspector. Do not change the name - changing the name can prevent path finding from working.&lt;br /&gt;
* Click Exportable Area Properties in the tool bar to open the Area Properties window. Put the Start Point name in the appropriate  field and close the window.&lt;br /&gt;
&lt;br /&gt;
You should now be ready to generate pathfinding data by clicking on the Generate Pathfinding for Active Area button in the tool bar.&lt;br /&gt;
&lt;br /&gt;
==Converting Levels into Areas==&lt;br /&gt;
&lt;br /&gt;
Click on Do All Local Posts (you can avoid problems by generating a lightmap and pathfinding before doing local posts). This can be found in the menu at Tools&amp;gt;Export&amp;gt;Do All Local Posts&lt;br /&gt;
&lt;br /&gt;
Your level has now been converted and can be used to make an area. The [[Area tutorial]] will walk you through what to do next.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Tutorials]]&lt;/div&gt;</summary>
		<author><name>TrueKeaton</name></author>	</entry>

	<entry>
		<id>http://www.datoolset.net/mw/index.php?title=Exporting_a_module&amp;diff=12026</id>
		<title>Exporting a module</title>
		<link rel="alternate" type="text/html" href="http://www.datoolset.net/mw/index.php?title=Exporting_a_module&amp;diff=12026"/>
				<updated>2010-02-22T23:56:23Z</updated>
		
		<summary type="html">&lt;p&gt;TrueKeaton: /* Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox module}}&lt;br /&gt;
For the Game to load a [[Module]] and any Resources of it, it has to get exported from the Toolset first.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Short explanation for noobies only --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Definition --&amp;gt;&lt;br /&gt;
Exporting a [[Module]] is the process of exporting a single or all [[Designer Resources|Designer Resources]] from the Database. &lt;br /&gt;
&lt;br /&gt;
The toolset stores exported Resources as files in Folders that are unique to the Module a Resource belongs to, so that the Game which has no access to the Database can read them. Exporting is done 'per resource' on a single by single basis, however you can tell the toolset to export all at once, or a single resource with all dependend resources. Dependand Resources are those which are required for a Resource to work correctly, like a Vendor who sells a Sword is dependant on the Sword Resource. The Toolset will see the dependency automatically. &lt;br /&gt;
&lt;br /&gt;
[[Art Resources|Art Resources]] and [[2DA|2DA's]] are already present as files, which the creator has to put into into the respective Override Folder of the [[Module]] manually. {{undocumented}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All of the Resources can then be packaged into a [[Builder to player|&amp;quot;Builder to Player&amp;quot;]] package, once the [[Module]] is finished. This will collect all those ''loose'' files, and put it in a single downloadable file. Which is known as [[DAZIP|&amp;quot;DAZIP&amp;quot;]].&lt;br /&gt;
&lt;br /&gt;
== Exporting ==&lt;br /&gt;
&lt;br /&gt;
Exporting by single Resources is done to test single resources in game during development. During Export, the toolset extends the &amp;quot;Addins.xml&amp;quot; file, which enables the Module to be seen from the Games Menu. &lt;br /&gt;
&lt;br /&gt;
=== Export Capabilities ===&lt;br /&gt;
&lt;br /&gt;
*Export with dependent resources: This will export the currently selected resource, as well as any other resources that it depends upon. For instance, if you have created an area with a creature in it, this option will export the area, the creature, the creature's inventory, the scripts, etc. It would then grab any dependencies for the creature, inventory, or scripts and continue until it exhausted all of their dependencies. Doing this is a good way to make sure you get all of the needed pieces for any particular resource, but it can also quickly multiply to the point where it is picking up half of the module.&lt;br /&gt;
&lt;br /&gt;
*Export without dependent resource: This will only export the currently selected resource. This is a quick and efficient way to update your module when you have modified parts of a resource that only affect that resource.&lt;br /&gt;
&lt;br /&gt;
*Export all resources of type: This will export every resource of the same type as that which is currently selected in the palette. For instance, if you select a creature and choose this method, it will export all creatures in the module.&lt;br /&gt;
&lt;br /&gt;
*Full export: This option exports every resource associated with the module. It is the most comprehensive, and takes the longest to run.&lt;br /&gt;
&lt;br /&gt;
{| align=right&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:DA_Audio_Design_Documentation_Ambience_Content_html_6cd0bb27.png|400px]]&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:DA_Audio_Design_Documentation_Ambience_Content_html_6e39c036.png|300px]]&lt;br /&gt;
|}&lt;br /&gt;
=== Testing an Area by overriding the starting area ===&lt;br /&gt;
&lt;br /&gt;
Area Resources can be tested in a very convinient way. If you just want to give it a test run you can override the module's start area on an export-by-export basis.&lt;br /&gt;
&lt;br /&gt;
#Save the Area you are working on&lt;br /&gt;
#Navigate Tools/Export/Export Options&lt;br /&gt;
#Activate &amp;quot;Override campaign export settings&amp;quot;&lt;br /&gt;
#Choose the Area, and a Waypoint with it&lt;br /&gt;
#Export the Area with or without dependand resources as needed&lt;br /&gt;
&lt;br /&gt;
Once the export has completed you should be able to start a &amp;quot;New Game&amp;quot; (if editing the main campaign) or select your module under &amp;quot;Other Campaigns&amp;quot; (for stand-alone content). You should start in the level that you have exported at the waypoint that you have set as your starting point. You need to have an custom module setup as Standalone, see above.&lt;br /&gt;
&lt;br /&gt;
== Creating a downloadable Package ==&lt;br /&gt;
&lt;br /&gt;
All of the Resources which are exported are only ''loose'' files in your Filesystem. However to create downloadable and installable packages the toolset is capable of creating so called [[Builder to player]] packages, to create [[DAZIP|&amp;quot;DAZIP&amp;quot;]] installable Filetype.&lt;br /&gt;
&lt;br /&gt;
:''See Article: [[Builder to player]]''&lt;br /&gt;
&lt;br /&gt;
== Exporting resources to other Modders ==&lt;br /&gt;
&lt;br /&gt;
Normally the whole process will convert Resources into Gamereadable formats. Which excludes being able to edit them further with the Toolset. The source is however stored in the cloggy Database. [[Builder to builder]] is the mechanisms used by the toolset that allow packages of game resources to be shared between multiple collaborating builders.&lt;br /&gt;
&lt;br /&gt;
:''See Article: [[Builder to builder]]''&lt;br /&gt;
&lt;br /&gt;
[[Category:Modules]]&lt;/div&gt;</summary>
		<author><name>TrueKeaton</name></author>	</entry>

	</feed>