<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.larian.game/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=RaalKadaj</id>
	<title>Divinity Engine Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.larian.game/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=RaalKadaj"/>
	<link rel="alternate" type="text/html" href="https://docs.larian.game/Special:Contributions/RaalKadaj"/>
	<updated>2026-05-13T05:29:36Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=5307</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=5307"/>
		<updated>2017-12-22T12:22:36Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: Tightened up introduction&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This guide will take you through the steps to create a basic adventure -- visual heavy, it is aimed at beginners who want to get started on their custom adventures as quickly as possible.&lt;br /&gt;
&lt;br /&gt;
== Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.1. Create a new adventure type project, targeted at Story mode'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.2. Create a new basic level template, called 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''2.1. Create a new NPC character model and place it into the level'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.1. Create the start of a simple dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.2. Save the dialog as 'TV_Elena_Dialog' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.3. Create the rest of the dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.4. Setup and assign speakers for your dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.5. Assign the correct speaker to each node'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
== Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.1. Create our quest categories'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.2. Save and reload all'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.3. Add a new quest under our 'QCA_Chapter_01' category'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
== Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen -- and right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, searching for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like tents we'd find in a nomad community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
== Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
== Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.1. Add a shovel and three instances of a white sand pile'''&amp;lt;/span&amp;gt;&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.2.  Add some objects into the level to dig up out of our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.3. Add our objects to our sand-piles item property'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.4. Only show our sand piles if the user passes a perception test'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== Box Triggers, local instances and hidden dirt piles ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.1 Naming and referencing of local instances'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.2 Doing a better job hiding our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.3 Setting up box triggers to implement digging treasure rewards'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.1. There is only ever one story, with goals running in alphabetical order'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.2. Sub-goals will only run when their parent goal is 'complete' '''&amp;lt;span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.3. Create a parent goal for your level under the __Start goal'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.4. Add in the code that will complete our parent level goal&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.6. Generate definitions, build and reload'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Quest state updates, smarter dialogs and moving characters ==&lt;br /&gt;
We're going to take a slight step backwards here and update our dialog with Elena.  The goal here is to activate the 'Started' quest state we created earlier for 'The Lost Medicine' quest, which will then display in the players quest journal.  We will also want to look at getting Elena to run back to her families tent and to say something different to us once we have accepted the quest – otherwise she will continue to ask us to find her medicine, even though we had already started doing just that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.1. How do we update quest states?'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main mechanism for doing this is the '''ObjectSetFlag()''' Osiris Call, which we can call from any of our scripts.  Another common way of updating our quest states is via Dialogs, and their 'Node Flags' property, which is what we will be using right now.&lt;br /&gt;
&lt;br /&gt;
A heads up on updating quest states is that Larian has a syntax we need to follow when updating or checking quest state flags.  The format to use is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;ObjectSetFlag(_Player, &amp;quot;QuestUpdate_&amp;lt;NameOfQuest&amp;gt;_&amp;lt;QuestState&amp;gt;, _&amp;quot;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus, to set our quest status to started, we just need to switch on its flag.  An example update format to use is shown below, with the &amp;quot;'''QuestUpdate_LostMedicine_Started'''&amp;quot; string.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.1_QuestCategories.png|none|left|Quest categories|264px]]&lt;br /&gt;
&lt;br /&gt;
Luckily we can also update quest states from within our dialogs.  For the next steps please open the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, open our '''TV_Elena_Dialog''' file &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2-4)&amp;lt;/span&amp;gt;, select the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and press the edit button for the 'Flags To Set' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt; property.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.2_DialogEditing.PNG|none|left|Dialog editing|615px]]&lt;br /&gt;
&lt;br /&gt;
Continuing on from above, we now need to create a custom flag which will be used to update our quest status.  To do so, click on the 'Character' flag category &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter '''QuestUpdate_LostMedicine_Started''' in the custom flag field &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  Press Add &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and then press Ok &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes.  Once saved, tick the 'QuestUpdate_LostMedicine_Started' flag to update our quest status when our players reach this particular node.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.3_UpdatingFlags.png|none|left|Updating quest flags|550px]]&lt;br /&gt;
&lt;br /&gt;
Press Ctrl + S to save your changes, and the close the Dialog Editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.2. Registering our Quest state flags'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Oops!  One step we forgot to do was registering the &amp;quot;Started&amp;quot; quest state in our Story Editor.  This is where this database fact is initialised at startup, ready for an update to occur.  To set this up, please create a new sub item goal called '''TV_JournalUpdate''' and enter in the following code.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.2_RegisterQuestStateFlags.PNG|none|left|Register quest state flags|896px]]&lt;br /&gt;
&lt;br /&gt;
I've also attached a version you can copy / paste below, however.  Please note that you will need to update the '''CharacterCreationDummy''' with your own character GUID.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Let the story know that our test dummy character is a player character&lt;br /&gt;
DB_IsPlayer(CHARACTERGUID_S_GLO_CharacterCreationDummy_001_da072fe7-fdd5-42ae-9139-8bd4b9fca406);&lt;br /&gt;
&lt;br /&gt;
// Define the Lost Medicine 'Started' flag for our quest, and so our dialog has a ready to go database fact to update&lt;br /&gt;
DB_QuestDef_State(&amp;quot;LostMedicine&amp;quot;,&amp;quot;Started&amp;quot;,1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.3. Switch to game mode to test the quest journal updates'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save everything and then switch to the game mode to test the quest journal updates in the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.1_SwitchToGameMode.png|none|left|Switch to game mode|377px]]&lt;br /&gt;
&lt;br /&gt;
Walk up to Elena and talk to her – after which you should see the following '''Quest Journal''' update ('''The Lost Medicine''') appear on your screen.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.2_JournalUpdated.png|none|left|Journal updated|299px]]&lt;br /&gt;
&lt;br /&gt;
Opening your journal while in game mode should also now display The Lost Medicine quest details.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.3_CheckQuestJournal.png|none|left|Open quest journal|724px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.4. Improving our dialog with Elena'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Elena''' dialog and add a new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and a new question that follows our new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  This greeting is going to be the new dialog chain that will occur when the player starts a dialog with '''Elena''', and has already started the lost medicine quest.&lt;br /&gt;
&lt;br /&gt;
Select our new greeting node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and click on 'Edit' in our 'Flags To Check' field, adding in the '''LostMedicine_Started''' flag.  Finally, tick this flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; so that this greeting dialog chain will only begin if we have already started the lost medicine quest.  To tidy up, also select our original greeting node and add a lost medicine flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, this time making sure not to tick it – so that this greeting chain only plays if the lost medicine quest has not started.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.4_ImprovingDialog.png|none|left|Improving dialog|765px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.5. Getting Elena to run back to her tent'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We're going to add in some small updates, creating a point trigger inside Elena's tent and getting her to run there after our quest started flag has been activated.  To get going, search for '''point trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the Root Templates panel, select a 'Point Trigger' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; and drag it into our scene, inside the tent &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once happy with the positioning, go ahead and update the name of the trigger to '''TV_ElenaRunToTent_PointTrigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5.1_AddStoryScript.png|none|left|Add story script|825px]]&lt;br /&gt;
&lt;br /&gt;
{{warning|Elena will end up facing wherever she stops running, and is not affected by the facing of the Point Trigger.}}&lt;br /&gt;
&lt;br /&gt;
Ok, half way there – next step is to add a bit of code into our Story Editor.  Open up the StoryEditor, right click on 'TheVillage' goal and select 'Add New Sub Item...'.  Then name your new sub-item goal '''TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; as this is where we will be writing code related to her actions.  Once done, open up the KB section and enter in the following code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5_SetupPointTrigger.png|none|left|Setup point trigger|750px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IF&lt;br /&gt;
ObjectFlagSet(&amp;quot;QuestUpdate_LostMedicine_Started&amp;quot;, _player, _)&lt;br /&gt;
THEN&lt;br /&gt;
ProcCharacterMoveTo(CHARACTERGUID_S_TV_Elena_56d1fd6c-d1ac-4d87-bba8-33a6297fa437, TRIGGERGUID_S_TV_ElenaRunToTent_PointTrigger_9a113b13-6078-44fb-a06f-917c354960ea, 1, &amp;quot;&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;br /&gt;
&lt;br /&gt;
== Encounters ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4790</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4790"/>
		<updated>2017-12-13T11:32:07Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: /* Box Triggers, referencing local instances, digging with shovels and treasure rewards */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.1. Create a new adventure type project, targeted at Story mode'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.2. Create a new basic level template, called 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''2.1. Create a new NPC character model and place it into the level'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.1. Create the start of a simple dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.2. Save the dialog as 'TV_Elena_Dialog' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.3. Create the rest of the dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.4. Setup and assign speakers for your dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.5. Assign the correct speaker to each node'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
== Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.1. Create our quest categories'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.2. Save and reload all'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.3. Add a new quest under our 'QCA_Chapter_01' category'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
== Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen -- and right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, searching for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like tents we'd find in a nomad community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
== Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
== Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.1. Add a shovel and three instances of a white sand pile'''&amp;lt;/span&amp;gt;&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.2.  Add some objects into the level to dig up out of our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.3. Add our objects to our sand-piles item property'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.4. Only show our sand piles if the user passes a perception test'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== Box Triggers, local instances and hidden dirt piles ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.1 Naming and referencing of local instances'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.2 Doing a better job hiding our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.3 Setting up box triggers to implement digging treasure rewards'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.1. There is only ever one story, with goals running in alphabetical order'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.2. Sub-goals will only run when their parent goal is 'complete' '''&amp;lt;span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.3. Create a parent goal for your level under the __Start goal'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.4. Add in the code that will complete our parent level goal&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.6. Generate definitions, build and reload'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Quest state updates, smarter dialogs and moving characters ==&lt;br /&gt;
We're going to take a slight step backwards here and update our dialog with Elena.  The goal here is to activate the 'Started' quest state we created earlier for 'The Lost Medicine' quest, which will then display in the players quest journal.  We will also want to look at getting Elena to run back to her families tent and to say something different to us once we have accepted the quest – otherwise she will continue to ask us to find her medicine, even though we had already started doing just that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.1. How do we update quest states?'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main mechanism for doing this is the '''ObjectSetFlag()''' Osiris Call, which we can call from any of our scripts.  Another common way of updating our quest states is via Dialogs, and their 'Node Flags' property, which is what we will be using right now.&lt;br /&gt;
&lt;br /&gt;
A heads up on updating quest states is that Larian has a syntax we need to follow when updating or checking quest state flags.  The format to use is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;ObjectSetFlag(_Player, &amp;quot;QuestUpdate_&amp;lt;NameOfQuest&amp;gt;_&amp;lt;QuestState&amp;gt;, _&amp;quot;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus, to set our quest status to started, we just need to switch on its flag.  An example update format to use is shown below, with the &amp;quot;'''QuestUpdate_LostMedicine_Started'''&amp;quot; string.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.1_QuestCategories.png|none|left|Quest categories|264px]]&lt;br /&gt;
&lt;br /&gt;
Luckily we can also update quest states from within our dialogs.  For the next steps please open the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, open our '''TV_Elena_Dialog''' file &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2-4)&amp;lt;/span&amp;gt;, select the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and press the edit button for the 'Flags To Set' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt; property.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.2_DialogEditing.PNG|none|left|Dialog editing|615px]]&lt;br /&gt;
&lt;br /&gt;
Continuing on from above, we now need to create a custom flag which will be used to update our quest status.  To do so, click on the 'Character' flag category &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter '''QuestUpdate_LostMedicine_Started''' in the custom flag field &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  Press Add &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and then press Ok &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes.  Once saved, tick the 'QuestUpdate_LostMedicine_Started' flag to update our quest status when our players reach this particular node.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.3_UpdatingFlags.png|none|left|Updating quest flags|550px]]&lt;br /&gt;
&lt;br /&gt;
Press Ctrl + S to save your changes, and the close the Dialog Editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.2. Registering our Quest state flags'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Oops!  One step we forgot to do was registering the &amp;quot;Started&amp;quot; quest state in our Story Editor.  This is where this database fact is initialised at startup, ready for an update to occur.  To set this up, please create a new sub item goal called '''TV_JournalUpdate''' and enter in the following code.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.2_RegisterQuestStateFlags.PNG|none|left|Register quest state flags|896px]]&lt;br /&gt;
&lt;br /&gt;
I've also attached a version you can copy / paste below, however.  Please note that you will need to update the '''CharacterCreationDummy''' with your own character GUID.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Let the story know that our test dummy character is a player character&lt;br /&gt;
DB_IsPlayer(CHARACTERGUID_S_GLO_CharacterCreationDummy_001_da072fe7-fdd5-42ae-9139-8bd4b9fca406);&lt;br /&gt;
&lt;br /&gt;
// Define the Lost Medicine 'Started' flag for our quest, and so our dialog has a ready to go database fact to update&lt;br /&gt;
DB_QuestDef_State(&amp;quot;LostMedicine&amp;quot;,&amp;quot;Started&amp;quot;,1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.3. Switch to game mode to test the quest journal updates'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save everything and then switch to the game mode to test the quest journal updates in the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.1_SwitchToGameMode.png|none|left|Switch to game mode|377px]]&lt;br /&gt;
&lt;br /&gt;
Walk up to Elena and talk to her – after which you should see the following '''Quest Journal''' update ('''The Lost Medicine''') appear on your screen.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.2_JournalUpdated.png|none|left|Journal updated|299px]]&lt;br /&gt;
&lt;br /&gt;
Opening your journal while in game mode should also now display The Lost Medicine quest details.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.3_CheckQuestJournal.png|none|left|Open quest journal|724px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.4. Improving our dialog with Elena'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Elena''' dialog and add a new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and a new question that follows our new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  This greeting is going to be the new dialog chain that will occur when the player starts a dialog with '''Elena''', and has already started the lost medicine quest.&lt;br /&gt;
&lt;br /&gt;
Select our new greeting node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and click on 'Edit' in our 'Flags To Check' field, adding in the '''LostMedicine_Started''' flag.  Finally, tick this flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; so that this greeting dialog chain will only begin if we have already started the lost medicine quest.  To tidy up, also select our original greeting node and add a lost medicine flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, this time making sure not to tick it – so that this greeting chain only plays if the lost medicine quest has not started.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.4_ImprovingDialog.png|none|left|Improving dialog|765px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.5. Getting Elena to run back to her tent'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We're going to add in some small updates, creating a point trigger inside Elena's tent and getting her to run there after our quest started flag has been activated.  To get going, search for '''point trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the Root Templates panel, select a 'Point Trigger' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; and drag it into our scene, inside the tent &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once happy with the positioning, go ahead and update the name of the trigger to '''TV_ElenaRunToTent_PointTrigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5.1_AddStoryScript.png|none|left|Add story script|825px]]&lt;br /&gt;
&lt;br /&gt;
{{warning|Elena will end up facing wherever she stops running, and is not affected by the facing of the Point Trigger.}}&lt;br /&gt;
&lt;br /&gt;
Ok, half way there – next step is to add a bit of code into our Story Editor.  Open up the StoryEditor, right click on 'TheVillage' goal and select 'Add New Sub Item...'.  Then name your new sub-item goal '''TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; as this is where we will be writing code related to her actions.  Once done, open up the KB section and enter in the following code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5_SetupPointTrigger.png|none|left|Setup point trigger|750px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IF&lt;br /&gt;
ObjectFlagSet(&amp;quot;QuestUpdate_LostMedicine_Started&amp;quot;, _player, _)&lt;br /&gt;
THEN&lt;br /&gt;
ProcCharacterMoveTo(CHARACTERGUID_S_TV_Elena_56d1fd6c-d1ac-4d87-bba8-33a6297fa437, TRIGGERGUID_S_TV_ElenaRunToTent_PointTrigger_9a113b13-6078-44fb-a06f-917c354960ea, 1, &amp;quot;&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;br /&gt;
&lt;br /&gt;
== Encounters ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4749</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4749"/>
		<updated>2017-12-12T03:33:09Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: /* Quest state updates, smarter dialogs and moving characters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.1. Create a new adventure type project, targeted at Story mode'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.2. Create a new basic level template, called 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''2.1. Create a new NPC character model and place it into the level'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.1. Create the start of a simple dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.2. Save the dialog as 'TV_Elena_Dialog' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.3. Create the rest of the dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.4. Setup and assign speakers for your dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.5. Assign the correct speaker to each node'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
== Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.1. Create our quest categories'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.2. Save and reload all'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.3. Add a new quest under our 'QCA_Chapter_01' category'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
== Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen -- and right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, searching for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like tents we'd find in a nomad community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
== Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
== Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.1. Add a shovel and three instances of a white sand pile'''&amp;lt;/span&amp;gt;&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.2.  Add some objects into the level to dig up out of our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.3. Add our objects to our sand-piles item property'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.4. Only show our sand piles if the user passes a perception test'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.1 Naming and referencing of local instances'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.2 Doing a better job hiding our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.3 Setting up box triggers to implement digging treasure rewards'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.1. There is only ever one story, with goals running in alphabetical order'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.2. Sub-goals will only run when their parent goal is 'complete' '''&amp;lt;span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.3. Create a parent goal for your level under the __Start goal'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.4. Add in the code that will complete our parent level goal&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.6. Generate definitions, build and reload'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Quest state updates, smarter dialogs and moving characters ==&lt;br /&gt;
We're going to take a slight step backwards here and update our dialog with Elena.  The goal here is to activate the 'Started' quest state we created earlier for 'The Lost Medicine' quest, which will then display in the players quest journal.  We will also want to look at getting Elena to run back to her families tent and to say something different to us once we have accepted the quest – otherwise she will continue to ask us to find her medicine, even though we had already started doing just that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.1. How do we update quest states?'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main mechanism for doing this is the '''ObjectSetFlag()''' Osiris Call, which we can call from any of our scripts.  Another common way of updating our quest states is via Dialogs, and their 'Node Flags' property, which is what we will be using right now.&lt;br /&gt;
&lt;br /&gt;
A heads up on updating quest states is that Larian has a syntax we need to follow when updating or checking quest state flags.  The format to use is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;ObjectSetFlag(_Player, &amp;quot;QuestUpdate_&amp;lt;NameOfQuest&amp;gt;_&amp;lt;QuestState&amp;gt;, _&amp;quot;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus, to set our quest status to started, we just need to switch on its flag.  An example update format to use is shown below, with the &amp;quot;'''QuestUpdate_LostMedicine_Started'''&amp;quot; string.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.1_QuestCategories.png|none|left|Quest categories|264px]]&lt;br /&gt;
&lt;br /&gt;
Luckily we can also update quest states from within our dialogs.  For the next steps please open the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, open our '''TV_Elena_Dialog''' file &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2-4)&amp;lt;/span&amp;gt;, select the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and press the edit button for the 'Flags To Set' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt; property.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.2_DialogEditing.PNG|none|left|Dialog editing|615px]]&lt;br /&gt;
&lt;br /&gt;
Continuing on from above, we now need to create a custom flag which will be used to update our quest status.  To do so, click on the 'Character' flag category &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter '''QuestUpdate_LostMedicine_Started''' in the custom flag field &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  Press Add &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and then press Ok &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes.  Once saved, tick the 'QuestUpdate_LostMedicine_Started' flag to update our quest status when our players reach this particular node.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.3_UpdatingFlags.png|none|left|Updating quest flags|550px]]&lt;br /&gt;
&lt;br /&gt;
Press Ctrl + S to save your changes, and the close the Dialog Editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.2. Registering our Quest state flags'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Oops!  One step we forgot to do was registering the &amp;quot;Started&amp;quot; quest state in our Story Editor.  This is where this database fact is initialised at startup, ready for an update to occur.  To set this up, please create a new sub item goal called '''TV_JournalUpdate''' and enter in the following code.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.2_RegisterQuestStateFlags.PNG|none|left|Register quest state flags|896px]]&lt;br /&gt;
&lt;br /&gt;
I've also attached a version you can copy / paste below, however.  Please note that you will need to update the '''CharacterCreationDummy''' with your own character GUID.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Let the story know that our test dummy character is a player character&lt;br /&gt;
DB_IsPlayer(CHARACTERGUID_S_GLO_CharacterCreationDummy_001_da072fe7-fdd5-42ae-9139-8bd4b9fca406);&lt;br /&gt;
&lt;br /&gt;
// Define the Lost Medicine 'Started' flag for our quest, and so our dialog has a ready to go database fact to update&lt;br /&gt;
DB_QuestDef_State(&amp;quot;LostMedicine&amp;quot;,&amp;quot;Started&amp;quot;,1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.3. Switch to game mode to test the quest journal updates'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save everything and then switch to the game mode to test the quest journal updates in the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.1_SwitchToGameMode.png|none|left|Switch to game mode|377px]]&lt;br /&gt;
&lt;br /&gt;
Walk up to Elena and talk to her – after which you should see the following '''Quest Journal''' update ('''The Lost Medicine''') appear on your screen.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.2_JournalUpdated.png|none|left|Journal updated|299px]]&lt;br /&gt;
&lt;br /&gt;
Opening your journal while in game mode should also now display The Lost Medicine quest details.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.3_CheckQuestJournal.png|none|left|Open quest journal|724px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.4. Improving our dialog with Elena'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Elena''' dialog and add a new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and a new question that follows our new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  This greeting is going to be the new dialog chain that will occur when the player starts a dialog with '''Elena''', and has already started the lost medicine quest.&lt;br /&gt;
&lt;br /&gt;
Select our new greeting node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and click on 'Edit' in our 'Flags To Check' field, adding in the '''LostMedicine_Started''' flag.  Finally, tick this flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; so that this greeting dialog chain will only begin if we have already started the lost medicine quest.  To tidy up, also select our original greeting node and add a lost medicine flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, this time making sure not to tick it – so that this greeting chain only plays if the lost medicine quest has not started.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.4_ImprovingDialog.png|none|left|Improving dialog|765px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.5. Getting Elena to run back to her tent'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We're going to add in some small updates, creating a point trigger inside Elena's tent and getting her to run there after our quest started flag has been activated.  To get going, search for '''point trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the Root Templates panel, select a 'Point Trigger' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; and drag it into our scene, inside the tent &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once happy with the positioning, go ahead and update the name of the trigger to '''TV_ElenaRunToTent_PointTrigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5.1_AddStoryScript.png|none|left|Add story script|825px]]&lt;br /&gt;
&lt;br /&gt;
{{warning|Elena will end up facing wherever she stops running, and is not affected by the facing of the Point Trigger.}}&lt;br /&gt;
&lt;br /&gt;
Ok, half way there – next step is to add a bit of code into our Story Editor.  Open up the StoryEditor, right click on 'TheVillage' goal and select 'Add New Sub Item...'.  Then name your new sub-item goal '''TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; as this is where we will be writing code related to her actions.  Once done, open up the KB section and enter in the following code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5_SetupPointTrigger.png|none|left|Setup point trigger|750px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IF&lt;br /&gt;
ObjectFlagSet(&amp;quot;QuestUpdate_LostMedicine_Started&amp;quot;, _player, _)&lt;br /&gt;
THEN&lt;br /&gt;
ProcCharacterMoveTo(CHARACTERGUID_S_TV_Elena_56d1fd6c-d1ac-4d87-bba8-33a6297fa437, TRIGGERGUID_S_TV_ElenaRunToTent_PointTrigger_9a113b13-6078-44fb-a06f-917c354960ea, 1, &amp;quot;&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;br /&gt;
&lt;br /&gt;
== Encounters ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4748</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4748"/>
		<updated>2017-12-12T03:32:30Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: Fixed display bug and title issue for 10.5&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.1. Create a new adventure type project, targeted at Story mode'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.2. Create a new basic level template, called 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''2.1. Create a new NPC character model and place it into the level'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.1. Create the start of a simple dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.2. Save the dialog as 'TV_Elena_Dialog' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.3. Create the rest of the dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.4. Setup and assign speakers for your dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.5. Assign the correct speaker to each node'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
== Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.1. Create our quest categories'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.2. Save and reload all'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.3. Add a new quest under our 'QCA_Chapter_01' category'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
== Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen -- and right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, searching for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like tents we'd find in a nomad community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
== Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
== Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.1. Add a shovel and three instances of a white sand pile'''&amp;lt;/span&amp;gt;&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.2.  Add some objects into the level to dig up out of our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.3. Add our objects to our sand-piles item property'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.4. Only show our sand piles if the user passes a perception test'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.1 Naming and referencing of local instances'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.2 Doing a better job hiding our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.3 Setting up box triggers to implement digging treasure rewards'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.1. There is only ever one story, with goals running in alphabetical order'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.2. Sub-goals will only run when their parent goal is 'complete' '''&amp;lt;span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.3. Create a parent goal for your level under the __Start goal'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.4. Add in the code that will complete our parent level goal&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.6. Generate definitions, build and reload'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Quest state updates, smarter dialogs and moving characters ==&lt;br /&gt;
We're going to take a slight step backwards here and update our dialog with Elena.  The goal here is to activate the 'Started' quest state we created earlier for 'The Lost Medicine' quest, which will then display in the players quest journal.  We will also want to look at getting Elena to run back to her families tent and to say something different to us once we have accepted the quest – otherwise she will continue to ask us to find her medicine, even though we had already started doing just that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.1. How do we update quest states?'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main mechanism for doing this is the '''ObjectSetFlag()''' Osiris Call, which we can call from any of our scripts.  Another common way of updating our quest states is via Dialogs, and their 'Node Flags' property, which is what we will be using right now.&lt;br /&gt;
&lt;br /&gt;
A heads up on updating quest states is that Larian has a syntax we need to follow when updating or checking quest state flags.  The format to use is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;ObjectSetFlag(_Player, &amp;quot;QuestUpdate_&amp;lt;NameOfQuest&amp;gt;_&amp;lt;QuestState&amp;gt;, _&amp;quot;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus, to set our quest status to started, we just need to switch on its flag.  An example update format to use is shown below, with the &amp;quot;'''QuestUpdate_LostMedicine_Started'''&amp;quot; string.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.1_QuestCategories.png|none|left|Quest categories|264px]]&lt;br /&gt;
&lt;br /&gt;
Luckily we can also update quest states from within our dialogs.  For the next steps please open the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, open our '''TV_Elena_Dialog''' file &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2-4)&amp;lt;/span&amp;gt;, select the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and press the edit button for the 'Flags To Set' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt; property.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.2_DialogEditing.PNG|none|left|Dialog editing|615px]]&lt;br /&gt;
&lt;br /&gt;
Continuing on from above, we now need to create a custom flag which will be used to update our quest status.  To do so, click on the 'Character' flag category &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter '''QuestUpdate_LostMedicine_Started''' in the custom flag field &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  Press Add &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and then press Ok &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes.  Once saved, tick the 'QuestUpdate_LostMedicine_Started' flag to update our quest status when our players reach this particular node.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.3_UpdatingFlags.png|none|left|Updating quest flags|550px]]&lt;br /&gt;
&lt;br /&gt;
Press Ctrl + S to save your changes, and the close the Dialog Editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.2. Registering our Quest state flags'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Oops!  One step we forgot to do was registering the &amp;quot;Started&amp;quot; quest state in our Story Editor.  This is where this database fact is initialised at startup, ready for an update to occur.  To set this up, please create a new sub item goal called '''TV_JournalUpdate''' and enter in the following code.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.2_RegisterQuestStateFlags.PNG|none|left|Register quest state flags|896px]]&lt;br /&gt;
&lt;br /&gt;
I've also attached a version you can copy / paste below, however.  Please note that you will need to update the '''CharacterCreationDummy''' with your own character GUID.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Let the story know that our test dummy character is a player character&lt;br /&gt;
DB_IsPlayer(CHARACTERGUID_S_GLO_CharacterCreationDummy_001_da072fe7-fdd5-42ae-9139-8bd4b9fca406);&lt;br /&gt;
&lt;br /&gt;
// Define the Lost Medicine 'Started' flag for our quest, and so our dialog has a ready to go database fact to update&lt;br /&gt;
DB_QuestDef_State(&amp;quot;LostMedicine&amp;quot;,&amp;quot;Started&amp;quot;,1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.3. Switch to game mode to test the quest journal updates'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save everything and then switch to the game mode to test the quest journal updates in the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.1_SwitchToGameMode.png|none|left|Switch to game mode|377px]]&lt;br /&gt;
&lt;br /&gt;
Walk up to Elena and talk to her – after which you should see the following '''Quest Journal''' update ('''The Lost Medicine''') appear on your screen.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.2_JournalUpdated.png|none|left|Journal updated|299px]]&lt;br /&gt;
&lt;br /&gt;
Opening your journal while in game mode should also now display The Lost Medicine quest details.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.3_CheckQuestJournal.png|none|left|Open quest journal|724px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.4. Improving our dialog with Elena'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Elena''' dialog and add a new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and a new question that follows our new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  This greeting is going to be the new dialog chain that will occur when the player starts a dialog with '''Elena''', and has already started the lost medicine quest.&lt;br /&gt;
&lt;br /&gt;
Select our new greeting node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and click on 'Edit' in our 'Flags To Check' field, adding in the '''LostMedicine_Started''' flag.  Finally, tick this flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; so that this greeting dialog chain will only begin if we have already started the lost medicine quest.  To tidy up, also select our original greeting node and add a lost medicine flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, this time making sure not to tick it – so that this greeting chain only plays if the lost medicine quest has not started.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.4_ImprovingDialog.png|none|left|Improving dialog|765px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.5. Getting Elena to run back to her tent'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We're going to add in some small updates, creating a point trigger inside Elena's tent and getting her to run there after our quest started flag has been activated.  To get going, search for '''point trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the Root Templates panel, select a 'Point Trigger' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; and drag it into our scene, inside the tent style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once happy with the positioning, go ahead and update the name of the trigger to '''TV_ElenaRunToTent_PointTrigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5.1_AddStoryScript.png|none|left|Add story script|825px]]&lt;br /&gt;
&lt;br /&gt;
{{warning|Elena will end up facing wherever she stops running, and is not affected by the facing of the Point Trigger.}}&lt;br /&gt;
&lt;br /&gt;
Ok, half way there – next step is to add a bit of code into our Story Editor.  Open up the StoryEditor, right click on 'TheVillage' goal and select 'Add New Sub Item...'.  Then name your new sub-item goal '''TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; as this is where we will be writing code related to her actions.  Once done, open up the KB section and enter in the following code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5_SetupPointTrigger.png|none|left|Setup point trigger|750px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IF&lt;br /&gt;
ObjectFlagSet(&amp;quot;QuestUpdate_LostMedicine_Started&amp;quot;, _player, _)&lt;br /&gt;
THEN&lt;br /&gt;
ProcCharacterMoveTo(CHARACTERGUID_S_TV_Elena_56d1fd6c-d1ac-4d87-bba8-33a6297fa437, TRIGGERGUID_S_TV_ElenaRunToTent_PointTrigger_9a113b13-6078-44fb-a06f-917c354960ea, 1, &amp;quot;&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;br /&gt;
&lt;br /&gt;
== Encounters ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4747</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4747"/>
		<updated>2017-12-12T03:30:39Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: Added &amp;lt;span&amp;gt; section to fix display bug&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.1. Create a new adventure type project, targeted at Story mode'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.2. Create a new basic level template, called 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''2.1. Create a new NPC character model and place it into the level'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.1. Create the start of a simple dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.2. Save the dialog as 'TV_Elena_Dialog' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.3. Create the rest of the dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.4. Setup and assign speakers for your dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.5. Assign the correct speaker to each node'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
== Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.1. Create our quest categories'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.2. Save and reload all'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.3. Add a new quest under our 'QCA_Chapter_01' category'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
== Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen -- and right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, searching for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like tents we'd find in a nomad community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
== Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
== Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.1. Add a shovel and three instances of a white sand pile'''&amp;lt;/span&amp;gt;&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.2.  Add some objects into the level to dig up out of our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.3. Add our objects to our sand-piles item property'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.4. Only show our sand piles if the user passes a perception test'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.1 Naming and referencing of local instances'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.2 Doing a better job hiding our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.3 Setting up box triggers to implement digging treasure rewards'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.1. There is only ever one story, with goals running in alphabetical order'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.2. Sub-goals will only run when their parent goal is 'complete' '''&amp;lt;span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.3. Create a parent goal for your level under the __Start goal'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.4. Add in the code that will complete our parent level goal&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.6. Generate definitions, build and reload'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Quest state updates, smarter dialogs and moving characters ==&lt;br /&gt;
We're going to take a slight step backwards here and update our dialog with Elena.  The goal here is to activate the 'Started' quest state we created earlier for 'The Lost Medicine' quest, which will then display in the players quest journal.  We will also want to look at getting Elena to run back to her families tent and to say something different to us once we have accepted the quest – otherwise she will continue to ask us to find her medicine, even though we had already started doing just that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.1. How do we update quest states?'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main mechanism for doing this is the '''ObjectSetFlag()''' Osiris Call, which we can call from any of our scripts.  Another common way of updating our quest states is via Dialogs, and their 'Node Flags' property, which is what we will be using right now.&lt;br /&gt;
&lt;br /&gt;
A heads up on updating quest states is that Larian has a syntax we need to follow when updating or checking quest state flags.  The format to use is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;ObjectSetFlag(_Player, &amp;quot;QuestUpdate_&amp;lt;NameOfQuest&amp;gt;_&amp;lt;QuestState&amp;gt;, _&amp;quot;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus, to set our quest status to started, we just need to switch on its flag.  An example update format to use is shown below, with the &amp;quot;'''QuestUpdate_LostMedicine_Started'''&amp;quot; string.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.1_QuestCategories.png|none|left|Quest categories|264px]]&lt;br /&gt;
&lt;br /&gt;
Luckily we can also update quest states from within our dialogs.  For the next steps please open the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, open our '''TV_Elena_Dialog''' file &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2-4)&amp;lt;/span&amp;gt;, select the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and press the edit button for the 'Flags To Set' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt; property.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.2_DialogEditing.PNG|none|left|Dialog editing|615px]]&lt;br /&gt;
&lt;br /&gt;
Continuing on from above, we now need to create a custom flag which will be used to update our quest status.  To do so, click on the 'Character' flag category &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter '''QuestUpdate_LostMedicine_Started''' in the custom flag field &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  Press Add &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and then press Ok &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes.  Once saved, tick the 'QuestUpdate_LostMedicine_Started' flag to update our quest status when our players reach this particular node.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.3_UpdatingFlags.png|none|left|Updating quest flags|550px]]&lt;br /&gt;
&lt;br /&gt;
Press Ctrl + S to save your changes, and the close the Dialog Editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.2. Registering our Quest state flags'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Oops!  One step we forgot to do was registering the &amp;quot;Started&amp;quot; quest state in our Story Editor.  This is where this database fact is initialised at startup, ready for an update to occur.  To set this up, please create a new sub item goal called '''TV_JournalUpdate''' and enter in the following code.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.2_RegisterQuestStateFlags.PNG|none|left|Register quest state flags|896px]]&lt;br /&gt;
&lt;br /&gt;
I've also attached a version you can copy / paste below, however.  Please note that you will need to update the '''CharacterCreationDummy''' with your own character GUID.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Let the story know that our test dummy character is a player character&lt;br /&gt;
DB_IsPlayer(CHARACTERGUID_S_GLO_CharacterCreationDummy_001_da072fe7-fdd5-42ae-9139-8bd4b9fca406);&lt;br /&gt;
&lt;br /&gt;
// Define the Lost Medicine 'Started' flag for our quest, and so our dialog has a ready to go database fact to update&lt;br /&gt;
DB_QuestDef_State(&amp;quot;LostMedicine&amp;quot;,&amp;quot;Started&amp;quot;,1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.3. Switch to game mode to test the quest journal updates'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save everything and then switch to the game mode to test the quest journal updates in the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.1_SwitchToGameMode.png|none|left|Switch to game mode|377px]]&lt;br /&gt;
&lt;br /&gt;
Walk up to Elena and talk to her – after which you should see the following '''Quest Journal''' update ('''The Lost Medicine''') appear on your screen.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.2_JournalUpdated.png|none|left|Journal updated|299px]]&lt;br /&gt;
&lt;br /&gt;
Opening your journal while in game mode should also now display The Lost Medicine quest details.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.3_CheckQuestJournal.png|none|left|Open quest journal|724px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.4. Improving our dialog with Elena'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Elena''' dialog and add a new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and a new question that follows our new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  This greeting is going to be the new dialog chain that will occur when the player starts a dialog with '''Elena''', and has already started the lost medicine quest.&lt;br /&gt;
&lt;br /&gt;
Select our new greeting node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and click on 'Edit' in our 'Flags To Check' field, adding in the '''LostMedicine_Started''' flag.  Finally, tick this flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; so that this greeting dialog chain will only begin if we have already started the lost medicine quest.  To tidy up, also select our original greeting node and add a lost medicine flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, this time making sure not to tick it – so that this greeting chain only plays if the lost medicine quest has not started.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.4_ImprovingDialog.png|none|left|Improving dialog|765px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.4. Improving our dialog with Elena'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We're going to add in some small updates, creating a point trigger inside Elena's tent and getting her to run there after our quest started flag has been activated.  To get going, search for '''point trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the Root Templates panel, select a 'Point Trigger' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; and drag it into our scene, inside the tent style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once happy with the positioning, go ahead and update the name of the trigger to '''TV_ElenaRunToTent_PointTrigger''' style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5.1_AddStoryScript.png|none|left|Add story script|825px]]&lt;br /&gt;
&lt;br /&gt;
{{warning|Elena will end up facing wherever she stops running, and is not affected by the facing of the Point Trigger.}}&lt;br /&gt;
&lt;br /&gt;
Ok, half way there – next step is to add a bit of code into our Story Editor.  Open up the StoryEditor, right click on 'TheVillage' goal and select 'Add New Sub Item...'.  Then name your new sub-item goal '''TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; as this is where we will be writing code related to her actions.  Once done, open up the KB section and enter in the following code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5_SetupPointTrigger.png|none|left|Setup point trigger|750px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IF&lt;br /&gt;
ObjectFlagSet(&amp;quot;QuestUpdate_LostMedicine_Started&amp;quot;, _player, _)&lt;br /&gt;
THEN&lt;br /&gt;
ProcCharacterMoveTo(CHARACTERGUID_S_TV_Elena_56d1fd6c-d1ac-4d87-bba8-33a6297fa437, TRIGGERGUID_S_TV_ElenaRunToTent_PointTrigger_9a113b13-6078-44fb-a06f-917c354960ea, 1, &amp;quot;&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;br /&gt;
&lt;br /&gt;
== Encounters ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=User:RaalKadaj&amp;diff=4746</id>
		<title>User:RaalKadaj</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=User:RaalKadaj&amp;diff=4746"/>
		<updated>2017-12-11T22:19:36Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Full time stay-at-home dad, with a few side projects:&lt;br /&gt;
&lt;br /&gt;
1) '''Divinity Engine Modding''' - Dawn of the Dead {Work In Progress}, How to make a basic adventure {Guide}&lt;br /&gt;
&lt;br /&gt;
2) '''Charity work''' - feedles.org&lt;br /&gt;
&lt;br /&gt;
3) '''Software development and digital consulting help''' - kerofrog.com &amp;amp; Digital Path&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=User:RaalKadaj&amp;diff=4745</id>
		<title>User:RaalKadaj</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=User:RaalKadaj&amp;diff=4745"/>
		<updated>2017-12-11T22:18:21Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Full time stay-at-home dad, with a few side projects:&lt;br /&gt;
&lt;br /&gt;
1) '''Divinity Engine Modding''' - Dawn of the Dead {Work In Progress}, How to make a basic adventure {Guide}&lt;br /&gt;
&lt;br /&gt;
2) Charity work - feedles.org&lt;br /&gt;
&lt;br /&gt;
3) Software development and digital consulting help - kerofrog.com&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4742</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4742"/>
		<updated>2017-12-11T07:19:40Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: /* Create our Quest Journal entries */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.1. Create a new adventure type project, targeted at Story mode'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.2. Create a new basic level template, called 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''2.1. Create a new NPC character model and place it into the level'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.1. Create the start of a simple dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.2. Save the dialog as 'TV_Elena_Dialog' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.3. Create the rest of the dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.4. Setup and assign speakers for your dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.5. Assign the correct speaker to each node'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
== Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.1. Create our quest categories'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.2. Save and reload all'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.3. Add a new quest under our 'QCA_Chapter_01' category'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
== Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen -- and right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, searching for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like tents we'd find in a nomad community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
== Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
== Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.1. Add a shovel and three instances of a white sand pile'''&amp;lt;/span&amp;gt;&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.2.  Add some objects into the level to dig up out of our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.3. Add our objects to our sand-piles item property'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.4. Only show our sand piles if the user passes a perception test'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.1 Naming and referencing of local instances'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.2 Doing a better job hiding our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.3 Setting up box triggers to implement digging treasure rewards'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.1. There is only ever one story, with goals running in alphabetical order'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.2. Sub-goals will only run when their parent goal is 'complete' '''&amp;lt;span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.3. Create a parent goal for your level under the __Start goal'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.4. Add in the code that will complete our parent level goal&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.6. Generate definitions, build and reload'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Quest state updates, smarter dialogs and moving characters ==&lt;br /&gt;
We're going to take a slight step backwards here and update our dialog with Elena.  The goal here is to activate the 'Started' quest state we created earlier for 'The Lost Medicine' quest, which will then display in the players quest journal.  We will also want to look at getting Elena to run back to her families tent and to say something different to us once we have accepted the quest – otherwise she will continue to ask us to find her medicine, even though we had already started doing just that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.1. How do we update quest states?'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main mechanism for doing this is the '''ObjectSetFlag()''' Osiris Call, which we can call from any of our scripts.  Another common way of updating our quest states is via Dialogs, and their 'Node Flags' property, which is what we will be using right now.&lt;br /&gt;
&lt;br /&gt;
A heads up on updating quest states is that Larian has a syntax we need to follow when updating or checking quest state flags.  The format to use is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;ObjectSetFlag(_Player, &amp;quot;QuestUpdate_&amp;lt;NameOfQuest&amp;gt;_&amp;lt;QuestState&amp;gt;, _&amp;quot;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus, to set our quest status to started, we just need to switch on its flag.  An example update format to use is shown below, with the &amp;quot;'''QuestUpdate_LostMedicine_Started'''&amp;quot; string.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.1_QuestCategories.png|none|left|Quest categories|264px]]&lt;br /&gt;
&lt;br /&gt;
Luckily we can also update quest states from within our dialogs.  For the next steps please open the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, open our '''TV_Elena_Dialog''' file &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2-4)&amp;lt;/span&amp;gt;, select the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and press the edit button for the 'Flags To Set' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt; property.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.2_DialogEditing.PNG|none|left|Dialog editing|615px]]&lt;br /&gt;
&lt;br /&gt;
Continuing on from above, we now need to create a custom flag which will be used to update our quest status.  To do so, click on the 'Character' flag category &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter '''QuestUpdate_LostMedicine_Started''' in the custom flag field &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  Press Add &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and then press Ok &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes.  Once saved, tick the 'QuestUpdate_LostMedicine_Started' flag to update our quest status when our players reach this particular node.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.3_UpdatingFlags.png|none|left|Updating quest flags|550px]]&lt;br /&gt;
&lt;br /&gt;
Press Ctrl + S to save your changes, and the close the Dialog Editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.2. Registering our Quest state flags'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Oops!  One step we forgot to do was registering the &amp;quot;Started&amp;quot; quest state in our Story Editor.  This is where this database fact is initialised at startup, ready for an update to occur.  To set this up, please create a new sub item goal called '''TV_JournalUpdate''' and enter in the following code.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.2_RegisterQuestStateFlags.PNG|none|left|Register quest state flags|896px]]&lt;br /&gt;
&lt;br /&gt;
I've also attached a version you can copy / paste below, however.  Please note that you will need to update the '''CharacterCreationDummy''' with your own character GUID.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Let the story know that our test dummy character is a player character&lt;br /&gt;
DB_IsPlayer(CHARACTERGUID_S_GLO_CharacterCreationDummy_001_da072fe7-fdd5-42ae-9139-8bd4b9fca406);&lt;br /&gt;
&lt;br /&gt;
// Define the Lost Medicine 'Started' flag for our quest, and so our dialog has a ready to go database fact to update&lt;br /&gt;
DB_QuestDef_State(&amp;quot;LostMedicine&amp;quot;,&amp;quot;Started&amp;quot;,1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.3. Switch to game mode to test the quest journal updates'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save everything and then switch to the game mode to test the quest journal updates in the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.1_SwitchToGameMode.png|none|left|Switch to game mode|377px]]&lt;br /&gt;
&lt;br /&gt;
Walk up to Elena and talk to her – after which you should see the following '''Quest Journal''' update ('''The Lost Medicine''') appear on your screen.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.2_JournalUpdated.png|none|left|Journal updated|299px]]&lt;br /&gt;
&lt;br /&gt;
Opening your journal while in game mode should also now display The Lost Medicine quest details.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.3_CheckQuestJournal.png|none|left|Open quest journal|724px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.4. Improving our dialog with Elena'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Elena''' dialog and add a new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and a new question that follows our new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  This greeting is going to be the new dialog chain that will occur when the player starts a dialog with '''Elena''', and has already started the lost medicine quest.&lt;br /&gt;
&lt;br /&gt;
Select our new greeting node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and click on 'Edit' in our 'Flags To Check' field, adding in the '''LostMedicine_Started''' flag.  Finally, tick this flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; so that this greeting dialog chain will only begin if we have already started the lost medicine quest.  To tidy up, also select our original greeting node and add a lost medicine flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, this time making sure not to tick it – so that this greeting chain only plays if the lost medicine quest has not started.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.4_ImprovingDialog.png|none|left|Improving dialog|765px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.4. Improving our dialog with Elena'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We're going to add in some small updates, creating a point trigger inside Elena's tent and getting her to run there after our quest started flag has been activated.  To get going, search for '''point trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the Root Templates panel, select a 'Point Trigger' style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; and drag it into our scene, inside the tent style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once happy with the positioning, go ahead and update the name of the trigger to '''TV_ElenaRunToTent_PointTrigger''' style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5.1_AddStoryScript.png|none|left|Add story script|825px]]&lt;br /&gt;
&lt;br /&gt;
{{warning|Elena will end up facing wherever she stops running, and is not affected by the facing of the Point Trigger.}}&lt;br /&gt;
&lt;br /&gt;
Ok, half way there – next step is to add a bit of code into our Story Editor.  Open up the StoryEditor, right click on 'TheVillage' goal and select 'Add New Sub Item...'.  Then name your new sub-item goal '''TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; as this is where we will be writing code related to her actions.  Once done, open up the KB section and enter in the following code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5_SetupPointTrigger.png|none|left|Setup point trigger|750px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IF&lt;br /&gt;
ObjectFlagSet(&amp;quot;QuestUpdate_LostMedicine_Started&amp;quot;, _player, _)&lt;br /&gt;
THEN&lt;br /&gt;
ProcCharacterMoveTo(CHARACTERGUID_S_TV_Elena_56d1fd6c-d1ac-4d87-bba8-33a6297fa437, TRIGGERGUID_S_TV_ElenaRunToTent_PointTrigger_9a113b13-6078-44fb-a06f-917c354960ea, 1, &amp;quot;&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;br /&gt;
&lt;br /&gt;
== Encounters ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4741</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4741"/>
		<updated>2017-12-11T07:18:28Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: /* 6. Shortcut tips for working with objects */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.1. Create a new adventure type project, targeted at Story mode'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.2. Create a new basic level template, called 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''2.1. Create a new NPC character model and place it into the level'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.1. Create the start of a simple dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.2. Save the dialog as 'TV_Elena_Dialog' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.3. Create the rest of the dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.4. Setup and assign speakers for your dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.5. Assign the correct speaker to each node'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
== Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.1. Create our quest categories'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''Save and reload all'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.3. Add a new quest under our 'QCA_Chapter_01' category'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen -- and right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, searching for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like tents we'd find in a nomad community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
== Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
== Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.1. Add a shovel and three instances of a white sand pile'''&amp;lt;/span&amp;gt;&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.2.  Add some objects into the level to dig up out of our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.3. Add our objects to our sand-piles item property'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.4. Only show our sand piles if the user passes a perception test'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.1 Naming and referencing of local instances'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.2 Doing a better job hiding our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.3 Setting up box triggers to implement digging treasure rewards'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.1. There is only ever one story, with goals running in alphabetical order'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.2. Sub-goals will only run when their parent goal is 'complete' '''&amp;lt;span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.3. Create a parent goal for your level under the __Start goal'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.4. Add in the code that will complete our parent level goal&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.6. Generate definitions, build and reload'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Quest state updates, smarter dialogs and moving characters ==&lt;br /&gt;
We're going to take a slight step backwards here and update our dialog with Elena.  The goal here is to activate the 'Started' quest state we created earlier for 'The Lost Medicine' quest, which will then display in the players quest journal.  We will also want to look at getting Elena to run back to her families tent and to say something different to us once we have accepted the quest – otherwise she will continue to ask us to find her medicine, even though we had already started doing just that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.1. How do we update quest states?'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main mechanism for doing this is the '''ObjectSetFlag()''' Osiris Call, which we can call from any of our scripts.  Another common way of updating our quest states is via Dialogs, and their 'Node Flags' property, which is what we will be using right now.&lt;br /&gt;
&lt;br /&gt;
A heads up on updating quest states is that Larian has a syntax we need to follow when updating or checking quest state flags.  The format to use is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;ObjectSetFlag(_Player, &amp;quot;QuestUpdate_&amp;lt;NameOfQuest&amp;gt;_&amp;lt;QuestState&amp;gt;, _&amp;quot;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus, to set our quest status to started, we just need to switch on its flag.  An example update format to use is shown below, with the &amp;quot;'''QuestUpdate_LostMedicine_Started'''&amp;quot; string.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.1_QuestCategories.png|none|left|Quest categories|264px]]&lt;br /&gt;
&lt;br /&gt;
Luckily we can also update quest states from within our dialogs.  For the next steps please open the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, open our '''TV_Elena_Dialog''' file &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2-4)&amp;lt;/span&amp;gt;, select the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and press the edit button for the 'Flags To Set' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt; property.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.2_DialogEditing.PNG|none|left|Dialog editing|615px]]&lt;br /&gt;
&lt;br /&gt;
Continuing on from above, we now need to create a custom flag which will be used to update our quest status.  To do so, click on the 'Character' flag category &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter '''QuestUpdate_LostMedicine_Started''' in the custom flag field &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  Press Add &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and then press Ok &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes.  Once saved, tick the 'QuestUpdate_LostMedicine_Started' flag to update our quest status when our players reach this particular node.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.3_UpdatingFlags.png|none|left|Updating quest flags|550px]]&lt;br /&gt;
&lt;br /&gt;
Press Ctrl + S to save your changes, and the close the Dialog Editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.2. Registering our Quest state flags'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Oops!  One step we forgot to do was registering the &amp;quot;Started&amp;quot; quest state in our Story Editor.  This is where this database fact is initialised at startup, ready for an update to occur.  To set this up, please create a new sub item goal called '''TV_JournalUpdate''' and enter in the following code.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.2_RegisterQuestStateFlags.PNG|none|left|Register quest state flags|896px]]&lt;br /&gt;
&lt;br /&gt;
I've also attached a version you can copy / paste below, however.  Please note that you will need to update the '''CharacterCreationDummy''' with your own character GUID.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Let the story know that our test dummy character is a player character&lt;br /&gt;
DB_IsPlayer(CHARACTERGUID_S_GLO_CharacterCreationDummy_001_da072fe7-fdd5-42ae-9139-8bd4b9fca406);&lt;br /&gt;
&lt;br /&gt;
// Define the Lost Medicine 'Started' flag for our quest, and so our dialog has a ready to go database fact to update&lt;br /&gt;
DB_QuestDef_State(&amp;quot;LostMedicine&amp;quot;,&amp;quot;Started&amp;quot;,1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.3. Switch to game mode to test the quest journal updates'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save everything and then switch to the game mode to test the quest journal updates in the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.1_SwitchToGameMode.png|none|left|Switch to game mode|377px]]&lt;br /&gt;
&lt;br /&gt;
Walk up to Elena and talk to her – after which you should see the following '''Quest Journal''' update ('''The Lost Medicine''') appear on your screen.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.2_JournalUpdated.png|none|left|Journal updated|299px]]&lt;br /&gt;
&lt;br /&gt;
Opening your journal while in game mode should also now display The Lost Medicine quest details.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.3_CheckQuestJournal.png|none|left|Open quest journal|724px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.4. Improving our dialog with Elena'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Elena''' dialog and add a new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and a new question that follows our new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  This greeting is going to be the new dialog chain that will occur when the player starts a dialog with '''Elena''', and has already started the lost medicine quest.&lt;br /&gt;
&lt;br /&gt;
Select our new greeting node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and click on 'Edit' in our 'Flags To Check' field, adding in the '''LostMedicine_Started''' flag.  Finally, tick this flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; so that this greeting dialog chain will only begin if we have already started the lost medicine quest.  To tidy up, also select our original greeting node and add a lost medicine flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, this time making sure not to tick it – so that this greeting chain only plays if the lost medicine quest has not started.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.4_ImprovingDialog.png|none|left|Improving dialog|765px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.4. Improving our dialog with Elena'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We're going to add in some small updates, creating a point trigger inside Elena's tent and getting her to run there after our quest started flag has been activated.  To get going, search for '''point trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the Root Templates panel, select a 'Point Trigger' style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; and drag it into our scene, inside the tent style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once happy with the positioning, go ahead and update the name of the trigger to '''TV_ElenaRunToTent_PointTrigger''' style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5.1_AddStoryScript.png|none|left|Add story script|825px]]&lt;br /&gt;
&lt;br /&gt;
{{warning|Elena will end up facing wherever she stops running, and is not affected by the facing of the Point Trigger.}}&lt;br /&gt;
&lt;br /&gt;
Ok, half way there – next step is to add a bit of code into our Story Editor.  Open up the StoryEditor, right click on 'TheVillage' goal and select 'Add New Sub Item...'.  Then name your new sub-item goal '''TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; as this is where we will be writing code related to her actions.  Once done, open up the KB section and enter in the following code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5_SetupPointTrigger.png|none|left|Setup point trigger|750px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IF&lt;br /&gt;
ObjectFlagSet(&amp;quot;QuestUpdate_LostMedicine_Started&amp;quot;, _player, _)&lt;br /&gt;
THEN&lt;br /&gt;
ProcCharacterMoveTo(CHARACTERGUID_S_TV_Elena_56d1fd6c-d1ac-4d87-bba8-33a6297fa437, TRIGGERGUID_S_TV_ElenaRunToTent_PointTrigger_9a113b13-6078-44fb-a06f-917c354960ea, 1, &amp;quot;&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;br /&gt;
&lt;br /&gt;
== Encounters ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4740</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4740"/>
		<updated>2017-12-11T07:18:12Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.1. Create a new adventure type project, targeted at Story mode'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.2. Create a new basic level template, called 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''2.1. Create a new NPC character model and place it into the level'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.1. Create the start of a simple dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.2. Save the dialog as 'TV_Elena_Dialog' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.3. Create the rest of the dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.4. Setup and assign speakers for your dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.5. Assign the correct speaker to each node'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
== Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.1. Create our quest categories'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''Save and reload all'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.3. Add a new quest under our 'QCA_Chapter_01' category'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen -- and right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, searching for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like tents we'd find in a nomad community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.1. Add a shovel and three instances of a white sand pile'''&amp;lt;/span&amp;gt;&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.2.  Add some objects into the level to dig up out of our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.3. Add our objects to our sand-piles item property'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.4. Only show our sand piles if the user passes a perception test'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.1 Naming and referencing of local instances'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.2 Doing a better job hiding our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.3 Setting up box triggers to implement digging treasure rewards'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.1. There is only ever one story, with goals running in alphabetical order'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.2. Sub-goals will only run when their parent goal is 'complete' '''&amp;lt;span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.3. Create a parent goal for your level under the __Start goal'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.4. Add in the code that will complete our parent level goal&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.6. Generate definitions, build and reload'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Quest state updates, smarter dialogs and moving characters ==&lt;br /&gt;
We're going to take a slight step backwards here and update our dialog with Elena.  The goal here is to activate the 'Started' quest state we created earlier for 'The Lost Medicine' quest, which will then display in the players quest journal.  We will also want to look at getting Elena to run back to her families tent and to say something different to us once we have accepted the quest – otherwise she will continue to ask us to find her medicine, even though we had already started doing just that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.1. How do we update quest states?'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main mechanism for doing this is the '''ObjectSetFlag()''' Osiris Call, which we can call from any of our scripts.  Another common way of updating our quest states is via Dialogs, and their 'Node Flags' property, which is what we will be using right now.&lt;br /&gt;
&lt;br /&gt;
A heads up on updating quest states is that Larian has a syntax we need to follow when updating or checking quest state flags.  The format to use is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;ObjectSetFlag(_Player, &amp;quot;QuestUpdate_&amp;lt;NameOfQuest&amp;gt;_&amp;lt;QuestState&amp;gt;, _&amp;quot;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus, to set our quest status to started, we just need to switch on its flag.  An example update format to use is shown below, with the &amp;quot;'''QuestUpdate_LostMedicine_Started'''&amp;quot; string.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.1_QuestCategories.png|none|left|Quest categories|264px]]&lt;br /&gt;
&lt;br /&gt;
Luckily we can also update quest states from within our dialogs.  For the next steps please open the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, open our '''TV_Elena_Dialog''' file &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2-4)&amp;lt;/span&amp;gt;, select the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and press the edit button for the 'Flags To Set' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt; property.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.2_DialogEditing.PNG|none|left|Dialog editing|615px]]&lt;br /&gt;
&lt;br /&gt;
Continuing on from above, we now need to create a custom flag which will be used to update our quest status.  To do so, click on the 'Character' flag category &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter '''QuestUpdate_LostMedicine_Started''' in the custom flag field &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  Press Add &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and then press Ok &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes.  Once saved, tick the 'QuestUpdate_LostMedicine_Started' flag to update our quest status when our players reach this particular node.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.3_UpdatingFlags.png|none|left|Updating quest flags|550px]]&lt;br /&gt;
&lt;br /&gt;
Press Ctrl + S to save your changes, and the close the Dialog Editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.2. Registering our Quest state flags'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Oops!  One step we forgot to do was registering the &amp;quot;Started&amp;quot; quest state in our Story Editor.  This is where this database fact is initialised at startup, ready for an update to occur.  To set this up, please create a new sub item goal called '''TV_JournalUpdate''' and enter in the following code.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.2_RegisterQuestStateFlags.PNG|none|left|Register quest state flags|896px]]&lt;br /&gt;
&lt;br /&gt;
I've also attached a version you can copy / paste below, however.  Please note that you will need to update the '''CharacterCreationDummy''' with your own character GUID.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Let the story know that our test dummy character is a player character&lt;br /&gt;
DB_IsPlayer(CHARACTERGUID_S_GLO_CharacterCreationDummy_001_da072fe7-fdd5-42ae-9139-8bd4b9fca406);&lt;br /&gt;
&lt;br /&gt;
// Define the Lost Medicine 'Started' flag for our quest, and so our dialog has a ready to go database fact to update&lt;br /&gt;
DB_QuestDef_State(&amp;quot;LostMedicine&amp;quot;,&amp;quot;Started&amp;quot;,1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.3. Switch to game mode to test the quest journal updates'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save everything and then switch to the game mode to test the quest journal updates in the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.1_SwitchToGameMode.png|none|left|Switch to game mode|377px]]&lt;br /&gt;
&lt;br /&gt;
Walk up to Elena and talk to her – after which you should see the following '''Quest Journal''' update ('''The Lost Medicine''') appear on your screen.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.2_JournalUpdated.png|none|left|Journal updated|299px]]&lt;br /&gt;
&lt;br /&gt;
Opening your journal while in game mode should also now display The Lost Medicine quest details.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.3_CheckQuestJournal.png|none|left|Open quest journal|724px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.4. Improving our dialog with Elena'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Elena''' dialog and add a new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and a new question that follows our new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  This greeting is going to be the new dialog chain that will occur when the player starts a dialog with '''Elena''', and has already started the lost medicine quest.&lt;br /&gt;
&lt;br /&gt;
Select our new greeting node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and click on 'Edit' in our 'Flags To Check' field, adding in the '''LostMedicine_Started''' flag.  Finally, tick this flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; so that this greeting dialog chain will only begin if we have already started the lost medicine quest.  To tidy up, also select our original greeting node and add a lost medicine flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, this time making sure not to tick it – so that this greeting chain only plays if the lost medicine quest has not started.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.4_ImprovingDialog.png|none|left|Improving dialog|765px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.4. Improving our dialog with Elena'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We're going to add in some small updates, creating a point trigger inside Elena's tent and getting her to run there after our quest started flag has been activated.  To get going, search for '''point trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the Root Templates panel, select a 'Point Trigger' style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; and drag it into our scene, inside the tent style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once happy with the positioning, go ahead and update the name of the trigger to '''TV_ElenaRunToTent_PointTrigger''' style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5.1_AddStoryScript.png|none|left|Add story script|825px]]&lt;br /&gt;
&lt;br /&gt;
{{warning|Elena will end up facing wherever she stops running, and is not affected by the facing of the Point Trigger.}}&lt;br /&gt;
&lt;br /&gt;
Ok, half way there – next step is to add a bit of code into our Story Editor.  Open up the StoryEditor, right click on 'TheVillage' goal and select 'Add New Sub Item...'.  Then name your new sub-item goal '''TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; as this is where we will be writing code related to her actions.  Once done, open up the KB section and enter in the following code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5_SetupPointTrigger.png|none|left|Setup point trigger|750px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IF&lt;br /&gt;
ObjectFlagSet(&amp;quot;QuestUpdate_LostMedicine_Started&amp;quot;, _player, _)&lt;br /&gt;
THEN&lt;br /&gt;
ProcCharacterMoveTo(CHARACTERGUID_S_TV_Elena_56d1fd6c-d1ac-4d87-bba8-33a6297fa437, TRIGGERGUID_S_TV_ElenaRunToTent_PointTrigger_9a113b13-6078-44fb-a06f-917c354960ea, 1, &amp;quot;&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;br /&gt;
&lt;br /&gt;
== Encounters ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4739</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4739"/>
		<updated>2017-12-09T16:27:13Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: /* 10. Quest state updates, smarter dialogs and moving characters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.1. Create a new adventure type project, targeted at Story mode'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.2. Create a new basic level template, called 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''2.1. Create a new NPC character model and place it into the level'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.1. Create the start of a simple dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.2. Save the dialog as 'TV_Elena_Dialog' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.3. Create the rest of the dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.4. Setup and assign speakers for your dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.5. Assign the correct speaker to each node'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.1. Create our quest categories'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''Save and reload all'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.3. Add a new quest under our 'QCA_Chapter_01' category'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen -- and right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, searching for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like tents we'd find in a nomad community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.1. Add a shovel and three instances of a white sand pile'''&amp;lt;/span&amp;gt;&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.2.  Add some objects into the level to dig up out of our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.3. Add our objects to our sand-piles item property'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.4. Only show our sand piles if the user passes a perception test'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.1 Naming and referencing of local instances'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.2 Doing a better job hiding our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.3 Setting up box triggers to implement digging treasure rewards'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.1. There is only ever one story, with goals running in alphabetical order'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.2. Sub-goals will only run when their parent goal is 'complete' '''&amp;lt;span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.3. Create a parent goal for your level under the __Start goal'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.4. Add in the code that will complete our parent level goal&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.6. Generate definitions, build and reload'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. Quest state updates, smarter dialogs and moving characters ==&lt;br /&gt;
We're going to take a slight step backwards here and update our dialog with Elena.  The goal here is to activate the 'Started' quest state we created earlier for 'The Lost Medicine' quest, which will then display in the players quest journal.  We will also want to look at getting Elena to run back to her families tent and to say something different to us once we have accepted the quest – otherwise she will continue to ask us to find her medicine, even though we had already started doing just that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.1. How do we update quest states?'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main mechanism for doing this is the '''ObjectSetFlag()''' Osiris Call, which we can call from any of our scripts.  Another common way of updating our quest states is via Dialogs, and their 'Node Flags' property, which is what we will be using right now.&lt;br /&gt;
&lt;br /&gt;
A heads up on updating quest states is that Larian has a syntax we need to follow when updating or checking quest state flags.  The format to use is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;ObjectSetFlag(_Player, &amp;quot;QuestUpdate_&amp;lt;NameOfQuest&amp;gt;_&amp;lt;QuestState&amp;gt;, _&amp;quot;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus, to set our quest status to started, we just need to switch on its flag.  An example update format to use is shown below, with the &amp;quot;'''QuestUpdate_LostMedicine_Started'''&amp;quot; string.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.1_QuestCategories.png|none|left|Quest categories|264px]]&lt;br /&gt;
&lt;br /&gt;
Luckily we can also update quest states from within our dialogs.  For the next steps please open the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, open our '''TV_Elena_Dialog''' file &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2-4)&amp;lt;/span&amp;gt;, select the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and press the edit button for the 'Flags To Set' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt; property.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.2_DialogEditing.PNG|none|left|Dialog editing|615px]]&lt;br /&gt;
&lt;br /&gt;
Continuing on from above, we now need to create a custom flag which will be used to update our quest status.  To do so, click on the 'Character' flag category &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter '''QuestUpdate_LostMedicine_Started''' in the custom flag field &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  Press Add &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and then press Ok &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes.  Once saved, tick the 'QuestUpdate_LostMedicine_Started' flag to update our quest status when our players reach this particular node.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.3_UpdatingFlags.png|none|left|Updating quest flags|550px]]&lt;br /&gt;
&lt;br /&gt;
Press Ctrl + S to save your changes, and the close the Dialog Editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.2. Registering our Quest state flags'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Oops!  One step we forgot to do was registering the &amp;quot;Started&amp;quot; quest state in our Story Editor.  This is where this database fact is initialised at startup, ready for an update to occur.  To set this up, please create a new sub item goal called '''TV_JournalUpdate''' and enter in the following code.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.2_RegisterQuestStateFlags.PNG|none|left|Register quest state flags|896px]]&lt;br /&gt;
&lt;br /&gt;
I've also attached a version you can copy / paste below, however.  Please note that you will need to update the '''CharacterCreationDummy''' with your own character GUID.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Let the story know that our test dummy character is a player character&lt;br /&gt;
DB_IsPlayer(CHARACTERGUID_S_GLO_CharacterCreationDummy_001_da072fe7-fdd5-42ae-9139-8bd4b9fca406);&lt;br /&gt;
&lt;br /&gt;
// Define the Lost Medicine 'Started' flag for our quest, and so our dialog has a ready to go database fact to update&lt;br /&gt;
DB_QuestDef_State(&amp;quot;LostMedicine&amp;quot;,&amp;quot;Started&amp;quot;,1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.3. Switch to game mode to test the quest journal updates'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save everything and then switch to the game mode to test the quest journal updates in the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.1_SwitchToGameMode.png|none|left|Switch to game mode|377px]]&lt;br /&gt;
&lt;br /&gt;
Walk up to Elena and talk to her – after which you should see the following '''Quest Journal''' update ('''The Lost Medicine''') appear on your screen.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.2_JournalUpdated.png|none|left|Journal updated|299px]]&lt;br /&gt;
&lt;br /&gt;
Opening your journal while in game mode should also now display The Lost Medicine quest details.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.3_CheckQuestJournal.png|none|left|Open quest journal|724px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.4. Improving our dialog with Elena'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Elena''' dialog and add a new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and a new question that follows our new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  This greeting is going to be the new dialog chain that will occur when the player starts a dialog with '''Elena''', and has already started the lost medicine quest.&lt;br /&gt;
&lt;br /&gt;
Select our new greeting node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and click on 'Edit' in our 'Flags To Check' field, adding in the '''LostMedicine_Started''' flag.  Finally, tick this flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; so that this greeting dialog chain will only begin if we have already started the lost medicine quest.  To tidy up, also select our original greeting node and add a lost medicine flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, this time making sure not to tick it – so that this greeting chain only plays if the lost medicine quest has not started.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.4_ImprovingDialog.png|none|left|Improving dialog|765px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.4. Improving our dialog with Elena'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We're going to add in some small updates, creating a point trigger inside Elena's tent and getting her to run there after our quest started flag has been activated.  To get going, search for '''point trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the Root Templates panel, select a 'Point Trigger' style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; and drag it into our scene, inside the tent style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once happy with the positioning, go ahead and update the name of the trigger to '''TV_ElenaRunToTent_PointTrigger''' style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5.1_AddStoryScript.png|none|left|Add story script|825px]]&lt;br /&gt;
&lt;br /&gt;
{{warning|Elena will end up facing wherever she stops running, and is not affected by the facing of the Point Trigger.}}&lt;br /&gt;
&lt;br /&gt;
Ok, half way there – next step is to add a bit of code into our Story Editor.  Open up the StoryEditor, right click on 'TheVillage' goal and select 'Add New Sub Item...'.  Then name your new sub-item goal '''TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; as this is where we will be writing code related to her actions.  Once done, open up the KB section and enter in the following code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5_SetupPointTrigger.png|none|left|Setup point trigger|750px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IF&lt;br /&gt;
ObjectFlagSet(&amp;quot;QuestUpdate_LostMedicine_Started&amp;quot;, _player, _)&lt;br /&gt;
THEN&lt;br /&gt;
ProcCharacterMoveTo(CHARACTERGUID_S_TV_Elena_56d1fd6c-d1ac-4d87-bba8-33a6297fa437, TRIGGERGUID_S_TV_ElenaRunToTent_PointTrigger_9a113b13-6078-44fb-a06f-917c354960ea, 1, &amp;quot;&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;br /&gt;
&lt;br /&gt;
== 12. Encounters ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4738</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4738"/>
		<updated>2017-12-09T16:26:20Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: /* 10. Quest state updates, smarter dialogs and moving characters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.1. Create a new adventure type project, targeted at Story mode'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.2. Create a new basic level template, called 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''2.1. Create a new NPC character model and place it into the level'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.1. Create the start of a simple dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.2. Save the dialog as 'TV_Elena_Dialog' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.3. Create the rest of the dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.4. Setup and assign speakers for your dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.5. Assign the correct speaker to each node'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.1. Create our quest categories'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''Save and reload all'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.3. Add a new quest under our 'QCA_Chapter_01' category'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen -- and right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, searching for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like tents we'd find in a nomad community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.1. Add a shovel and three instances of a white sand pile'''&amp;lt;/span&amp;gt;&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.2.  Add some objects into the level to dig up out of our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.3. Add our objects to our sand-piles item property'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.4. Only show our sand piles if the user passes a perception test'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.1 Naming and referencing of local instances'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.2 Doing a better job hiding our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.3 Setting up box triggers to implement digging treasure rewards'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.1. There is only ever one story, with goals running in alphabetical order'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.2. Sub-goals will only run when their parent goal is 'complete' '''&amp;lt;span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.3. Create a parent goal for your level under the __Start goal'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.4. Add in the code that will complete our parent level goal&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.6. Generate definitions, build and reload'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. Quest state updates, smarter dialogs and moving characters ==&lt;br /&gt;
We're going to take a slight step backwards here and update our dialog with Elena.  The goal here is to activate the 'Started' quest state we created earlier for 'The Lost Medicine' quest, which will then display in the players quest journal.  We will also want to look at getting Elena to run back to her families tent and to say something different to us once we have accepted the quest – otherwise she will continue to ask us to find her medicine, even though we had already started doing just that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.1. How do we update quest states?'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main mechanism for doing this is the '''ObjectSetFlag()''' Osiris Call, which we can call from any of our scripts.  Another common way of updating our quest states is via Dialogs, and their 'Node Flags' property, which is what we will be using right now.&lt;br /&gt;
&lt;br /&gt;
A heads up on updating quest states is that Larian has a syntax we need to follow when updating or checking quest state flags.  The format to use is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;ObjectSetFlag(_Player, &amp;quot;QuestUpdate_&amp;lt;NameOfQuest&amp;gt;_&amp;lt;QuestState&amp;gt;, _&amp;quot;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus, to set our quest status to started, we just need to switch on its flag.  An example update format to use is shown below, with the &amp;quot;'''QuestUpdate_LostMedicine_Started'''&amp;quot; string.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.1_QuestCategories.png|none|left|Quest categories|264px]]&lt;br /&gt;
&lt;br /&gt;
Luckily we can also update quest states from within our dialogs.  For the next steps please open the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, open our '''TV_Elena_Dialog''' file &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2-4)&amp;lt;/span&amp;gt;, select the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and press the edit button for the 'Flags To Set' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt; property.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.2_DialogEditing.PNG|none|left|Dialog editing|615px]]&lt;br /&gt;
&lt;br /&gt;
Continuing on from above, we now need to create a custom flag which will be used to update our quest status.  To do so, click on the 'Character' flag category &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter '''QuestUpdate_LostMedicine_Started''' in the custom flag field &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  Press Add &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and then press Ok &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes.  Once saved, tick the 'QuestUpdate_LostMedicine_Started' flag to update our quest status when our players reach this particular node.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.3_UpdatingFlags.png|none|left|Updating quest flags|550px]]&lt;br /&gt;
&lt;br /&gt;
Press Ctrl + S to save your changes, and the close the Dialog Editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.2. Registering our Quest state flags'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Oops!  One step we forgot to do was registering the &amp;quot;Started&amp;quot; quest state in our Story Editor.  This is where this database fact is initialised at startup, ready for an update to occur.  To set this up, please create a new sub item goal called '''TV_JournalUpdate''' and enter in the following code.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.2_RegisterQuestStateFlags.PNG|none|left|Register quest state flags|896px]]&lt;br /&gt;
&lt;br /&gt;
I've also attached a version you can copy / paste below, however.  Please note that you will need to update the '''CharacterCreationDummy''' with your own character GUID.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Let the story know that our test dummy character is a player character&lt;br /&gt;
DB_IsPlayer(CHARACTERGUID_S_GLO_CharacterCreationDummy_001_da072fe7-fdd5-42ae-9139-8bd4b9fca406);&lt;br /&gt;
&lt;br /&gt;
// Define the Lost Medicine 'Started' flag for our quest, and so our dialog has a ready to go database fact to update&lt;br /&gt;
DB_QuestDef_State(&amp;quot;LostMedicine&amp;quot;,&amp;quot;Started&amp;quot;,1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.3. Switch to game mode to test the quest journal updates'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save everything and then switch to the game mode to test the quest journal updates in the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.1_SwitchToGameMode.png|none|left|Switch to game mode|377px]]&lt;br /&gt;
&lt;br /&gt;
Walk up to Elena and talk to her – after which you should see the following '''Quest Journal''' update ('''The Lost Medicine''') appear on your screen.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.2_JournalUpdated.png|none|left|Journal updated|299px]]&lt;br /&gt;
&lt;br /&gt;
Opening your journal while in game mode should also now display The Lost Medicine quest details.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.3_CheckQuestJournal.png|none|left|Open quest journal|724px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.4. Improving our dialog with Elena'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Elena''' dialog and add a new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and a new question that follows our new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  This greeting is going to be the new dialog chain that will occur when the player starts a dialog with '''Elena''', and has already started the lost medicine quest.&lt;br /&gt;
&lt;br /&gt;
Select our new greeting node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and click on 'Edit' in our 'Flags To Check' field, adding in the '''LostMedicine_Started''' flag.  Finally, tick this flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; so that this greeting dialog chain will only begin if we have already started the lost medicine quest.  To tidy up, also select our original greeting node and add a lost medicine flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, this time making sure not to tick it – so that this greeting chain only plays if the lost medicine quest has not started.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.4_ImprovingDialog.png|none|left|Improving dialog|765px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.4. Improving our dialog with Elena'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We're going to add in some small updates, creating a point trigger inside Elena's tent and getting her to run there after our quest started flag has been activated.  To get going, search for '''point trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the Root Templates panel, select a 'Point Trigger' style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; and drag it into our scene, inside the tent style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once happy with the positioning, go ahead and update the name of the trigger to '''TV_ElenaRunToTent_PointTrigger''' style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5.1_AddStoryScript.png|none|left|Add story script|825px]]&lt;br /&gt;
&lt;br /&gt;
{{warning|Elena will end up facing wherever she stops running, and is not affected by the facing of the Point Trigger.}}&lt;br /&gt;
&lt;br /&gt;
Ok, half way there – next step is to add a bit of code into our Story Editor.  Open up the StoryEditor, right click on 'TheVillage' goal and select 'Add New Sub Item...'.  Name your new sub-item goal '''TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; as this is where we will be writing code related to her actions.  Once done, open up the KB section and in the following code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5_SetupPointTrigger.png|none|left|Setup point trigger|750px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IF&lt;br /&gt;
ObjectFlagSet(&amp;quot;QuestUpdate_LostMedicine_Started&amp;quot;, _player, _)&lt;br /&gt;
THEN&lt;br /&gt;
ProcCharacterMoveTo(CHARACTERGUID_S_TV_Elena_56d1fd6c-d1ac-4d87-bba8-33a6297fa437, TRIGGERGUID_S_TV_ElenaRunToTent_PointTrigger_9a113b13-6078-44fb-a06f-917c354960ea, 1, &amp;quot;&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;br /&gt;
&lt;br /&gt;
== 12. Encounters ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4737</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4737"/>
		<updated>2017-12-09T16:21:39Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: /* 10. Quest state updates, smarter dialogs and moving characters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.1. Create a new adventure type project, targeted at Story mode'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.2. Create a new basic level template, called 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''2.1. Create a new NPC character model and place it into the level'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.1. Create the start of a simple dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.2. Save the dialog as 'TV_Elena_Dialog' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.3. Create the rest of the dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.4. Setup and assign speakers for your dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.5. Assign the correct speaker to each node'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.1. Create our quest categories'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''Save and reload all'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.3. Add a new quest under our 'QCA_Chapter_01' category'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen -- and right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, searching for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like tents we'd find in a nomad community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.1. Add a shovel and three instances of a white sand pile'''&amp;lt;/span&amp;gt;&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.2.  Add some objects into the level to dig up out of our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.3. Add our objects to our sand-piles item property'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.4. Only show our sand piles if the user passes a perception test'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.1 Naming and referencing of local instances'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.2 Doing a better job hiding our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.3 Setting up box triggers to implement digging treasure rewards'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.1. There is only ever one story, with goals running in alphabetical order'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.2. Sub-goals will only run when their parent goal is 'complete' '''&amp;lt;span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.3. Create a parent goal for your level under the __Start goal'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.4. Add in the code that will complete our parent level goal&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.6. Generate definitions, build and reload'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. Quest state updates, smarter dialogs and moving characters ==&lt;br /&gt;
