Difference between revisions of "Secret Dirt Piles"

From Divinity Engine Wiki
Jump to: navigation, search
m (Osiris Story Calls)
(Osiris Story Calls)
 
Line 40: Line 40:
  
 
== Osiris Story Calls ==
 
== Osiris Story Calls ==
Larian has created some shared helper code to make it easy to inform your story about the behavior of your secret dirt pile. They are located in the "''__GLO_Shovel''" file. You will need to add two calls somewhere in your story INIT section:<br />
+
Larian has created some shared helper code to make it easy to inform your story about the behavior of your secret dirt pile. They are located in the "''__GLO_Shovel''" file. You will need to add two calls somewhere in one of your story INIT sections (do not modify __GLO_Shovel directly):<br />
 
<br />
 
<br />
 
* DB_ShovelArea(_Trigger,_Reward,_DirtMound)<br />
 
* DB_ShovelArea(_Trigger,_Reward,_DirtMound)<br />
Line 52: Line 52:
 
<br />
 
<br />
 
Note that both the DB_ShovelArea() and DB_ShovelRewardXXX() calls make use of a ''_Reward'' string variable. This is the name of a reward database entry that you are creating, and when you create a DB_ShovelArea() entry, your ''_Reward'' value should match at least one instance of a DB_ShovelRewardXXX().<br />
 
Note that both the DB_ShovelArea() and DB_ShovelRewardXXX() calls make use of a ''_Reward'' string variable. This is the name of a reward database entry that you are creating, and when you create a DB_ShovelArea() entry, your ''_Reward'' value should match at least one instance of a DB_ShovelRewardXXX().<br />
 +
<br />
 +
'''NOTE:''' Regarding where to add these story calls, please become acquainted with [[Osiris_Design_Patterns#Direct_Dependencies|Osiris Dependencies]] to make sure that the __GLO_shovel story has initialized prior to your story.<br />
 
<br />
 
<br />
 
<u>Example</u><br />
 
<u>Example</u><br />

Latest revision as of 17:01, 20 September 2017

Overview

This tutorial provides an example of how to create a secret dirt pile that needs to be dug up, with a variety of possible results following (item spawn, surface appearing, voice bark, etc.). It makes use of shared resources already provided by Larian. You will need the following:

  • Root template item PUZ_Dirtpile_A_Dynamic placed in your level
  • A box trigger
  • A couple of Osiris calls in your story
  • (optional) item or creature to appear

The Dirt Pile

From the root template, place an instance of the PUZ_Dirtpile_A_Dynamic item in your level. Feel free to rename the placed instance to whatever is meaningful to you. You can then modify some behaviors of the dirt pile with the associated script by clicking on the [...] box.

Item
Scripts [1] PUZZLE_HiddenPerception [...]


Secret Dirt Puzzle Script Properties


The script variables adjust the difficulty of perceiving the mound, the minimum range, visual effect to be played, etc.

If you plan to have a specific item appear after digging up the dirt pile, a convenient place to stash it away is the inventory of the dirt pile itself. Simply add the item you want to reward to your level and then move it to the dirt pile inventory through the Items property within the Item section.

Item
Items [0] [...]


This will display a new box where you can filter by name and 'Level Items' to find the item you placed in your level.

TUT SecretDirtPile ItemAssignment.png


Simply move your placed item into the 'Assigned' window pane and the editor will move it from wherever you placed it in the level to the inventory of the dirt pile. This way you have a concrete instance of the item that can be referenced by GUID but will not be seen by any player until it is discovered through digging up the dirt pile.

The Box Trigger

A box trigger is used to inform the story scripting where a digable area exists and where to spawn any resulting objects. Select a box trigger from the Root Templates and place it on top of your dirt mound. Feel free to assign it a unique name that is easy to find later. With the trigger selected, you can then define its boundaries by selecting the "Edit Shape Bounds" Mode button on the left and dragging the corners of the trigger to cover the appropriate area.

TUT SecretDirtPile BoxTrigger.png

Osiris Story Calls

Larian has created some shared helper code to make it easy to inform your story about the behavior of your secret dirt pile. They are located in the "__GLO_Shovel" file. You will need to add two calls somewhere in one of your story INIT sections (do not modify __GLO_Shovel directly):

  • DB_ShovelArea(_Trigger,_Reward,_DirtMound)


Plus one of the following:

  • DB_ShovelRewardItemAppear(_Reward,(ITEMGUID)_Item,(TRIGGERGUID)_Trigger)
  • DB_ShovelRewardCharacterAppear(_Reward,(CHARACTERGUID)_Character)
  • DB_ShovelRewardSurface(_Reward,(TRIGGERGUID)_Trigger, (STRING)_Type, (REAL)_Radius, (REAL)_Lifetime)
  • DB_ShovelRewardVoiceBark(_Reward, (STRING)_VoiceBark)
  • DB_ShovelRewardItemTemplate(_Reward,(STRING)_ItemTemplate,(INTEGER)_Amount)


Note that both the DB_ShovelArea() and DB_ShovelRewardXXX() calls make use of a _Reward string variable. This is the name of a reward database entry that you are creating, and when you create a DB_ShovelArea() entry, your _Reward value should match at least one instance of a DB_ShovelRewardXXX().

NOTE: Regarding where to add these story calls, please become acquainted with Osiris Dependencies to make sure that the __GLO_shovel story has initialized prior to your story.

Example

INIT

DB_ShovelArea(TRIGGERGUID_BoxTrigger_hugh_pile_79c5bc2b-421b-42ff-b987-a4ac282d5444, "hugh_pile_reward", ITEMGUID_PUZ_Dirtpile_hugh_4984f867-e69e-4579-8436-b45ebdd06358);

DB_ShovelRewardItemAppear("hugh_pile_reward", ITEMGUID_Item_Hugh_8485bd59-77fb-4800-9f5d-5071707de6b5, TRIGGERGUID_BoxTrigger_hugh_pile_79c5bc2b-421b-42ff-b987-a4ac282d5444);

In this example, the first line defines a shovel area using the trigger we added to the level and associates the reward "hugh_pile_reward" with the dirt pile we placed in that trigger. The second line defines what "hugh_pile_reward" is: an item we placed in our level (Item_Hugh_[GUID]) and the trigger in which it should spawn (the one we placed earlier).