Tuesday 7 January 2014

Door Keys

Creating keys is a good way to get the player to go to certain areas or accomplishing something within your level. Then the player use the keys to open a door and proceed to the next area.
To do that we need a mesh to act as a key and a door animation. In this example we'll use two keys:

Trigger activating key



First we set the static mesh and set a trigger on them to make them disappear when the player "uses" it, setting it up on kismet using the Toggle and Toggle Hidden nodes. Remember to link the static mesh to the node.

Code for trigger that activates key

On this example we also have a translucent static mesh to indicate where the player should put the key. To create it, just change the material type on the mesh:

Making a mesh translucent

Then you have to set up the second trigger, where the player will put the key. Just create a second trigger that will be enabled after you pick up the key. This is important to keep the player from activating it without having the key.

Code with two triggers for 2 keys

Then, when each key is activated we set an int counter, leaving A=0 and B=2. Each time a key is inserted 1 will be added to the counter and when it reaches 2 the matinee for the door will be played.

Counter check

Thanks World of Level Design for this tutorial.


No comments :

Post a Comment