We're going to take a slight step backwards here and update our dialog with Elena.  The goal here is to activate the 'Started' quest state we created earlier for 'The Lost Medicine' quest, which will then display in the players quest journal.  We will also want to look at getting Elena to run back to her families tent and to say something different to us once we have accepted the quest – otherwise she will continue to ask us to find her medicine, even though we had already started doing just that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.1. How do we update quest states?'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main mechanism for doing this is the '''ObjectSetFlag()''' Osiris Call, which we can call from any of our scripts.  Another common way of updating our quest states is via Dialogs, and their 'Node Flags' property, which is what we will be using right now.&lt;br /&gt;
&lt;br /&gt;
A heads up on updating quest states is that Larian has a syntax we need to follow when updating or checking quest state flags.  The format to use is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;ObjectSetFlag(_Player, &amp;quot;QuestUpdate_&amp;lt;NameOfQuest&amp;gt;_&amp;lt;QuestState&amp;gt;, _&amp;quot;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus, to set our quest status to started, we just need to switch on its flag.  An example update format to use is shown below, with the &amp;quot;'''QuestUpdate_LostMedicine_Started'''&amp;quot; string.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.1_QuestCategories.png|none|left|Quest categories|264px]]&lt;br /&gt;
&lt;br /&gt;
Luckily we can also update quest states from within our dialogs.  For the next steps please open the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, open our '''TV_Elena_Dialog''' file &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2-4)&amp;lt;/span&amp;gt;, select the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and press the edit button for the 'Flags To Set' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt; property.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.2_DialogEditing.PNG|none|left|Dialog editing|615px]]&lt;br /&gt;
&lt;br /&gt;
Continuing on from above, we now need to create a custom flag which will be used to update our quest status.  To do so, click on the 'Character' flag category &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter '''QuestUpdate_LostMedicine_Started''' in the custom flag field &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  Press Add &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and then press Ok &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes.  Once saved, tick the 'QuestUpdate_LostMedicine_Started' flag to update our quest status when our players reach this particular node.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.3_UpdatingFlags.png|none|left|Updating quest flags|550px]]&lt;br /&gt;
&lt;br /&gt;
Press Ctrl + S to save your changes, and the close the Dialog Editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.2. Registering our Quest state flags'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Oops!  One step we forgot to do was registering the &amp;quot;Started&amp;quot; quest state in our Story Editor.  This is where this database fact is initialised at startup, ready for an update to occur.  To set this up, please create a new sub item goal called '''TV_JournalUpdate''' and enter in the following code.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.2_RegisterQuestStateFlags.PNG|none|left|Register quest state flags|896px]]&lt;br /&gt;
&lt;br /&gt;
I've also attached a version you can copy / paste below, however.  Please note that you will need to update the '''CharacterCreationDummy''' with your own character GUID.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Let the story know that our test dummy character is a player character&lt;br /&gt;
DB_IsPlayer(CHARACTERGUID_S_GLO_CharacterCreationDummy_001_da072fe7-fdd5-42ae-9139-8bd4b9fca406);&lt;br /&gt;
&lt;br /&gt;
// Define the Lost Medicine 'Started' flag for our quest, and so our dialog has a ready to go database fact to update&lt;br /&gt;
DB_QuestDef_State(&amp;quot;LostMedicine&amp;quot;,&amp;quot;Started&amp;quot;,1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.3. Switch to game mode to test the quest journal updates'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save everything and then switch to the game mode to test the quest journal updates in the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.1_SwitchToGameMode.png|none|left|Switch to game mode|377px]]&lt;br /&gt;
&lt;br /&gt;
Walk up to Elena and talk to her – after which you should see the following '''Quest Journal''' update ('''The Lost Medicine''') appear on your screen.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.2_JournalUpdated.png|none|left|Journal updated|299px]]&lt;br /&gt;
&lt;br /&gt;
Opening your journal while in game mode should also now display The Lost Medicine quest details.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.3_CheckQuestJournal.png|none|left|Open quest journal|724px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.4. Improving our dialog with Elena'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Elena''' dialog and add a new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and a new question that follows our new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  This greeting is going to be the new dialog chain that will occur when the player starts a dialog with '''Elena''', and has already started the lost medicine quest.&lt;br /&gt;
&lt;br /&gt;
Select our new greeting node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and click on 'Edit' in our 'Flags To Check' field, adding in the '''LostMedicine_Started''' flag.  Finally, tick this flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; so that this greeting dialog chain will only begin if we have already started the lost medicine quest.  To tidy up, also select our original greeting node and add a lost medicine flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, this time making sure not to tick it – so that this greeting chain only plays if the lost medicine quest has not started.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.4_ImprovingDialog.png|none|left|Improving dialog|765px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.4. Improving our dialog with Elena'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We're going to add in some small updates, creating a point trigger inside Elena's tent and getting her to run there after our quest started flag has been activated.  To get going, search for '''point trigger''' style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the Root Templates panel, select a 'Point Trigger' style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; and drag it into our scene, inside the tent style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once happy with the positioning, go ahead and update the name of the trigger to '''TV_ElenaRunToTent_PointTrigger''' style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5.1_AddStoryScript.png|none|left|Add story script|825px]]&lt;br /&gt;
&lt;br /&gt;
{{warning|Elena will end up facing wherever she stops running, and is not affected by the facing of the Point Trigger.}}&lt;br /&gt;
&lt;br /&gt;
Ok, half way there – next step is to add a bit of code into our Story Editor.  Open up the StoryEditor, right click on 'TheVillage' goal and select 'Add New Sub Item...'.  Name your new sub-item goal '''TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; as this is where we will be writing code related to her actions.  Once done, open up the KB section and in the following code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5_SetupPointTrigger.png|none|left|Setup point trigger|750px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IF&lt;br /&gt;
ObjectFlagSet(&amp;quot;QuestUpdate_LostMedicine_Started&amp;quot;, _player, _)&lt;br /&gt;
THEN&lt;br /&gt;
ProcCharacterMoveTo(CHARACTERGUID_S_TV_Elena_56d1fd6c-d1ac-4d87-bba8-33a6297fa437, TRIGGERGUID_S_TV_ElenaRunToTent_PointTrigger_9a113b13-6078-44fb-a06f-917c354960ea, 1, &amp;quot;&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;br /&gt;
&lt;br /&gt;
== 12. Encounters ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4736</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4736"/>
		<updated>2017-12-09T16:21:10Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: Added queset state updates, smarter dialogs and moving characters guides&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.1. Create a new adventure type project, targeted at Story mode'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.2. Create a new basic level template, called 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''2.1. Create a new NPC character model and place it into the level'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.1. Create the start of a simple dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.2. Save the dialog as 'TV_Elena_Dialog' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.3. Create the rest of the dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.4. Setup and assign speakers for your dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.5. Assign the correct speaker to each node'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.1. Create our quest categories'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''Save and reload all'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.3. Add a new quest under our 'QCA_Chapter_01' category'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen -- and right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, searching for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like tents we'd find in a nomad community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.1. Add a shovel and three instances of a white sand pile'''&amp;lt;/span&amp;gt;&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.2.  Add some objects into the level to dig up out of our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.3. Add our objects to our sand-piles item property'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.4. Only show our sand piles if the user passes a perception test'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.1 Naming and referencing of local instances'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.2 Doing a better job hiding our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.3 Setting up box triggers to implement digging treasure rewards'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.1. There is only ever one story, with goals running in alphabetical order'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.2. Sub-goals will only run when their parent goal is 'complete' '''&amp;lt;span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.3. Create a parent goal for your level under the __Start goal'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.4. Add in the code that will complete our parent level goal&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.6. Generate definitions, build and reload'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. Quest state updates, smarter dialogs and moving characters ==&lt;br /&gt;
We're going to take a slight step backwards here and update our dialog with Elena.  The goal here is to activate the '''Started''' quest state we created earlier for '''The Lost Medicine''' quest, which will then display in the players quest journal.  We will also want to look at getting Elena to run back to her families tent and to say something different to us once we have accepted the quest – otherwise she will continue to ask us to find her medicine, even though we had already started doing just that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.1. How do we update quest states?'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main mechanism for doing this is the '''ObjectSetFlag()''' Osiris Call, which we can call from any of our scripts.  Another common way of updating our quest states is via Dialogs, and their 'Node Flags' property, which is what we will be using right now.&lt;br /&gt;
&lt;br /&gt;
A heads up on updating quest states is that Larian has a syntax we need to follow when updating or checking quest state flags.  The format to use is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;ObjectSetFlag(_Player, &amp;quot;QuestUpdate_&amp;lt;NameOfQuest&amp;gt;_&amp;lt;QuestState&amp;gt;, _&amp;quot;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus, to set our quest status to started, we just need to switch on its flag.  An example update format to use is shown below, with the &amp;quot;'''QuestUpdate_LostMedicine_Started'''&amp;quot; string.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.1_QuestCategories.png|none|left|Quest categories|264px]]&lt;br /&gt;
&lt;br /&gt;
Luckily we can also update quest states from within our dialogs.  For the next steps please open the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, open our '''TV_Elena_Dialog''' file &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2-4)&amp;lt;/span&amp;gt;, select the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and press the edit button for the 'Flags To Set' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt; property.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.2_DialogEditing.PNG|none|left|Dialog editing|615px]]&lt;br /&gt;
&lt;br /&gt;
Continuing on from above, we now need to create a custom flag which will be used to update our quest status.  To do so, click on the 'Character' flag category &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter '''QuestUpdate_LostMedicine_Started''' in the custom flag field &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  Press Add &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and then press Ok &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes.  Once saved, tick the 'QuestUpdate_LostMedicine_Started' flag to update our quest status when our players reach this particular node.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.1.3_UpdatingFlags.png|none|left|Updating quest flags|550px]]&lt;br /&gt;
&lt;br /&gt;
Press Ctrl + S to save your changes, and the close the Dialog Editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.2. Registering our Quest state flags'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Oops!  One step we forgot to do was registering the &amp;quot;Started&amp;quot; quest state in our Story Editor.  This is where this database fact is initialised at startup, ready for an update to occur.  To set this up, please create a new sub item goal called '''TV_JournalUpdate''' and enter in the following code.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.2_RegisterQuestStateFlags.PNG|none|left|Register quest state flags|896px]]&lt;br /&gt;
&lt;br /&gt;
I've also attached a version you can copy / paste below, however.  Please note that you will need to update the '''CharacterCreationDummy''' with your own character GUID.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Let the story know that our test dummy character is a player character&lt;br /&gt;
DB_IsPlayer(CHARACTERGUID_S_GLO_CharacterCreationDummy_001_da072fe7-fdd5-42ae-9139-8bd4b9fca406);&lt;br /&gt;
&lt;br /&gt;
// Define the Lost Medicine 'Started' flag for our quest, and so our dialog has a ready to go database fact to update&lt;br /&gt;
DB_QuestDef_State(&amp;quot;LostMedicine&amp;quot;,&amp;quot;Started&amp;quot;,1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.3. Switch to game mode to test the quest journal updates'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save everything and then switch to the game mode to test the quest journal updates in the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.1_SwitchToGameMode.png|none|left|Switch to game mode|377px]]&lt;br /&gt;
&lt;br /&gt;
Walk up to Elena and talk to her – after which you should see the following '''Quest Journal''' update ('''The Lost Medicine''') appear on your screen.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.2_JournalUpdated.png|none|left|Journal updated|299px]]&lt;br /&gt;
&lt;br /&gt;
Opening your journal while in game mode should also now display The Lost Medicine quest details.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.3.3_CheckQuestJournal.png|none|left|Open quest journal|724px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.4. Improving our dialog with Elena'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Elena''' dialog and add a new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and a new question that follows our new greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.  This greeting is going to be the new dialog chain that will occur when the player starts a dialog with '''Elena''', and has already started the lost medicine quest.&lt;br /&gt;
&lt;br /&gt;
Select our new greeting node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, and click on 'Edit' in our 'Flags To Check' field, adding in the '''LostMedicine_Started''' flag.  Finally, tick this flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; so that this greeting dialog chain will only begin if we have already started the lost medicine quest.  To tidy up, also select our original greeting node and add a lost medicine flag &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, this time making sure not to tick it – so that this greeting chain only plays if the lost medicine quest has not started.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.4_ImprovingDialog.png|none|left|Improving dialog|765px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''10.4. Improving our dialog with Elena'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We're going to add in some small updates, creating a point trigger inside Elena's tent and getting her to run there after our quest started flag has been activated.  To get going, search for '''point trigger''' style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the Root Templates panel, select a 'Point Trigger' style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; and drag it into our scene, inside the tent style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once happy with the positioning, go ahead and update the name of the trigger to '''TV_ElenaRunToTent_PointTrigger''' style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5.1_AddStoryScript.png|none|left|Add story script|825px]]&lt;br /&gt;
&lt;br /&gt;
{{warning|Elena will end up facing wherever she stops running, and is not affected by the facing of the Point Trigger.}}&lt;br /&gt;
&lt;br /&gt;
Ok, half way there – next step is to add a bit of code into our Story Editor.  Open up the StoryEditor, right click on 'TheVillage' goal and select 'Add New Sub Item...'.  Name your new sub-item goal '''TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; as this is where we will be writing code related to her actions.  Once done, open up the KB section and in the following code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_10.5_SetupPointTrigger.png|none|left|Setup point trigger|750px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IF&lt;br /&gt;
ObjectFlagSet(&amp;quot;QuestUpdate_LostMedicine_Started&amp;quot;, _player, _)&lt;br /&gt;
THEN&lt;br /&gt;
ProcCharacterMoveTo(CHARACTERGUID_S_TV_Elena_56d1fd6c-d1ac-4d87-bba8-33a6297fa437, TRIGGERGUID_S_TV_ElenaRunToTent_PointTrigger_9a113b13-6078-44fb-a06f-917c354960ea, 1, &amp;quot;&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;br /&gt;
&lt;br /&gt;
== 12. Encounters ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=File:BasicAdventure_10.5_SetupPointTrigger.png&amp;diff=4735</id>
		<title>File:BasicAdventure 10.5 SetupPointTrigger.png</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=File:BasicAdventure_10.5_SetupPointTrigger.png&amp;diff=4735"/>
		<updated>2017-12-09T16:01:46Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=File:BasicAdventure_10.5.1_AddStoryScript.png&amp;diff=4734</id>
		<title>File:BasicAdventure 10.5.1 AddStoryScript.png</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=File:BasicAdventure_10.5.1_AddStoryScript.png&amp;diff=4734"/>
		<updated>2017-12-09T16:01:34Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=File:BasicAdventure_10.4_ImprovingDialog.png&amp;diff=4733</id>
		<title>File:BasicAdventure 10.4 ImprovingDialog.png</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=File:BasicAdventure_10.4_ImprovingDialog.png&amp;diff=4733"/>
		<updated>2017-12-09T16:01:20Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=File:BasicAdventure_10.3.3_CheckQuestJournal.png&amp;diff=4732</id>
		<title>File:BasicAdventure 10.3.3 CheckQuestJournal.png</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=File:BasicAdventure_10.3.3_CheckQuestJournal.png&amp;diff=4732"/>
		<updated>2017-12-09T16:01:04Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=File:BasicAdventure_10.3.2_JournalUpdated.png&amp;diff=4731</id>
		<title>File:BasicAdventure 10.3.2 JournalUpdated.png</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=File:BasicAdventure_10.3.2_JournalUpdated.png&amp;diff=4731"/>
		<updated>2017-12-09T16:00:42Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=File:BasicAdventure_10.3.1_SwitchToGameMode.png&amp;diff=4730</id>
		<title>File:BasicAdventure 10.3.1 SwitchToGameMode.png</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=File:BasicAdventure_10.3.1_SwitchToGameMode.png&amp;diff=4730"/>
		<updated>2017-12-09T16:00:32Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=File:BasicAdventure_10.2_RegisterQuestStateFlags.PNG&amp;diff=4729</id>
		<title>File:BasicAdventure 10.2 RegisterQuestStateFlags.PNG</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=File:BasicAdventure_10.2_RegisterQuestStateFlags.PNG&amp;diff=4729"/>
		<updated>2017-12-09T16:00:17Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=File:BasicAdventure_10.1.3_UpdatingFlags.png&amp;diff=4728</id>
		<title>File:BasicAdventure 10.1.3 UpdatingFlags.png</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=File:BasicAdventure_10.1.3_UpdatingFlags.png&amp;diff=4728"/>
		<updated>2017-12-09T15:59:59Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=File:BasicAdventure_10.1.2_DialogEditing.PNG&amp;diff=4727</id>
		<title>File:BasicAdventure 10.1.2 DialogEditing.PNG</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=File:BasicAdventure_10.1.2_DialogEditing.PNG&amp;diff=4727"/>
		<updated>2017-12-09T15:59:41Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=File:BasicAdventure_10.1.1_QuestCategories.png&amp;diff=4726</id>
		<title>File:BasicAdventure 10.1.1 QuestCategories.png</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=File:BasicAdventure_10.1.1_QuestCategories.png&amp;diff=4726"/>
		<updated>2017-12-09T15:59:24Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4725</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4725"/>
		<updated>2017-12-09T15:53:12Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: /* 10. NPC Patrols and moving NPC characters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.1. Create a new adventure type project, targeted at Story mode'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.2. Create a new basic level template, called 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''2.1. Create a new NPC character model and place it into the level'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.1. Create the start of a simple dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.2. Save the dialog as 'TV_Elena_Dialog' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.3. Create the rest of the dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.4. Setup and assign speakers for your dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.5. Assign the correct speaker to each node'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.1. Create our quest categories'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''Save and reload all'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.3. Add a new quest under our 'QCA_Chapter_01' category'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen -- and right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, searching for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like tents we'd find in a nomad community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.1. Add a shovel and three instances of a white sand pile'''&amp;lt;/span&amp;gt;&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.2.  Add some objects into the level to dig up out of our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.3. Add our objects to our sand-piles item property'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.4. Only show our sand piles if the user passes a perception test'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.1 Naming and referencing of local instances'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.2 Doing a better job hiding our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.3 Setting up box triggers to implement digging treasure rewards'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.1. There is only ever one story, with goals running in alphabetical order'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.2. Sub-goals will only run when their parent goal is 'complete' '''&amp;lt;span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.3. Create a parent goal for your level under the __Start goal'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.4. Add in the code that will complete our parent level goal&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.6. Generate definitions, build and reload'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10. Quest state updates, smarter dialogs and moving characters&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;br /&gt;
&lt;br /&gt;
== 12. Encounters ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4724</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4724"/>
		<updated>2017-12-09T15:52:57Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: /* 12. Quest states and rewards */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.1. Create a new adventure type project, targeted at Story mode'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.2. Create a new basic level template, called 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''2.1. Create a new NPC character model and place it into the level'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.1. Create the start of a simple dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.2. Save the dialog as 'TV_Elena_Dialog' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.3. Create the rest of the dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.4. Setup and assign speakers for your dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.5. Assign the correct speaker to each node'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.1. Create our quest categories'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''Save and reload all'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.3. Add a new quest under our 'QCA_Chapter_01' category'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen -- and right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, searching for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like tents we'd find in a nomad community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.1. Add a shovel and three instances of a white sand pile'''&amp;lt;/span&amp;gt;&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.2.  Add some objects into the level to dig up out of our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.3. Add our objects to our sand-piles item property'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.4. Only show our sand piles if the user passes a perception test'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.1 Naming and referencing of local instances'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.2 Doing a better job hiding our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.3 Setting up box triggers to implement digging treasure rewards'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.1. There is only ever one story, with goals running in alphabetical order'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.2. Sub-goals will only run when their parent goal is 'complete' '''&amp;lt;span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.3. Create a parent goal for your level under the __Start goal'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.4. Add in the code that will complete our parent level goal&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.6. Generate definitions, build and reload'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;br /&gt;
&lt;br /&gt;
== 12. Encounters ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4723</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4723"/>
		<updated>2017-12-09T01:44:54Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.1. Create a new adventure type project, targeted at Story mode'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.2. Create a new basic level template, called 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''2.1. Create a new NPC character model and place it into the level'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.1. Create the start of a simple dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.2. Save the dialog as 'TV_Elena_Dialog' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.3. Create the rest of the dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.4. Setup and assign speakers for your dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.5. Assign the correct speaker to each node'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.1. Create our quest categories'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''Save and reload all'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.3. Add a new quest under our 'QCA_Chapter_01' category'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen -- and right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, searching for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like tents we'd find in a nomad community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.1. Add a shovel and three instances of a white sand pile'''&amp;lt;/span&amp;gt;&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.2.  Add some objects into the level to dig up out of our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.3. Add our objects to our sand-piles item property'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.4. Only show our sand piles if the user passes a perception test'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.1 Naming and referencing of local instances'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.2 Doing a better job hiding our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.3 Setting up box triggers to implement digging treasure rewards'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.1. There is only ever one story, with goals running in alphabetical order'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.2. Sub-goals will only run when their parent goal is 'complete' '''&amp;lt;span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.3. Create a parent goal for your level under the __Start goal'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.4. Add in the code that will complete our parent level goal&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.6. Generate definitions, build and reload'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;br /&gt;
&lt;br /&gt;
[To be continued...]&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4722</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4722"/>
		<updated>2017-12-09T01:41:26Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: /* 5. Working with Prefabs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.1. Create a new adventure type project, targeted at Story mode'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.2. Create a new basic level template, called 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''2.1. Create a new NPC character model and place it into the level'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.1. Create the start of a simple dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.2. Save the dialog as 'TV_Elena_Dialog' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.3. Create the rest of the dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.4. Setup and assign speakers for your dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.5. Assign the correct speaker to each node'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.1. Create our quest categories'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''Save and reload all'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.3. Add a new quest under our 'QCA_Chapter_01' category'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen -- and right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, searching for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like tents we'd find in a nomad community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.1. Add a shovel and three instances of a white sand pile'''&amp;lt;/span&amp;gt;&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.2.  Add some objects into the level to dig up out of our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.3. Add our objects to our sand-piles item property'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.4. Only show our sand piles if the user passes a perception test'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.1 Naming and referencing of local instances'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.2 Doing a better job hiding our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.3 Setting up box triggers to implement digging treasure rewards'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.1. There is only ever one story, with goals running in alphabetical order'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.2. Sub-goals will only run when their parent goal is 'complete' '''&amp;lt;span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.3. Create a parent goal for your level under the __Start goal'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.4. Add in the code that will complete our parent level goal&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.6. Generate definitions, build and reload'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4721</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4721"/>
		<updated>2017-12-09T01:40:49Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: /* 5. Working with Prefabs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.1. Create a new adventure type project, targeted at Story mode'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.2. Create a new basic level template, called 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''2.1. Create a new NPC character model and place it into the level'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.1. Create the start of a simple dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.2. Save the dialog as 'TV_Elena_Dialog' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.3. Create the rest of the dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.4. Setup and assign speakers for your dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.5. Assign the correct speaker to each node'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.1. Create our quest categories'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''Save and reload all'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.3. Add a new quest under our 'QCA_Chapter_01' category'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen -- and right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, searching for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like a tent we'd find in a desert community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.1. Add a shovel and three instances of a white sand pile'''&amp;lt;/span&amp;gt;&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.2.  Add some objects into the level to dig up out of our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.3. Add our objects to our sand-piles item property'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.4. Only show our sand piles if the user passes a perception test'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.1 Naming and referencing of local instances'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.2 Doing a better job hiding our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.3 Setting up box triggers to implement digging treasure rewards'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.1. There is only ever one story, with goals running in alphabetical order'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.2. Sub-goals will only run when their parent goal is 'complete' '''&amp;lt;span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.3. Create a parent goal for your level under the __Start goal'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.4. Add in the code that will complete our parent level goal&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.6. Generate definitions, build and reload'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4720</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4720"/>
		<updated>2017-12-09T01:39:31Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: /* 3. Create a simple dialog and save it */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.1. Create a new adventure type project, targeted at Story mode'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.2. Create a new basic level template, called 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''2.1. Create a new NPC character model and place it into the level'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.1. Create the start of a simple dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.2. Save the dialog as 'TV_Elena_Dialog' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.3. Create the rest of the dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.4. Setup and assign speakers for your dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.5. Assign the correct speaker to each node'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.1. Create our quest categories'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''Save and reload all'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.3. Add a new quest under our 'QCA_Chapter_01' category'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen --, right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and search for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like a tent we'd find in a desert community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.1. Add a shovel and three instances of a white sand pile'''&amp;lt;/span&amp;gt;&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.2.  Add some objects into the level to dig up out of our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.3. Add our objects to our sand-piles item property'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.4. Only show our sand piles if the user passes a perception test'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.1 Naming and referencing of local instances'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.2 Doing a better job hiding our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.3 Setting up box triggers to implement digging treasure rewards'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.1. There is only ever one story, with goals running in alphabetical order'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.2. Sub-goals will only run when their parent goal is 'complete' '''&amp;lt;span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.3. Create a parent goal for your level under the __Start goal'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.4. Add in the code that will complete our parent level goal&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.6. Generate definitions, build and reload'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4719</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4719"/>
		<updated>2017-12-09T01:37:37Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.1. Create a new adventure type project, targeted at Story mode'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.2. Create a new basic level template, called 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''2.1. Create a new NPC character model and place it into the level'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.1. Create the start of a simple dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.2.Save the dialog as 'TV_Elena_Dialog' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.3. Create the rest of the dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.4. Setup and assign speakers for your dialog'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''3.5. Assign the correct speaker to each node'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.1. Create our quest categories'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''Save and reload all'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''4.3. Add a new quest under our 'QCA_Chapter_01' category'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen --, right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and search for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like a tent we'd find in a desert community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.1. Add a shovel and three instances of a white sand pile'''&amp;lt;/span&amp;gt;&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.2.  Add some objects into the level to dig up out of our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.3. Add our objects to our sand-piles item property'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''7.4. Only show our sand piles if the user passes a perception test'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.1 Naming and referencing of local instances'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.2 Doing a better job hiding our sand piles'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''8.3 Setting up box triggers to implement digging treasure rewards'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.1. There is only ever one story, with goals running in alphabetical order'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.2. Sub-goals will only run when their parent goal is 'complete' '''&amp;lt;span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.3. Create a parent goal for your level under the __Start goal'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.4. Add in the code that will complete our parent level goal&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.6. Generate definitions, build and reload'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' '''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4718</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4718"/>
		<updated>2017-12-09T01:32:48Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
=== 1.1. Create a new adventure type project, targeted at Story mode ===&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
=== 1.2. Create a new basic level template, called 'TheVillage' ===&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''2.1. Create a new NPC character model and place it into the level'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
=== 3.1. Create the start of a simple dialog ===&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.2.Save the dialog as 'TV_Elena_Dialog' ===&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.3. Create the rest of the dialog ===&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.4. Setup and assign speakers for your dialog ===&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.5. Assign the correct speaker to each node ===&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
=== 4.1. Create our quest categories ===&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
=== 4.2. Save and reload all ===&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
=== 4.3. Add a new quest under our 'QCA_Chapter_01' category ===&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen --, right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and search for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like a tent we'd find in a desert community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
=== 7.1. Add a shovel and three instances of a white sand pile ===&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.2.  Add some objects into the level to dig up out of our sand piles ===&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.3. Add our objects to our sand-piles item property ===&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
=== 7.4. Only show our sand piles if the user passes a perception test ===&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
=== 8.1 Naming and referencing of local instances ===&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
=== 8.2 Doing a better job hiding our sand piles ===&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 8.3 Setting up box triggers to implement digging treasure rewards ===&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
=== 9.1. There is only ever one story, with goals running in alphabetical order ===&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
=== 9.2. Sub-goals will only run when their parent goal is 'complete' ===&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
=== 9.3. Create a parent goal for your level under the __Start goal ===&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.4. Add in the code that will complete our parent level goal ===&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' ===&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.6. Generate definitions, build and reload ===&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' ===&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4717</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4717"/>
		<updated>2017-12-09T01:31:16Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
=== 1.1. Create a new adventure type project, targeted at Story mode ===&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
=== 1.2. Create a new basic level template, called 'TheVillage' ===&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;=== 2.1. Create a new NPC character model and place it into the level ===&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
=== 3.1. Create the start of a simple dialog ===&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.2.Save the dialog as 'TV_Elena_Dialog' ===&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.3. Create the rest of the dialog ===&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.4. Setup and assign speakers for your dialog ===&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.5. Assign the correct speaker to each node ===&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
=== 4.1. Create our quest categories ===&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
=== 4.2. Save and reload all ===&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
=== 4.3. Add a new quest under our 'QCA_Chapter_01' category ===&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen --, right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and search for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like a tent we'd find in a desert community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
=== 7.1. Add a shovel and three instances of a white sand pile ===&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.2.  Add some objects into the level to dig up out of our sand piles ===&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.3. Add our objects to our sand-piles item property ===&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
=== 7.4. Only show our sand piles if the user passes a perception test ===&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
=== 8.1 Naming and referencing of local instances ===&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
=== 8.2 Doing a better job hiding our sand piles ===&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 8.3 Setting up box triggers to implement digging treasure rewards ===&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
=== 9.1. There is only ever one story, with goals running in alphabetical order ===&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
=== 9.2. Sub-goals will only run when their parent goal is 'complete' ===&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
=== 9.3. Create a parent goal for your level under the __Start goal ===&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.4. Add in the code that will complete our parent level goal ===&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' ===&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.6. Generate definitions, build and reload ===&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' ===&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4716</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4716"/>
		<updated>2017-12-09T01:30:01Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
=== 1.1. Create a new adventure type project, targeted at Story mode ===&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
=== 1.2. Create a new basic level template, called 'TheVillage' ===&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ecf0f1&amp;quot;&amp;gt;=== 2.1. Create a new NPC character model and place it into the level ===&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
=== 3.1. Create the start of a simple dialog ===&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.2.Save the dialog as 'TV_Elena_Dialog' ===&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.3. Create the rest of the dialog ===&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.4. Setup and assign speakers for your dialog ===&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.5. Assign the correct speaker to each node ===&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
=== 4.1. Create our quest categories ===&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
=== 4.2. Save and reload all ===&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
=== 4.3. Add a new quest under our 'QCA_Chapter_01' category ===&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen --, right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and search for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like a tent we'd find in a desert community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
=== 7.1. Add a shovel and three instances of a white sand pile ===&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.2.  Add some objects into the level to dig up out of our sand piles ===&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.3. Add our objects to our sand-piles item property ===&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
=== 7.4. Only show our sand piles if the user passes a perception test ===&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
=== 8.1 Naming and referencing of local instances ===&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
=== 8.2 Doing a better job hiding our sand piles ===&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 8.3 Setting up box triggers to implement digging treasure rewards ===&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
=== 9.1. There is only ever one story, with goals running in alphabetical order ===&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
=== 9.2. Sub-goals will only run when their parent goal is 'complete' ===&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
=== 9.3. Create a parent goal for your level under the __Start goal ===&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.4. Add in the code that will complete our parent level goal ===&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' ===&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.6. Generate definitions, build and reload ===&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' ===&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4715</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4715"/>
		<updated>2017-12-09T01:21:30Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ffffff&amp;quot;&amp;gt;'''1.1. Create a new adventure type project, targeted at Story mode'''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
=== 1.2. Create a new basic level template, called 'TheVillage' ===&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
=== 2.1. Create a new NPC character model and place it into the level ===&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
=== 3.1. Create the start of a simple dialog ===&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.2.Save the dialog as 'TV_Elena_Dialog' ===&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.3. Create the rest of the dialog ===&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.4. Setup and assign speakers for your dialog ===&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.5. Assign the correct speaker to each node ===&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
=== 4.1. Create our quest categories ===&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
=== 4.2. Save and reload all ===&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
=== 4.3. Add a new quest under our 'QCA_Chapter_01' category ===&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen --, right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and search for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like a tent we'd find in a desert community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
=== 7.1. Add a shovel and three instances of a white sand pile ===&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.2.  Add some objects into the level to dig up out of our sand piles ===&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.3. Add our objects to our sand-piles item property ===&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
=== 7.4. Only show our sand piles if the user passes a perception test ===&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
=== 8.1 Naming and referencing of local instances ===&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
=== 8.2 Doing a better job hiding our sand piles ===&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 8.3 Setting up box triggers to implement digging treasure rewards ===&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
=== 9.1. There is only ever one story, with goals running in alphabetical order ===&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
=== 9.2. Sub-goals will only run when their parent goal is 'complete' ===&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
=== 9.3. Create a parent goal for your level under the __Start goal ===&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.4. Add in the code that will complete our parent level goal ===&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' ===&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.6. Generate definitions, build and reload ===&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' ===&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4706</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4706"/>
		<updated>2017-12-08T15:28:34Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures faster :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
=== 1.1. Create a new adventure type project, targeted at Story mode ===&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
=== 1.2. Create a new basic level template, called 'TheVillage' ===&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
=== 2.1. Create a new NPC character model and place it into the level ===&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
=== 3.1. Create the start of a simple dialog ===&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.2.Save the dialog as 'TV_Elena_Dialog' ===&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.3. Create the rest of the dialog ===&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.4. Setup and assign speakers for your dialog ===&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.5. Assign the correct speaker to each node ===&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
=== 4.1. Create our quest categories ===&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
=== 4.2. Save and reload all ===&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
=== 4.3. Add a new quest under our 'QCA_Chapter_01' category ===&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen --, right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and search for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like a tent we'd find in a desert community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
=== 7.1. Add a shovel and three instances of a white sand pile ===&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.2.  Add some objects into the level to dig up out of our sand piles ===&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.3. Add our objects to our sand-piles item property ===&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
=== 7.4. Only show our sand piles if the user passes a perception test ===&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
=== 8.1 Naming and referencing of local instances ===&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
=== 8.2 Doing a better job hiding our sand piles ===&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 8.3 Setting up box triggers to implement digging treasure rewards ===&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
=== 9.1. There is only ever one story, with goals running in alphabetical order ===&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
=== 9.2. Sub-goals will only run when their parent goal is 'complete' ===&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
=== 9.3. Create a parent goal for your level under the __Start goal ===&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.4. Add in the code that will complete our parent level goal ===&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' ===&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.6. Generate definitions, build and reload ===&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' ===&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4705</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4705"/>
		<updated>2017-12-08T15:28:01Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
=== 1.1. Create a new adventure type project, targeted at Story mode ===&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
=== 1.2. Create a new basic level template, called 'TheVillage' ===&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
=== 2.1. Create a new NPC character model and place it into the level ===&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
=== 3.1. Create the start of a simple dialog ===&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.2.Save the dialog as 'TV_Elena_Dialog' ===&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.3. Create the rest of the dialog ===&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.4. Setup and assign speakers for your dialog ===&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.5. Assign the correct speaker to each node ===&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
=== 4.1. Create our quest categories ===&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
=== 4.2. Save and reload all ===&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
=== 4.3. Add a new quest under our 'QCA_Chapter_01' category ===&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen --, right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and search for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like a tent we'd find in a desert community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
=== 7.1. Add a shovel and three instances of a white sand pile ===&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.2.  Add some objects into the level to dig up out of our sand piles ===&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.3. Add our objects to our sand-piles item property ===&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
=== 7.4. Only show our sand piles if the user passes a perception test ===&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
=== 8.1 Naming and referencing of local instances ===&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
=== 8.2 Doing a better job hiding our sand piles ===&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 8.3 Setting up box triggers to implement digging treasure rewards ===&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
=== 9.1. There is only ever one story, with goals running in alphabetical order ===&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
=== 9.2. Sub-goals will only run when their parent goal is 'complete' ===&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
=== 9.3. Create a parent goal for your level under the __Start goal ===&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.4. Add in the code that will complete our parent level goal ===&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' ===&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.6. Generate definitions, build and reload ===&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' ===&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4704</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4704"/>
		<updated>2017-12-08T15:27:21Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
=== 1.1. Create a new adventure type project, targeted at Story mode ===&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
=== 1.2. Create a new basic level template, called 'TheVillage' ===&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
=== 2.1. Create a new NPC character model and place it into the level ===&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
=== 3.1. Create the start of a simple dialog ===&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.2.Save the dialog as 'TV_Elena_Dialog' ===&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.3. Create the rest of the dialog ===&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.4. Setup and assign speakers for your dialog ===&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.5. Assign the correct speaker to each node ===&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
=== 4.1. Create our quest categories ===&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
=== 4.2. Save and reload all ===&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
=== 4.3. Add a new quest under our 'QCA_Chapter_01' category ===&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen --, right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and search for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like a tent we'd find in a desert community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
=== 7.1. Add a shovel and three instances of a white sand pile ===&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.2.  Add some objects into the level to dig up out of our sand piles ===&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.3. Add our objects to our sand-piles item property ===&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
=== 7.4. Only show our sand piles if the user passes a perception test ===&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
=== 8.1 Naming and referencing of local instances ===&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
=== 8.2 Doing a better job hiding our sand piles ===&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 8.3 Setting up box triggers to implement digging treasure rewards ===&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
=== 9.1. There is only ever one story, with goals running in alphabetical order ===&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
=== 9.2. Sub-goals will only run when their parent goal is 'complete' ===&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
=== 9.3. Create a parent goal for your level under the __Start goal ===&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.4. Add in the code that will complete our parent level goal ===&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' ===&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.6. Generate definitions, build and reload ===&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' ===&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4703</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4703"/>
		<updated>2017-12-08T15:25:55Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''INTRODUCTION'''&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
=== 1.1. Create a new adventure type project, targeted at Story mode ===&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
=== 1.2. Create a new basic level template, called 'TheVillage' ===&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
=== 2.1. Create a new NPC character model and place it into the level ===&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
=== 3.1. Create the start of a simple dialog ===&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.2.Save the dialog as 'TV_Elena_Dialog' ===&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.3. Create the rest of the dialog ===&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.4. Setup and assign speakers for your dialog ===&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.5. Assign the correct speaker to each node ===&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
=== 4.1. Create our quest categories ===&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
=== 4.2. Save and reload all ===&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
=== 4.3. Add a new quest under our 'QCA_Chapter_01' category ===&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen --, right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and search for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like a tent we'd find in a desert community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
=== 7.1. Add a shovel and three instances of a white sand pile ===&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.2.  Add some objects into the level to dig up out of our sand piles ===&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.3. Add our objects to our sand-piles item property ===&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
=== 7.4. Only show our sand piles if the user passes a perception test ===&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
=== 8.1 Naming and referencing of local instances ===&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
=== 8.2 Doing a better job hiding our sand piles ===&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 8.3 Setting up box triggers to implement digging treasure rewards ===&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
=== 9.1. There is only ever one story, with goals running in alphabetical order ===&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
=== 9.2. Sub-goals will only run when their parent goal is 'complete' ===&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
=== 9.3. Create a parent goal for your level under the __Start goal ===&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.4. Add in the code that will complete our parent level goal ===&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' ===&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.6. Generate definitions, build and reload ===&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' ===&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4702</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4702"/>
		<updated>2017-12-08T15:25:21Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: /* 2. Add a character */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Introduction'''&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
=== 1.1. Create a new adventure type project, targeted at Story mode ===&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
=== 1.2. Create a new basic level template, called 'TheVillage' ===&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larians coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
=== 2.1. Create a new NPC character model and place it into the level ===&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
=== 3.1. Create the start of a simple dialog ===&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.2.Save the dialog as 'TV_Elena_Dialog' ===&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.3. Create the rest of the dialog ===&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.4. Setup and assign speakers for your dialog ===&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.5. Assign the correct speaker to each node ===&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
=== 4.1. Create our quest categories ===&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
=== 4.2. Save and reload all ===&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
=== 4.3. Add a new quest under our 'QCA_Chapter_01' category ===&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen --, right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and search for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like a tent we'd find in a desert community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
=== 7.1. Add a shovel and three instances of a white sand pile ===&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.2.  Add some objects into the level to dig up out of our sand piles ===&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.3. Add our objects to our sand-piles item property ===&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
=== 7.4. Only show our sand piles if the user passes a perception test ===&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
=== 8.1 Naming and referencing of local instances ===&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
=== 8.2 Doing a better job hiding our sand piles ===&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 8.3 Setting up box triggers to implement digging treasure rewards ===&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
=== 9.1. There is only ever one story, with goals running in alphabetical order ===&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
=== 9.2. Sub-goals will only run when their parent goal is 'complete' ===&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
=== 9.3. Create a parent goal for your level under the __Start goal ===&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.4. Add in the code that will complete our parent level goal ===&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' ===&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.6. Generate definitions, build and reload ===&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' ===&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4701</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4701"/>
		<updated>2017-12-08T15:25:01Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Introduction'''&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
=== 1.1. Create a new adventure type project, targeted at Story mode ===&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
=== 1.2. Create a new basic level template, called 'TheVillage' ===&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larian's coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
=== 2.1. Create a new NPC character model and place it into the level ===&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
=== 3.1. Create the start of a simple dialog ===&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.2.Save the dialog as 'TV_Elena_Dialog' ===&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.3. Create the rest of the dialog ===&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.4. Setup and assign speakers for your dialog ===&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.5. Assign the correct speaker to each node ===&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
=== 4.1. Create our quest categories ===&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
=== 4.2. Save and reload all ===&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
=== 4.3. Add a new quest under our 'QCA_Chapter_01' category ===&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen --, right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and search for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like a tent we'd find in a desert community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
=== 7.1. Add a shovel and three instances of a white sand pile ===&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.2.  Add some objects into the level to dig up out of our sand piles ===&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.3. Add our objects to our sand-piles item property ===&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
=== 7.4. Only show our sand piles if the user passes a perception test ===&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
=== 8.1 Naming and referencing of local instances ===&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
=== 8.2 Doing a better job hiding our sand piles ===&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 8.3 Setting up box triggers to implement digging treasure rewards ===&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
=== 9.1. There is only ever one story, with goals running in alphabetical order ===&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
=== 9.2. Sub-goals will only run when their parent goal is 'complete' ===&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
=== 9.3. Create a parent goal for your level under the __Start goal ===&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.4. Add in the code that will complete our parent level goal ===&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' ===&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.6. Generate definitions, build and reload ===&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' ===&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4700</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4700"/>
		<updated>2017-12-08T15:21:40Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Introduction&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures :-). Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
=== 1.1. Create a new adventure type project, targeted at Story mode ===&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
=== 1.2. Create a new basic level template, called 'TheVillage' ===&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larian's coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
=== 2.1. Create a new NPC character model and place it into the level ===&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
=== 3.1. Create the start of a simple dialog ===&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.2.Save the dialog as 'TV_Elena_Dialog' ===&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.3. Create the rest of the dialog ===&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.4. Setup and assign speakers for your dialog ===&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.5. Assign the correct speaker to each node ===&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
=== 4.1. Create our quest categories ===&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
=== 4.2. Save and reload all ===&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
=== 4.3. Add a new quest under our 'QCA_Chapter_01' category ===&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen --, right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and search for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like a tent we'd find in a desert community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
=== 7.1. Add a shovel and three instances of a white sand pile ===&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.2.  Add some objects into the level to dig up out of our sand piles ===&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.3. Add our objects to our sand-piles item property ===&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
=== 7.4. Only show our sand piles if the user passes a perception test ===&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
=== 8.1 Naming and referencing of local instances ===&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
=== 8.2 Doing a better job hiding our sand piles ===&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 8.3 Setting up box triggers to implement digging treasure rewards ===&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
=== 9.1. There is only ever one story, with goals running in alphabetical order ===&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
=== 9.2. Sub-goals will only run when their parent goal is 'complete' ===&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
=== 9.3. Create a parent goal for your level under the __Start goal ===&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.4. Add in the code that will complete our parent level goal ===&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' ===&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.6. Generate definitions, build and reload ===&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' ===&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4699</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4699"/>
		<updated>2017-12-08T15:20:46Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Introduction&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures :-). The adventure in this guide is purposely kept extremely simple and spartan in the way of environment, objects, characters and terrain.  The goal being to provide a template that a modder can customize for their own adventures.&lt;br /&gt;
&lt;br /&gt;
Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
=== 1.1. Create a new adventure type project, targeted at Story mode ===&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
=== 1.2. Create a new basic level template, called 'TheVillage' ===&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larian's coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
=== 2.1. Create a new NPC character model and place it into the level ===&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
=== 3.1. Create the start of a simple dialog ===&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.2.Save the dialog as 'TV_Elena_Dialog' ===&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.3. Create the rest of the dialog ===&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.4. Setup and assign speakers for your dialog ===&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.5. Assign the correct speaker to each node ===&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
=== 4.1. Create our quest categories ===&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
=== 4.2. Save and reload all ===&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
=== 4.3. Add a new quest under our 'QCA_Chapter_01' category ===&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen --, right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and search for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like a tent we'd find in a desert community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
=== 7.1. Add a shovel and three instances of a white sand pile ===&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.2.  Add some objects into the level to dig up out of our sand piles ===&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.3. Add our objects to our sand-piles item property ===&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
=== 7.4. Only show our sand piles if the user passes a perception test ===&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
=== 8.1 Naming and referencing of local instances ===&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
=== 8.2 Doing a better job hiding our sand piles ===&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 8.3 Setting up box triggers to implement digging treasure rewards ===&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
=== 9.1. There is only ever one story, with goals running in alphabetical order ===&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
=== 9.2. Sub-goals will only run when their parent goal is 'complete' ===&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
=== 9.3. Create a parent goal for your level under the __Start goal ===&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.4. Add in the code that will complete our parent level goal ===&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' ===&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.6. Generate definitions, build and reload ===&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' ===&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4698</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4698"/>
		<updated>2017-12-08T15:19:25Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.  After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures :-). The adventure in this guide is purposely kept extremely simple and spartan in the way of environment, objects, characters and terrain.  The goal being to provide a template that a modder can customize for their own adventures.&lt;br /&gt;
&lt;br /&gt;
Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
=== 1.1. Create a new adventure type project, targeted at Story mode ===&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
=== 1.2. Create a new basic level template, called 'TheVillage' ===&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larian's coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
=== 2.1. Create a new NPC character model and place it into the level ===&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
=== 3.1. Create the start of a simple dialog ===&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.2.Save the dialog as 'TV_Elena_Dialog' ===&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.3. Create the rest of the dialog ===&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.4. Setup and assign speakers for your dialog ===&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.5. Assign the correct speaker to each node ===&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
=== 4.1. Create our quest categories ===&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
=== 4.2. Save and reload all ===&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
=== 4.3. Add a new quest under our 'QCA_Chapter_01' category ===&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen --, right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and search for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like a tent we'd find in a desert community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
=== 7.1. Add a shovel and three instances of a white sand pile ===&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.2.  Add some objects into the level to dig up out of our sand piles ===&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.3. Add our objects to our sand-piles item property ===&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
=== 7.4. Only show our sand piles if the user passes a perception test ===&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
=== 8.1 Naming and referencing of local instances ===&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
=== 8.2 Doing a better job hiding our sand piles ===&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 8.3 Setting up box triggers to implement digging treasure rewards ===&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
=== 9.1. There is only ever one story, with goals running in alphabetical order ===&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
=== 9.2. Sub-goals will only run when their parent goal is 'complete' ===&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
=== 9.3. Create a parent goal for your level under the __Start goal ===&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.4. Add in the code that will complete our parent level goal ===&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' ===&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.6. Generate definitions, build and reload ===&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' ===&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4697</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4697"/>
		<updated>2017-12-08T15:18:57Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I love to write stories, and the promise of a game engine that would allow me to create interactive-and-engaging stories appealed to me.&lt;br /&gt;
&lt;br /&gt;
After spending a week learning everything I could about creating realistic levels and terrain, I moved on to working with quests and scripting.... which shortly hit a road-block when I began to get frustrated when my scripts wouldn't work no matter what I tried.&lt;br /&gt;
&lt;br /&gt;
Four days later, I worked it out and decided to put together a basic-adventure guide that would help other modders to more quickly understand the engine so more of us can move on to putting together custom adventures :-).&lt;br /&gt;
&lt;br /&gt;
The adventure in this guide is purposely kept extremely simple and spartan in the way of environment, objects, characters and terrain.  The goal being to provide a template that a modder can customize for their own adventures.&lt;br /&gt;
&lt;br /&gt;
Overall I would like to touch on every system in the game, for a complete reference guide to everything.  Please feel free to also request custom tutorials for different scripts or areas of the engine and I'll integrate them into our evolving story / adventure.&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
=== 1.1. Create a new adventure type project, targeted at Story mode ===&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
=== 1.2. Create a new basic level template, called 'TheVillage' ===&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larian's coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
=== 2.1. Create a new NPC character model and place it into the level ===&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
=== 3.1. Create the start of a simple dialog ===&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.2.Save the dialog as 'TV_Elena_Dialog' ===&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.3. Create the rest of the dialog ===&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.4. Setup and assign speakers for your dialog ===&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.5. Assign the correct speaker to each node ===&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
=== 4.1. Create our quest categories ===&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
=== 4.2. Save and reload all ===&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
=== 4.3. Add a new quest under our 'QCA_Chapter_01' category ===&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen --, right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and search for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like a tent we'd find in a desert community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
=== 7.1. Add a shovel and three instances of a white sand pile ===&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.2.  Add some objects into the level to dig up out of our sand piles ===&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.3. Add our objects to our sand-piles item property ===&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
=== 7.4. Only show our sand piles if the user passes a perception test ===&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
=== 8.1 Naming and referencing of local instances ===&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
=== 8.2 Doing a better job hiding our sand piles ===&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 8.3 Setting up box triggers to implement digging treasure rewards ===&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
=== 9.1. There is only ever one story, with goals running in alphabetical order ===&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
=== 9.2. Sub-goals will only run when their parent goal is 'complete' ===&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
=== 9.3. Create a parent goal for your level under the __Start goal ===&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.4. Add in the code that will complete our parent level goal ===&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' ===&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.6. Generate definitions, build and reload ===&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' ===&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=Community_page_submission&amp;diff=4696</id>
		<title>Community page submission</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=Community_page_submission&amp;diff=4696"/>
		<updated>2017-12-08T15:08:59Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: Added a community page submission for a guide to creating a basic adventure&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;b&amp;gt;&lt;br /&gt;
Welcome to the community page submission section.&amp;lt;br /&amp;gt;&lt;br /&gt;
First and foremost: thanks to all of you from everyone at Larian Studios!&amp;lt;br /&amp;gt;&lt;br /&gt;
Without your love and feedback, we wouldn't be where we are today.&lt;br /&gt;
&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
That being said, let's do our best to keep this wiki just as lovely as you guys:&amp;lt;br /&amp;gt;&lt;br /&gt;
# To add your page to the main wiki pages, please add it to the list below.&lt;br /&gt;
# Once our moderators get a chance, they'll review the submissions and move approved pages to the appropriate location on the [[Community editor guides | Editor Guides]] and/or [[Community tutorials | Community Tutorials]] section.&lt;br /&gt;
# We'll leave the page link a couple of days on here with an approval stamp and a link to its new location, to give the editor a chance to find out where his/her page went.&lt;br /&gt;
# We love you all very much, but we do not tolerate any misbehavior. Please refrain from using foul language, messing with other people's pages,...&lt;br /&gt;
# This wiki follows the general open format. Anyone is allowed to edit a page. View an edit to your page as interest in your content, not as criticism.&lt;br /&gt;
# But do try to avoid editing someone else's pages before it has been approved and moved to the main sections, unless of course you have the permission to do so from the original editor.&lt;br /&gt;
# As always, stay awesome [[File: heart.png | 32px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:LarianLogo_Icon.png|32px]] &amp;lt;big&amp;gt;&amp;lt;b&amp;gt;[[Example Submission|Example submission]]&amp;lt;/b&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:LarianLogo_Icon.png|32px]] &amp;lt;big&amp;gt;&amp;lt;b&amp;gt;[[How to create a basic adventure with quests, dialog and scripts|How to create a basic adventure with quests, dialog and scripts]]&amp;lt;/b&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:LarianLogo_Icon.png|32px]] &amp;lt;big&amp;gt;&amp;lt;b&amp;gt;[[Party Management via Dialog|Party Management via Dialog]]&amp;lt;/b&amp;gt; [[File:LarianLogo_Icon.png|32px]] &amp;lt;b&amp;gt;&amp;lt;font color='green'&amp;gt;APPROVED&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; ([[Community tutorials|Community Tutorials]])&amp;lt;/big&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:LarianLogo_Icon.png|32px]] &amp;lt;big&amp;gt;&amp;lt;b&amp;gt;[[Subregion UI Notifications|Subregion UI Notifications]]&amp;lt;/b&amp;gt; [[File:LarianLogo_Icon.png|32px]] &amp;lt;b&amp;gt;&amp;lt;font color='green'&amp;gt;APPROVED&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; ([[Community tutorials|Community Tutorials]])&amp;lt;/big&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:LarianLogo_Icon.png|32px]] &amp;lt;big&amp;gt;&amp;lt;b&amp;gt;[[How to make an NPC sit|How to make an NPC sit]]&amp;lt;/b&amp;gt; [[File:LarianLogo_Icon.png|32px]] &amp;lt;b&amp;gt;&amp;lt;font color='green'&amp;gt;APPROVED&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; ([[Community tutorials|Community Tutorials]])&amp;lt;/big&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:LarianLogo_Icon.png|32px]] &amp;lt;big&amp;gt;&amp;lt;b&amp;gt;[[Creating a book with TEXT inside|Creating a book with TEXT inside]]&amp;lt;/b&amp;gt; [[File:LarianLogo_Icon.png|32px]] &amp;lt;b&amp;gt;&amp;lt;font color='green'&amp;gt;APPROVED&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; ([[Community tutorials|Community Tutorials]])&amp;lt;/big&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:LarianLogo_Icon.png|32px]] &amp;lt;big&amp;gt;&amp;lt;b&amp;gt;[[Pak Extractor Guide|Pak Extractor Guide]]&amp;lt;/b&amp;gt; [[File:LarianLogo_Icon.png|32px]] &amp;lt;b&amp;gt;&amp;lt;font color='green'&amp;gt;APPROVED&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; ([[Community editor guides|Editor Guides]])&amp;lt;/big&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:LarianLogo_Icon.png|32px]] &amp;lt;big&amp;gt;&amp;lt;b&amp;gt;[[Tutorial - Implementing a Basic Quest|Tutorial - Implementing a Basic Quest]]&amp;lt;/b&amp;gt; [[File:LarianLogo_Icon.png|32px]] &amp;lt;b&amp;gt;&amp;lt;font color='green'&amp;gt;APPROVED&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; ([[Community tutorials|Community Tutorials]]) ([[Community:_Getting_Started|Editor Guides]])&amp;lt;/big&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:LarianLogo_Icon.png|32px]] &amp;lt;big&amp;gt;&amp;lt;b&amp;gt;[[NPC Patrols|NPC Patrols]]&amp;lt;/b&amp;gt; [[File:LarianLogo_Icon.png|32px]] &amp;lt;b&amp;gt;&amp;lt;font color='green'&amp;gt;APPROVED&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; ([[Community tutorials|Community Tutorials]])&amp;lt;/big&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:LarianLogo_Icon.png|32px]] &amp;lt;big&amp;gt;&amp;lt;b&amp;gt;[[Basic Character Creation]]&amp;lt;/b&amp;gt; [[File:LarianLogo_Icon.png|32px]] &amp;lt;b&amp;gt;&amp;lt;font color='green'&amp;gt;APPROVED&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; ([[Community tutorials|Community Tutorials]])&amp;lt;/big&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:LarianLogo_Icon.png|32px]] &amp;lt;big&amp;gt;&amp;lt;b&amp;gt;[[Character and Item Script Triggers, Calls, and Queries]]&amp;lt;/b&amp;gt; [[File:LarianLogo_Icon.png|32px]] &amp;lt;b&amp;gt;&amp;lt;font color='green'&amp;gt;APPROVED&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; ([[Community:_Script_editor|Editor Guides]])&amp;lt;/big&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:LarianLogo_Icon.png|32px]] &amp;lt;big&amp;gt;&amp;lt;b&amp;gt;[[Scripting in New Talents, Attributes, and Combat Abilities]]&amp;lt;/b&amp;gt; [[File:LarianLogo_Icon.png|32px]] &amp;lt;b&amp;gt;&amp;lt;font color='green'&amp;gt;APPROVED&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; ([[Community tutorials|Community Tutorials]])([[Community:_Story_editor|Editor Guides]])&amp;lt;/big&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:LarianLogo_Icon.png|32px]] &amp;lt;big&amp;gt;&amp;lt;b&amp;gt;[[Creating/Modifying Weapon Elements and Scaling]]&amp;lt;/b&amp;gt; [[File:LarianLogo_Icon.png|32px]] &amp;lt;b&amp;gt;&amp;lt;font color='green'&amp;gt;APPROVED&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; ([[Community tutorials|Community Tutorials]])([[Community:_Stats_editor|Editor Guides]])&amp;lt;/big&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:LarianLogo_Icon.png|32px]] &amp;lt;big&amp;gt;&amp;lt;b&amp;gt;[[Adding New Icons]]&amp;lt;/b&amp;gt; [[File:LarianLogo_Icon.png|32px]] &amp;lt;b&amp;gt;&amp;lt;font color='green'&amp;gt;APPROVED&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; ([[Community tutorials|Community Tutorials]])([[Community:_Texture_atlas_editor|Editor Guides]])&amp;lt;/big&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4695</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4695"/>
		<updated>2017-12-08T15:05:33Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: /* 9.7. Finally, add the shared helper code to your new sub item goal – 'TV_ShovelArea' */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
=== 1.1. Create a new adventure type project, targeted at Story mode ===&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
=== 1.2. Create a new basic level template, called 'TheVillage' ===&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larian's coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
=== 2.1. Create a new NPC character model and place it into the level ===&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
=== 3.1. Create the start of a simple dialog ===&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.2.Save the dialog as 'TV_Elena_Dialog' ===&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.3. Create the rest of the dialog ===&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.4. Setup and assign speakers for your dialog ===&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.5. Assign the correct speaker to each node ===&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
=== 4.1. Create our quest categories ===&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
=== 4.2. Save and reload all ===&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
=== 4.3. Add a new quest under our 'QCA_Chapter_01' category ===&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen --, right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and search for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like a tent we'd find in a desert community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
=== 7.1. Add a shovel and three instances of a white sand pile ===&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.2.  Add some objects into the level to dig up out of our sand piles ===&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.3. Add our objects to our sand-piles item property ===&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
=== 7.4. Only show our sand piles if the user passes a perception test ===&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
=== 8.1 Naming and referencing of local instances ===&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
=== 8.2 Doing a better job hiding our sand piles ===&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 8.3 Setting up box triggers to implement digging treasure rewards ===&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
=== 9.1. There is only ever one story, with goals running in alphabetical order ===&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
=== 9.2. Sub-goals will only run when their parent goal is 'complete' ===&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
=== 9.3. Create a parent goal for your level under the __Start goal ===&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.4. Add in the code that will complete our parent level goal ===&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' ===&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.6. Generate definitions, build and reload ===&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.7. Add the shared helper code to your new sub item goal – 'TV_ShovelArea' ===&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4694</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4694"/>
		<updated>2017-12-08T14:51:45Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: /* 9. Setting up the StoryEditor and scripts for your custom levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
=== 1.1. Create a new adventure type project, targeted at Story mode ===&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
=== 1.2. Create a new basic level template, called 'TheVillage' ===&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larian's coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
=== 2.1. Create a new NPC character model and place it into the level ===&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
=== 3.1. Create the start of a simple dialog ===&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.2.Save the dialog as 'TV_Elena_Dialog' ===&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.3. Create the rest of the dialog ===&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.4. Setup and assign speakers for your dialog ===&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.5. Assign the correct speaker to each node ===&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
=== 4.1. Create our quest categories ===&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
=== 4.2. Save and reload all ===&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
=== 4.3. Add a new quest under our 'QCA_Chapter_01' category ===&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen --, right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and search for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like a tent we'd find in a desert community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
=== 7.1. Add a shovel and three instances of a white sand pile ===&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.2.  Add some objects into the level to dig up out of our sand piles ===&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.3. Add our objects to our sand-piles item property ===&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
=== 7.4. Only show our sand piles if the user passes a perception test ===&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
=== 8.1 Naming and referencing of local instances ===&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
=== 8.2 Doing a better job hiding our sand piles ===&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 8.3 Setting up box triggers to implement digging treasure rewards ===&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
=== 9.1. There is only ever one story, with goals running in alphabetical order ===&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
=== 9.2. Sub-goals will only run when their parent goal is 'complete' ===&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal '''&amp;quot;Sandbox&amp;quot;''' which had successfully completed an INIT and EXIT prior to the exec INIT section of goal '''&amp;quot;TheVillage&amp;quot;''' occurring.}}&lt;br /&gt;
&lt;br /&gt;
=== 9.3. Create a parent goal for your level under the __Start goal ===&lt;br /&gt;
&lt;br /&gt;
Right click on the '''__Start''' goal &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and select the 'Add New Sub Item...' option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to create a goal with the same name as your level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;, in our instance this would be '''TheVillage'''.  Press the '''Ok''' button (4) to save the new parent goal for your level and check out the '''GoalCompleted''' code in the '''__Start''' goal (5), as we will be setting up something similar for our newly created parent level goal – '''TheVillage'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.4. Add in the code that will complete our parent level goal ===&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an '''INIT''', '''KB''' and '''EXIT''' section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your '''TheVillage''' parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' ===&lt;br /&gt;
&lt;br /&gt;
Right click '''TheVillage''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; goal and select '''Add New Sub Item...''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to add a new sub item goal that will execute after '''TheVillage''' goal completes.  Name the new goal '''TV_ShovelArea''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and click '''Ok''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.6. Generate definitions, build and reload ===&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose '''Generate Definitions, Build and Reload''' to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.7. Finally, add the shared helper code to your new sub item goal – 'TV_ShovelArea' ===&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; into your '''TV_ShovelArea''' goal and update each of the references to your own triggers, objects and sand piles – using the '''ctrl + space''' code completion feature &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word '''redball''' being typed, and then '''ctrl + space''' being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4693</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4693"/>
		<updated>2017-12-08T14:47:15Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: /* 8.3 Setting up box triggers to implement digging treasure rewards */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
=== 1.1. Create a new adventure type project, targeted at Story mode ===&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
=== 1.2. Create a new basic level template, called 'TheVillage' ===&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larian's coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
=== 2.1. Create a new NPC character model and place it into the level ===&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
=== 3.1. Create the start of a simple dialog ===&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.2.Save the dialog as 'TV_Elena_Dialog' ===&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.3. Create the rest of the dialog ===&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.4. Setup and assign speakers for your dialog ===&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.5. Assign the correct speaker to each node ===&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
=== 4.1. Create our quest categories ===&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
=== 4.2. Save and reload all ===&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
=== 4.3. Add a new quest under our 'QCA_Chapter_01' category ===&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen --, right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and search for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like a tent we'd find in a desert community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
=== 7.1. Add a shovel and three instances of a white sand pile ===&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.2.  Add some objects into the level to dig up out of our sand piles ===&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.3. Add our objects to our sand-piles item property ===&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
=== 7.4. Only show our sand piles if the user passes a perception test ===&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
=== 8.1 Naming and referencing of local instances ===&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
=== 8.2 Doing a better job hiding our sand piles ===&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 8.3 Setting up box triggers to implement digging treasure rewards ===&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
=== 9.1. There is only ever one story, with goals running in alphabetical order ===&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically (5).  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
=== 9.2. Sub-goals will only run when their parent goal is 'complete' ===&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' (4).  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal &amp;quot;Sandbox&amp;quot; which had successfully completed an INIT and EXIT prior to the exec INIT section of goal &amp;quot;TheVillage&amp;quot; occurring.}}&lt;br /&gt;
&lt;br /&gt;
=== 9.3. Create a parent goal for your level under the __Start goal ===&lt;br /&gt;
&lt;br /&gt;
Right click on the __Start goal (1) and select the 'Add New Sub Item...' option (2) to create a goal with the same name as your level (3), in our instance this would be TheVillage.  Press the ok button (4) to save the new parent goal for your level and check out the GoalCompleted code in the __Start goal (5), as we will be setting up something similar for our newly created parent level goal – TheVillage.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.4. Add in the code that will complete our parent level goal ===&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an INIT, KB and EXIT section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your TheVillage parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' ===&lt;br /&gt;
&lt;br /&gt;
Right click TheVillage (1) goal and select Add New Sub Item... (2) to add a new sub item goal that will execute after our TheVillage goal completes.  Name the new goal TV_ShovelArea (3) and click ok (4) once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.6. Generate definitions, build and reload ===&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose Generate  Definitions, Build and Reload to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.7. Finally, add the shared helper code to your new sub item goal – 'TV_ShovelArea' ===&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code (1) into your TV_ShovelArea goal and update each of the references to your own triggers, objects and sand piles – using the ctrl + space code completion feature (2) to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word redball being typed, and then ctrl + space being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
	<entry>
		<id>https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4692</id>
		<title>How to create a basic adventure with quests, dialog and scripts</title>
		<link rel="alternate" type="text/html" href="https://docs.larian.game/index.php?title=How_to_create_a_basic_adventure_with_quests,_dialog_and_scripts&amp;diff=4692"/>
		<updated>2017-12-08T14:46:40Z</updated>

		<summary type="html">&lt;p&gt;RaalKadaj: /* 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;noautonum&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 1. Create your new project and basic level ==&lt;br /&gt;
We will be creating a Story mode Adventure, with the main focus being assisting a little girl to find her mummy's medicine. To that end, please create a new Adventure, targeted for story mode with the name '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
=== 1.1. Create a new adventure type project, targeted at Story mode ===&lt;br /&gt;
Create a new project by pressing the green create project button on the top left.  Select the '''Adventure''' project type, and target the project for '''Story''' mode.   Use whatever name you like for the project name – for our tutorial adventure I have called the project '''HelpMyMummy'''.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 1 SelectYourProjectType.png|none|left|Select your project type|600px]]&lt;br /&gt;
&lt;br /&gt;
=== 1.2. Create a new basic level template, called 'TheVillage' ===&lt;br /&gt;
Select the '''Basic''' level template, and call your level '''TheVillage''' – or whatever other name you prefer.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 1 2 CreateNewBasicLevelTemplate.png|none|left|Create new basic level template|600px]]&lt;br /&gt;
&lt;br /&gt;
== 2. Add a character ==&lt;br /&gt;
We'll keep this bare-boned and simple, placing a character into the level and updating the bits and pieces we will require for the next steps.  We named her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt; and used Larian coding standards to give her a reference name of '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;gt;(6)&amp;lt;/span&amp;gt;.  For this stage, feel free to use any character and name.&lt;br /&gt;
&lt;br /&gt;
{{note|Highly recommended we follow Larian's coding standards for consistency and because they make our job easier long term, both in understanding each-other's scripting and in reducing future 'lookup' time finding more info about items we wish to refer to.}}&lt;br /&gt;
&lt;br /&gt;
=== 2.1. Create a new NPC character model and place it into the level ===&lt;br /&gt;
&lt;br /&gt;
Find the '''Humans_Children''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1,2)&amp;lt;/span&amp;gt; model and place it into the level &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt;, naming her '''Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.  To keep in line with standards, for her reference, use the name '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;.  The '''S''' is to let the engine know that we want to reference this local object in the story and the '''TV''' is the prefix for our '''TheVillage''' level.&lt;br /&gt;
&lt;br /&gt;
We're adding this early so we don't have to come back, but for now please enter the text '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(7)&amp;lt;/span&amp;gt; for the default dialog that will start when speaking with her.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 2.1 CreateNPCModel.png|none|left|Create new NPC character|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 3. Create a simple dialog and save it ==&lt;br /&gt;
In this section we are going to create a simple quest dialog so we can talk with our NPC character and begin a quest.&lt;br /&gt;
&lt;br /&gt;
=== 3.1. Create the start of a simple dialog ===&lt;br /&gt;
&lt;br /&gt;
Open up the '''Dialog Editor''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and create a simple dialog between players and your NPC character.  Create a new '''Greeting''' dialog &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and enter the initial greeting &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt;.  Once done press the &amp;lt;b&amp;gt;'x'&amp;lt;/b&amp;gt; button &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; to save your changes and close the '''Edit Tagged Texts''' window.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.1_CreateSimpleDialog.png|none|left|Create simple dialog|550px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.2.Save the dialog as 'TV_Elena_Dialog' ===&lt;br /&gt;
&lt;br /&gt;
Take this moment to save the dialog.  We know the prefix for this level is '''TV''', that our character is called '''Elena''' and we are referencing a Dialog - thus: '''TV_Elena_Dialog''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which we entered earlier.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.2_SaveDialog.png|none|left|Save your dialog|686px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.3. Create the rest of the dialog ===&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to create the rest of the dialog nodes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1-4)&amp;lt;/span&amp;gt;, along with the final node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.3_CreateRestOfDialog.png|none|left|Create the rest of your dialog|1069px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.4. Setup and assign speakers for your dialog ===&lt;br /&gt;
&lt;br /&gt;
Final step for our dialog is to setup and assign our speakers.  Press the edit &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; button to add new speakers, searching for our '''S_TV_Elena''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3,4)&amp;lt;/span&amp;gt; speaker.  Select '''Elena(S_TV_Elena)''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt; and add it to the active list of speakers &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;, pressing '''Ok''' once done &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(6)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Add a new speaker and then follow the same setup steps &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3-6)&amp;lt;/span&amp;gt; for the '''GROUP_Players''' speaker &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(8)&amp;lt;/span&amp;gt;, which covers any player talking to our NPC character.  Press the Ok button to save your changes &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(9)&amp;lt;/span&amp;gt; once both speakers have been assigned.&lt;br /&gt;
&lt;br /&gt;
{{note|Don't add both speakers under one node.  For example, having '''Elena(S_TV_Elena)''' and '''GROUP_Players''' both grouped together as speaker one (2).  Doing so is only used when we have more than one speaker saying something, such as from a group of 2 or more NPC characters speaking together.}}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.4_SetupAndAssignSpeakers.png|none|left|Setup and assign speakers|634px]]&lt;br /&gt;
&lt;br /&gt;
=== 3.5. Assign the correct speaker to each node ===&lt;br /&gt;
&lt;br /&gt;
The correct speakers should automatically be assigned to their nodes now.  However, if anything isn't correct, you can manually select a node &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and update the speaker as need be.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_3.5_AssignCorrectSpeakers.png|none|left|Assign the correct speakers to your dialog nodes|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 4. Create our Quest Journal entries ==&lt;br /&gt;
Ah :-), some more of the fun parts.  I'll show you what standards the DOS:2 team use and how we can best setup our quests for our adventure.&lt;br /&gt;
&lt;br /&gt;
=== 4.1. Create our quest categories ===&lt;br /&gt;
&lt;br /&gt;
Open up the Journal Editor &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, select your project &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, click on the Quest Categories option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and add two new rows &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;, for a total of three quest categories.  Once done, update our quest categories to match our screenshot &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.1_CreateQuestCategories.png|none|left|Creating quest categories|680px]]&lt;br /&gt;
&lt;br /&gt;
 a) CategoryID: '''QCA_Chapter_01''' | Description: '''The Village''' | SortingPriority: '''3'''&lt;br /&gt;
 b) CategoryID: '''QCA_Chapter_02''' | Description: '''Home Sweet Home''' | SortingPriority: '''2'''&lt;br /&gt;
 c) CategoryID: '''QCA_Chapter_03''' | Description: '''The Cave of Sorrows''' | SortingPriority: '''1'''&lt;br /&gt;
&lt;br /&gt;
Feel free to update descriptions and category IDs in any way you see fit.  If possible, work with including the QCA_ prefix with your category ids, for better code / script legibility.&lt;br /&gt;
&lt;br /&gt;
{{note|Please note that our little adventure has been broken up into categories -- which would normally only occur in a larger adventure -- to demonstrate how the DOS:2 team structure their adventures and to give you a template to build out your own larger scale adventure.}}&lt;br /&gt;
&lt;br /&gt;
=== 4.2. Save and reload all ===&lt;br /&gt;
&lt;br /&gt;
Take a quick second to click on the file menu and '''Save All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;.  Then '''Reload All''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to update everything.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.2_SaveAndReloadAll.png|none|left|Save and reload all|149px]]&lt;br /&gt;
&lt;br /&gt;
=== 4.3. Add a new quest under our 'QCA_Chapter_01' category ===&lt;br /&gt;
&lt;br /&gt;
Select the '''Quests''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; option, add a new quest &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, select it &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then update its details &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.  Please note the prefixes used, with '''TV''' representing '''TheVillage''' and '''QCA''' indicating that this is a quest category. We will go into more detail about the IsMainQuest, IsShareable and BroadcastLevel settings in future.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_4.3_AddNewQuest.png|none|left|Add a new quest to our quest journal|728px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Working with Prefabs ==&lt;br /&gt;
Prefabs are cool :-) -- especially for laying out rocks, vegetation and trees.  In this instance, we want to create some sort of simple structures to indicate a nomad style camp and luckily we have some prefabs that can do just that for us.&lt;br /&gt;
&lt;br /&gt;
{{tip|'''What are prefabs?''' -- In the words of Larian, a prefab is a collection of entities, and is used to speed up decoration.  For us this means we can put together a mini-scene, such as an oasis setting and then be able to save that as a collection for use in future levels.}}&lt;br /&gt;
&lt;br /&gt;
Open up the '''Root Templates''' panel -- which should already be open at bottom of your screen --, right click on the prefabs icon &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; and search for 'tent refugee' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt;, which will provide us with some prefabricated groups of objects that look like a tent we'd find in a desert community.&lt;br /&gt;
&lt;br /&gt;
Once you have dragged in two suitable tent prefabs, aligning them however you wish (double click to select and move prefabs in scenes) –- please also grab a set of vases to add a little bit of flavour &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(5, 6)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 5.0 WorkingWithPrefabs.png|none|left|Working with prefabs|650px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|'''Prefab usage tip''' -- I struggled with prefabs initially, until I found out you have to '''double-click''' on them to select all objects within a prefab.  If you don't do this then you will just be grabbing one of the objects within the collection (prefab), which can be useful when re-arranging a collection of trees you have recently added.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 6. Shortcut tips for working with objects ==&lt;br /&gt;
For a while I was clicking on each of these 'Mode' icons on the left hand side to manipulate objects, until I learned about these nifty shortcut keys.  When selecting any objects, use keys 1 - 5 to make changes and hold down the shift key when moving (translating) a selection to create a copy of all selected objects.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Options&lt;br /&gt;
! style=&amp;quot;text-align:left;&amp;quot;|Key (requires object to be selected first)&lt;br /&gt;
|-&lt;br /&gt;
|Select objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt;, used to directly select objects&lt;br /&gt;
|-&lt;br /&gt;
|Move objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt;, used to move / translate selected objects (x, y, z)&lt;br /&gt;
|-&lt;br /&gt;
|Rotate objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'3'&amp;lt;/span&amp;gt;, used to rotate selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Scale objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'4'&amp;lt;/span&amp;gt;, used to scale selected objects&lt;br /&gt;
|-&lt;br /&gt;
|Add objects&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'5'&amp;lt;/span&amp;gt;, used to add objects selected in the Root Templates Panel&lt;br /&gt;
|-&lt;br /&gt;
|Copy objects&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'2'&amp;lt;/span&amp;gt; to move selected objects, then hold down &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'shift'&amp;lt;/span&amp;gt; when moving objects to copy them&lt;br /&gt;
|-&lt;br /&gt;
|Select prefabs&lt;br /&gt;
|Select &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'1'&amp;lt;/span&amp;gt; to select objects, then &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;'double-click'&amp;lt;/span&amp;gt; to select all objects in a prefab&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure 6.0 ShortcutTips.png|none|left|Shortcut tips|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 7. Hidden sand piles, secrets and object items ==&lt;br /&gt;
For our next steps we need to go searching for the medicine that Elena lost while playing.  To set this up we are going to create some hidden dirt piles which the player needs to discover, a handy shovel for digging and some items for our player characters to find.&lt;br /&gt;
&lt;br /&gt;
=== 7.1. Add a shovel and three instances of a white sand pile ===&lt;br /&gt;
Search for our hidden sand pile objects &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, add three instances (3 x objects) of '''PUZ_SandWhitepile_A''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; to our level and search for a shovel &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to add nearby &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4)&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.1_AddShovelAndSandPiles.png|none|left|Add shovel and sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.2.  Add some objects into the level to dig up out of our sand piles ===&lt;br /&gt;
&lt;br /&gt;
Search through our root templates and add the following objects into our level.&lt;br /&gt;
&lt;br /&gt;
 1) '''LOOT_Toy_TeddyBearWornOff_Dynamic'''&lt;br /&gt;
 2) '''CON_Potion_A_Health'''&lt;br /&gt;
 3) '''LOOT_Toy_Ball_Red_A'''&lt;br /&gt;
 4) '''CON_Drink_Bottle_Wine_A'''&lt;br /&gt;
&lt;br /&gt;
We will shortly be moving them into our sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.2_AddSomeObjects.png|none|left|Add some objects|560px]]&lt;br /&gt;
&lt;br /&gt;
=== 7.3. Add our objects to our sand-piles item property ===&lt;br /&gt;
&lt;br /&gt;
Individually select each of our three sand piles from the '''world outliner''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, and click on the '''Items''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; property to edit each objects items.  Filter our Edit Items window to only show level items &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; and then select and assign the four objects in any way you like &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(4, 5)&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.3_AddObjectsToSandPiles.png|none|left|Add objects to piles|925px]]&lt;br /&gt;
&lt;br /&gt;
{{Tip|For our tutorial we have assigned our ball and bottle-of-wine to '''PUZ_SandWhitePile_A_001''', and our teddy bear and potion to '''PUZ_SandWhitePile_A_002'''. Pile 003 has been left empty.}}&lt;br /&gt;
&lt;br /&gt;
=== 7.4. Only show our sand piles if the user passes a perception test ===&lt;br /&gt;
&lt;br /&gt;
We want to hide our sand piles so that they are not immediately obvious to our players.  Luckily these objects already have the '''PUZZLE_HiddenPerception''' script assigned, which will trigger a default perception check for players to see the object.  Please feel free to use this script on any other world objects you wish to hide until perceived by the player.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_7.4_OnlyShowPilesIfPerceptionPassed.png|none|left|Only show piles if perception passed|900px]]&lt;br /&gt;
&lt;br /&gt;
== 8. Box Triggers, referencing local instances, digging with shovels and treasure rewards ==&lt;br /&gt;
We're going to be jumping over to some slightly more complex topics in this section.  Our aim here is to let our story (script) know about how our sand piles behave, specifically how they react and we will also be reviewing our naming conventions for local objects – to ensure we are consistent with Larian's standards.&lt;br /&gt;
&lt;br /&gt;
=== 8.1 Naming and referencing of local instances ===&lt;br /&gt;
&lt;br /&gt;
This is going to be cool :-).  Please run through all our sand pile objects (including diggable items) and rename them to:&lt;br /&gt;
&lt;br /&gt;
 1) '''S_TV_SandPile_001'''&lt;br /&gt;
 2) '''S_TV_SandPile_001_RedBall'''&lt;br /&gt;
 3) '''S_TV_SandPile_001_WineBottle'''&lt;br /&gt;
 4) '''S_TV_SandPile_002'''&lt;br /&gt;
 5) '''S_TV_SandPile_002_SmallPotion'''&lt;br /&gt;
 6) '''S_TV_SandPile_002_TeddyBear'''&lt;br /&gt;
 7) '''S_TV_SandPile_003'''&lt;br /&gt;
 8) '''S_TV_SandPile_Shovel'''&lt;br /&gt;
&lt;br /&gt;
Once completed, our '''world outliner''' should look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.1_WorldOutliner.PNG|none|left|World outliner|235px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Why make these naming changes?''' -- A couple of reasons :-).  First of all, we add the 'S' as a naming convention for any local objects we want to reference in scripts.  This has the benefit of keeping them ordered together, lets the engine know to have references setup for us and improves our code readability (easier to find / understand) – which has ongoing long-term benefits for us and others.&lt;br /&gt;
&lt;br /&gt;
You'll also note that we renamed the items to match up with the sand piles, which has helped to order them in our '''World Outliner''' and also makes it easy to see where our items '''Red Ball''', '''Wine''' etc. belong.}}&lt;br /&gt;
&lt;br /&gt;
=== 8.2 Doing a better job hiding our sand piles ===&lt;br /&gt;
&lt;br /&gt;
I was curious as to how Larian achieved this, as it seemed pretty obvious where the sand piles were.  Lo and behold, we have a simple solution here – which is to select all of our sand piles &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(1)&amp;lt;/span&amp;gt;, select the translate option &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(2)&amp;lt;/span&amp;gt; and push them further into the ground &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;&lt;br /&gt;
(3)&amp;lt;/span&amp;gt; so that only the top part of the sand piles are visible.  This way it isn't so obvious where the sand piles are, whilst at the same time our shovel should help point our players in the right direction.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.2_BetterJobHidingSandPiles.png|none|left|Better job hiding sand piles|785px]]&lt;br /&gt;
&lt;br /&gt;
=== 8.3 Setting up box triggers to implement digging treasure rewards ===&lt;br /&gt;
&lt;br /&gt;
We will need to create some box triggers to let our story know where diggable areas exist and where to spawn any found objects.  Please search for '''Box Trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt; in the root templates panel and drag out four instances &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; into your level (one box trigger for each object).  Once done, run through and rename each box trigger &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; to match up with our sand piles and related items.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_SettingUpBoxTriggersForDiggingTreasureRewards.png|none|left|Setting up box triggers for digging treasure rewards|900px]]&lt;br /&gt;
&lt;br /&gt;
Finally, we just need to make sure our Box Trigger bounds covers our sand piles.  Run through and select each '''box trigger''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(1)&amp;lt;/span&amp;gt;, then select the '''Edit Shape Bounds''' &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(2)&amp;lt;/span&amp;gt; option to specify the bounds &amp;lt;span style=&amp;quot;color:#f1c40f&amp;quot;&amp;gt;(3)&amp;lt;/span&amp;gt; for each trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_8.3_EditShapeBoundsForBoxTriggers.png|none|left|Edit shape bounds for box triggers|750px]]&lt;br /&gt;
&lt;br /&gt;
== 9. Setting up the StoryEditor and scripts for your custom levels ==&lt;br /&gt;
&lt;br /&gt;
Before we begin, there are a few things we need to understand first about stories and how they work.  Notably that all our goals are placed in alphabetical order and compiled into a single story at run-time – with the only exception being that sub-goals will only run when their parent goal completes.&lt;br /&gt;
&lt;br /&gt;
=== 9.1. There is only ever one story, with goals running in alphabetical order ===&lt;br /&gt;
&lt;br /&gt;
At compilation time, our collection of goals is compiled into one story and sorted alphabetically (5).  Regardless of where the goal sits within our Story Editor, whether this be a top level goal or a goal that sits two levels deep under its parent goals.&lt;br /&gt;
&lt;br /&gt;
=== 9.2. Sub-goals will only run when their parent goal is 'complete' ===&lt;br /&gt;
&lt;br /&gt;
This is a big caveat, and led me to days of frustration as the scripts I wrote just weren't executing.  What was happening was that my sub goals that I had neatly placed under a parent goal related to my level weren't being triggered because I hadn't set my parent goal to 'complete' (4).  Something we will setup and address shortly.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.2_StoryEditorGuide.png|none|left|Story editor execution order guide|550px]]&lt;br /&gt;
&lt;br /&gt;
{{Note|For clarity sake, I removed the exec INIT section of goal &amp;quot;Sandbox&amp;quot; which had successfully completed an INIT and EXIT prior to the exec INIT section of goal &amp;quot;TheVillage&amp;quot; occurring.}}&lt;br /&gt;
&lt;br /&gt;
=== 9.3. Create a parent goal for your level under the __Start goal ===&lt;br /&gt;
&lt;br /&gt;
Right click on the __Start goal (1) and select the 'Add New Sub Item...' option (2) to create a goal with the same name as your level (3), in our instance this would be TheVillage.  Press the ok button (4) to save the new parent goal for your level and check out the GoalCompleted code in the __Start goal (5), as we will be setting up something similar for our newly created parent level goal – TheVillage.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.3_CreateParentGoalForLevel.png|none|left|Create parent goal for level|635px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.4. Add in the code that will complete our parent level goal ===&lt;br /&gt;
&lt;br /&gt;
I re-used this code from the Sandbox parent level goal that Larian had setup.  Like our other goals, it has an INIT, KB and EXIT section.&lt;br /&gt;
&lt;br /&gt;
 - '''INIT''' is where all the initialisation code for a goal is placed, think of it like your setup area – all the actions in here occur as soon as the goal initialises.&lt;br /&gt;
 - '''KB''' is where the bulk of the code goes, and contains all the rules that become active as soon as your goal starts initialising.  Which means that the rules in the KB section can react to changes      made in the INIT section of that same goal.&lt;br /&gt;
 - '''EXIT''' is all the actions that are executed once the goal completes, which is generally used to remove existing databases – resulting in smaller save-game sizes and a faster game experience.&lt;br /&gt;
&lt;br /&gt;
Grab a copy of the code blocks below and paste them in your TheVillage parent goal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ------- Place in the &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;INIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
RegionStarted(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
IF&lt;br /&gt;
DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
AND&lt;br /&gt;
DB_CurrentLevel(&amp;quot;TheVillage&amp;quot;)&lt;br /&gt;
THEN&lt;br /&gt;
GoalCompleted;&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;KB&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// -------- Place in the &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&lt;br /&gt;
NOT DB_CheckLevelStart(&amp;quot;TheVillage&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ------- END &amp;quot;EXIT&amp;quot; section --------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 9.5. Create a new sub item goal under the parent goal for our level – 'TheVillage' ===&lt;br /&gt;
&lt;br /&gt;
Right click TheVillage (1) goal and select Add New Sub Item... (2) to add a new sub item goal that will execute after our TheVillage goal completes.  Name the new goal TV_ShovelArea (3) and click ok (4) once done.&lt;br /&gt;
&lt;br /&gt;
We will be using this goal to store the code for letting our story know how to handle character interactions with our secret sand piles.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.5_CreateNewSubItemGoalUnderParentLevelGoal.png|none|left|Create new sub item goal under parent level goal|280px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.6. Generate definitions, build and reload ===&lt;br /&gt;
&lt;br /&gt;
Click on the file menu and choose Generate  Definitions, Build and Reload to generate all the code we need to reference the local objects in our levels – required before we can move on to the next step.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.6_GenerateDefinitionsBuildAndReload.PNG|none|left|Generate definitions, build and reload|255px]]&lt;br /&gt;
&lt;br /&gt;
=== 9.7. Finally, add the shared helper code to your new sub item goal – 'TV_ShovelArea' ===&lt;br /&gt;
&lt;br /&gt;
Please copy/paste the attached source code (1) into your TV_ShovelArea goal and update each of the references to your own triggers, objects and sand piles – using the ctrl + space code completion feature (2) to assist.&lt;br /&gt;
&lt;br /&gt;
The example below shows the word redball being typed, and then ctrl + space being pressed to allow the user to see a drop-down of all related references, which in this case include both the red-ball object and the red-ball trigger.&lt;br /&gt;
&lt;br /&gt;
[[File:BasicAdventure_9.7_AddSharedHelperCodeShovelArea.PNG|none|left|Add shared helper codes for shovel area scripts|800px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the INIT section ------&lt;br /&gt;
&lt;br /&gt;
// Hooks up the Wine-Bottle Box Trigger and associates the reward 'TV_Reward_Wine' with our SandPile_001 object&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e, &amp;quot;TV_Reward_Wine&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_RedBall&amp;quot;, ITEMGUID_S_TV_SandPile_001_8f8f7e03-22a1-484d-8f7e-8bc05b92f14d);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8, &amp;quot;TV_Reward_TeddyBear&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d, &amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_d6b1139e-41dd-4d17-b88f-9a3cf9b1c2cd);&lt;br /&gt;
DB_ShovelArea(TRIGGERGUID_BoxTrigger_000_e3bf1e01-c05c-4055-889c-a51dd2fbdaff,&amp;quot;Empty&amp;quot;,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573);&lt;br /&gt;
&lt;br /&gt;
// Defines that the TV_Reward_Wine is our bottle of wine and that it will spawn on the WineBottle_BoxTrigger&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_Wine&amp;quot;,  ITEMGUID_S_TV_SandPile_001_WineBottle_ea94f7c2-7087-458a-a969-eb39b551f4c1, TRIGGERGUID_S_TV_SandPile_001_WineBottle_BoxTrigger_a70f5f0f-bb59-43d7-be4a-ec1f627c390e);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_RedBall&amp;quot;, redball, TRIGGERGUID_S_TV_SandPile_001_RedBall_BoxTrigger_41f2ff57-a4df-4a40-87ec-1d0ed8e3897d);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_TeddyBear&amp;quot;,  ITEMGUID_S_TV_SandPile_002_TeddyBear_e6cb08ec-d52f-4cac-b6b3-c23d08fbfd17, TRIGGERGUID_S_TV_SandPile_002_TeddyBear_BoxTrigger_cea3da18-444d-4ee7-8f2f-8a1b5784ccf8);&lt;br /&gt;
DB_ShovelRewardItemAppear(&amp;quot;TV_Reward_SmallPotion&amp;quot;, ITEMGUID_S_TV_SandPile_002_SmallPotion_42b65a2e-4b4f-4cbd-a639-2b7df62f1606, TRIGGERGUID_S_TV_SandPile_002_SmallPotion_BoxTrigger_30eb13ab-652d-444e-9ce4-3137fbb5ea0b);&lt;br /&gt;
&lt;br /&gt;
// ----- END INIT section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// ----- Place in the KB section -----&lt;br /&gt;
&lt;br /&gt;
// Displays the entered text if the character uses our SandPile_003 object&lt;br /&gt;
IF&lt;br /&gt;
CharacterUsedItem(_Character,ITEMGUID_S_TV_SandPile_003_a55808f1-39a1-42ae-9a83-8112079c0573)&lt;br /&gt;
THEN&lt;br /&gt;
DisplayText(_Character,&amp;quot;You start digging around the area but find nothing of interest...&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// ----- END KB section ------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 10. NPC Patrols and moving NPC characters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 11. Animations and gestures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 12. Quest states and rewards ==&lt;/div&gt;</summary>
		<author><name>RaalKadaj</name></author>
	</entry>
</feed>