Difference between revisions of "Secret Dirt Piles"

From Divinity Engine Wiki
Jump to: navigation, search
(Osiris Story Calls)
Line 43: Line 43:
 
   
 
   
 
  DB_ShovelRewardItemAppear("hugh_pile_reward", ITEMGUID_Item_Hugh_8485bd59-77fb-4800-9f5d-5071707de6b5, TRIGGERGUID_BoxTrigger_hugh_pile_79c5bc2b-421b-42ff-b987-a4ac282d5444);
 
  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).

Revision as of 21:10, 12 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 your mod and level.

You can modify some behaviors of the dirt pile with the associated script by clicking on the [...] box. Search the item properties of the dirt pile for the following entry:
...
[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.

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 your story INIT section:

  • 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().

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).