Tutorials about Treasure Chests

Creator: LadylexUK
Type: Prop and Prop Brain design

How to: change the treasure, stop the chest being destroyed, have loot thrown out, shut the chest, remove the fx, create a custom chest, have a locked chest, have a locked chest with forced opening mechanism, make a chest monster

The Treasure Chest prop is one of the most used props. It is a domed wooden chest which when powered on, opens its lid, creates a coin (within a blue flame special fx) which rises out of the box, the chest then disappears in a puff of blue smoke leaving the coin at chest height.

Here is the kode for it

  1. WHEN [not][has power]
  2. …WHEN [interacted] Do [power on] //so when player interacts with it the power is turned on and the chest opens
  3. WHEN [has power]
  4. …WHEN [once] DO [objvar:treasure][equals][create][obj:Coin][at position][position] // creates a coin
  5. …/…WHEN DO [play fx][fx:Energy Burst B]
  6. …WHEN DO [objvar:treasure][move][in direction][world up][with flying][at speed][0.025] // raises the coin out of the chest
  7. …WHEN [countdown timer][2]
  8. …/… WHEN DO [play fx][fx:Poof]
  9. …/… WHEN DO [destroy] // destroys the chest

Changing the treasure
Change line 4 so instead of a coin you could have a sword, or a gem,or a key. Your choice. You can use an object from the gallery or use In World Picker. However you will notice that unlike the coin the new item may not stop rising when the chest is destroyed.  To change this alter the speed in line 6. For a sword I found 0.01 was ideal.

Stopping the chest from being destroyed
Remove lines 6-9
If you do not remove line 6 the coin will continue to rise out of the chest.
You may not like that the coin is created within the chest. Change line 4 to make the coin appear higher:
4…WHEN [once] DO [objvar:treasure][equals][create][obj:Coin][at position][above]

Have the coin thrown out at you instead of bumping it

3 WHEN [has power]
4…WHEN [once] DO [objvar:treasure][equals][create][obj:Coin][at position][position]
5…/…WHEN DO [throw][objvar:treasure][at][player]
6…/…WHEN DO [play fx][fx:Energy Burst B]
7…WHEN [countdown timer][2]
8…/… WHEN DO [play fx][fx:Poof]
9…/… WHEN DO [destroy]

Variation: Thrown and then the chest shuts

3 WHEN [has power]
4…WHEN [once] DO [objvar:treasure][equals][create][obj:Coin][at position][position]
5…/…WHEN DO [throw][objvar:treasure][at][player]
6…/…WHEN DO [play fx][fx:Energy Burst B]
7…WHEN [countdown timer][2]
8…/… WHEN DO [power off]
9…/… WHEN DO [switch page][2] // there is nothing on page 2 it just stops the chest from being interacted with again

Removing or altering the flame special effect
If you choose to have your chest open and then appear empty, the special effect that appears in the bottom of the chest ruins that effect. Unfortunately the blue flame effect that appears when the chest is opened is not part of the brain kode, it is the animation of the chest itself and cannot be turned off. However you can alter its color and transparency so you cant see it. Go to Edit>Properties>Appearance>Effect Tints and turn all the tint channels to transparent (thats the meter under the color block).

The chest now opens and shows its coin without the flame effect. You can leave this as it is, or you can then add your own effect to the chest. For example the bubble effect (good for underwater chests)

4 WHEN [has power]
5. …WHEN DO [play fx][fx:Bubbles]

Or you can alter the effects appearance using color. A nice red flame looks good.

Creating your own chest
Use the Treasure chest as a base. Make it invisible.
Attach whatever you are using for a lid to the top of the chest (I used an ancient grate)
Attach whatever you are using for the bottom to the base of the chest (I used an Ancient pillar base)
Make the effects transparent.
To get my coin to appear in the exact position I wanted I also included a Logic cube which I placed where I wanted the coin to appear. It appears just after the lid has opened. Logic cubes are invisible by default.
Change brain in chest to:

3 WHEN [has power]
4 …WHEN [countdown timer]
5…/…WHEN [once] DO [objvar:treasure][equals][create][obj:Coin][at position][IWP: logic cube][position]
6…/…WHEN DO [destroy]

You can add any effects to this that you want. I suggest you use the brain of the logic cube for this so the special effect is in the correct position and is not affected by the destruction of the real chest.

Locked chests
The easiest way to create a locked chest is to place the Locked door assembly in your world and swap the mesh on the door for the chest. Job done. However, there is now nothing in the treasure chest. Remember to the add the kode from the treasure chest from line 3 onwards.

Force open chests
In the new Tomb Raider there are locked chests that you need to force open with a crowbar. This kode gives you a meter above the chest and you need to press buttons to fill the meter and open the chest.

WHEN [in trigger zone][player] DO [objvar:my player]{equals][it]
…WHEN DO [objvar:myplayer][boolvar:opening chest][equals true]
…WHEN DO [display meter][XP meter][numvar:meter][max][50][above]
…WHEN DO [display][X][above]
…WHEN[button:X][pressed] DO [numvar:meter][increment by][5]
…WHEN [countdown timer][0.3][loop]
…/…WHEN DO [numvar:meter][decrement by][4]
WHEN [numvar:meter][equal to][50] DO [power on]
WHEN [has power] DO [objvar:my player][boolvar:opening][equals][false]

Create an emote with your kinect with your player bent over looking like they are forcing the chest open. Call it “open chest”.

In the player brain

WHEN [once] DO [boolvar:opening][equals][false]
WHEN [boolvar:opening][equal to][false]
…WHEN [button:X][pressed] DO [attack]
WHEN [boolvar:opening][equal to][true]
…WHEN [until][boolvar:opening][equal to][false]
…/…WHEN [button:X][pressed] DO [emote][KInect:open chest]

If you do not have kinect capabilities then try an emote like “give”

The player will have to keep pressing x to fill the meter. If they stop the meter will empty. When they hit the maximum the chest will open.

Create a chest monster
You can make a fun character from the chest. Place a goblin. Attach boots to his feet. Attach the chest to his middle. Turn goblin invisible.

In the chest brain.

  1. WHEN DO [power on]
  2. WHEN [countdown timer][0.5] SO [switch page][2]
  3. WHEN DO [pace][equals][5]

page 2

  1. WHEN DO [power off]
  2. WHEN [countdown timer][0.5] SO [switch page][1]
  3. WHEN DO [pace][equals][5]

This will make the chest open and close menacingly like a mouth. Add some evil looking teeth from rocks or other props (maybe even a tongue) and some eyes if you like.

Comments are closed.

Website Powered by WordPress.com.

Up ↑

%d bloggers like this: