WoLD Archives Search About Contact

World of Level Design

Tutorials to Becoming the Best Level Designer and Game Environment Artist (since 2008)

UDK: Bools - Puzzle Design and Interaction

Category: UDK
April 11, 2012

Following article was written and contributed by Pete Bottomley.
Pete is a co-founder of White Paper Games.

UDK Scripting Series by Pete Bottomley:

Intro to Kismet
Moving Doors
How to Pick Up and Place Item
How to Trigger Material Instances
How to Spawn Bots in Kismet - Part 1
How to Add Functionality to the Bot - Part 2
Bot Functionality Final Touches - Part 3
Bools - Puzzle Design and Interaction
Cinematics Introduction Part 1/2
Cinematics Introduction Part 2/2
Using Console Commands as Gameplay Elements
How to Prototype Quick Time Events in Kismet

This tutorial was created to give you a basic understanding of how to use Bools in interesting ways. We've created a setup for a puzzle where we can rotate large wheels into place to get a specific order. This type of setup could be used where you might have images that you have to align in a sequence to fire off an event.
In this Bools video you'll learn:

  • How to use Bools in interesting ways
  • Use Logs to test your progress
  • Compare bool states
  • Add backup sequences
  • Create a continuous Matinee

1. We'll start by adding the actors to the scene that we need. I added a wheel mesh, a trigger and a PointLightToggleable. The wheel mesh was from StaticMesh 'HU_Deco3.SM. Mesh. S_HU_Deco_SM_VentWheel01' , I didn't change any of the trigger properties apart from to turn off Hidden in Display for debugging in the editor. I also turned off Enabled on the Pointlight and gave it a bright vibrant colour. I also converted the wheel mesh to a Mover and changed collision to BLOCKALL.

2. Open up Kismet and select the first Trigger in the sequence. Right Click - New Event Using Triger_X - Used. Turn off Aim to Interact, change the Interact distance if you wish and also set Max Trigger Count to 0. Select the first wheel mesh and create a new Matinee (LMB + M). Create a New empty group called Wheel. Add a movement track and change the length of the track to 1 second. Add a second key at 1 second (Enter) and rotate the wheel -73.13. I have used this rotation because this is 1 turn of the wheel. If you had 4 sides, you may want to rotate it 90 degrees for example. Close Matinee and in the Matinee properties tick Rewind on Play and No Reset on Rewind. This will allow you to constantly rotate the wheel without it starting from the first position.

3. We now need a way to detect how many times the wheel has been rotated. For this we will use a switch. Right click - New Action - Switch - Switch. Change the link count to 5 (this is the amount of times it takes to rotate 360 degrees) and tick Looping. The way the Switch works is that every time the player Uses the trigger, it will fire off each input in sequence. So when Link 1 will first fire off and then if the player Uses the trigger again it will fire off input 2 and so on.

We also need to create 3 Bools. To create them hold B and left mouse click. Alternatively you can Right Click - New Variable - Bool. In the Var name of each Bool name them Wheel01, Wheel02 and Wheel03 and make sure they are all set to false.

Now we need to change a Bools state when the wheel is in place. To do this, Right Click - New Action - Set Variable - Bool. Right click on the Value tab and create a New Bool Variable. And change the value from 0 to 1 to make it True. Create a named variable (N + LMB) and in the Find Var Name field in its properties type Wheel01. If you named your Bools correctly, this should now have a tick in the box and it will be linked with the Wheel01 variable. Set this to the target.

Optional: So that we know when the wheel has been turned to the correct location we can add indicators to the player. In this example we added a Light, a Sound and a Log. In the Log (LMB +L) I gave it a comment of In Place so that a message would appear on screen. I added a toggle to the Out of the Bool and turned on the PointLightToggleable. I also added a Play Sound (S + LMB) and used the sound SoundCue 'A_Interface.menu. UT3MenuCheckboxSelectCue'

click on image to view full size

4. Next we need to add a backup for if the player moves the wheel out of of the sequence. We need a way to set the Bool back to False. To do this we can copy the Bool action with its Value and Target and Paste it above. Connect a link from Link 2 on the Switch to the In of the new Bool action and in the Out of the action connect that to Turn Off on the Toggle. Change the Value from True to False. This means that if the player uses the Trigger again, the value will go back to False and turn off the light.

click on image to view full size

Comment your sequence Wheel01 and then copy and paste the sequence twice. Renamed each section Wheel02 and Wheel03 accordingly so that you now have 3 versions of the same sequence.

You need to update the actors in the sequence in order to update them to the new actors. Select the second trigger in the sequence in your level, right click on the second trigger in Kismet (in your Wheel02) section and Assign Triger_X to Event. This will update to use your second trigger. Do the same for the following:

  • Trigger
  • Wheel mesh
  • PointLightToggleable
  • Named Variables

You will need to change the two named Bool Variables from Wheel01 to Wheel02. Make sure you update both of them. You only want Wheel01 Bools in the Wheel01 section, Wheel02 Bools in the Wheel02 section etc.

You should now have three sequences (1 for each wheel) and you should be able to play it in the editor. Test it out and make sure that for each Trigger you use the green light comes on and a message says In Place. If it does not, go back and make sure all of your Actors have been updated to use the new Actors.

We now need a way to compare when all three wheels are in place. To do this we can create a Remote Event. Hold R and Left Mouse Button, give the Remote Event a name of Compare and press enter. Move the two actions away from the sequence to the right. The action part of the Remote Event should be plugged into the True Bool of each sequence. You can copy and paste this action two more times so that 1 is hooked up to each one of the Bool actions. You do not have to copy the Event of the Remote Event as you will only need 1 of these.

click on image to view full size

We now need to create a compare Bool next to the Event of the Remote Event that is away from the other sequences. Right Click - New Condition - Comparison - Compare Bool.

Hook up the Compare Bool to the Remote Event "compare". We need to create the Bools we are comparing. To do this create 3 Named Variables (N + LMB) and name them Wheel01,02,03. Make sure they all have ticks and connect them to the Bool tab of the Compare Bool.

The reason we have the compare action connected to the Bool action in the previous sequence is that everytime the Bool turns True it will check if the other 3 are also true. We need this Compare on all 3 wheels to always check when they are true. Since they are all False by default the True of the Compare Bool in the image above will fire off only when all three Bools are true.

You can put whatever action or event at the True output of the Compare Bool, for example you could open a door or spawn a bot. For now we have just created a Log (L + LMB) so that we can see that the system is working.

5. Now that we have the system working, make sure you comment everything and clean up any crossed wires. We added the Light, Sound and Log into the Wheel sequences for our testing, ideally you wouldn't have these things in the game because the player could cheat and just turn the wheel until they heard a sound so you may want to remove these.

You can also change the Switch so that it's not the first wheel rotation that puts it in place. Just move the Link outputs down to which one you want it to fire off.

For example if you change it to use Link 4 and 5 then the 4th time the wheel is rotated it will be in place. Play around with the sequence and see what works best for you.


Subscribe to receive NEW/UPDATED and FREE "UE5 Beginner's Quick Start Guide" PDF (90 pages).

Subscribe and Get Free UE5 PDF Guide

Visit this page for more info about the guide...

Follow WoLD





About World of Level Design

My name is AlexG. I am self-taught level designer, game environment artist and the creator of World of Level Design.com. I've learned everything I know from personal experimentation and decades of being around various online communities of fellow environment artist and level designers. On World of Level Design you will find tutorials to make you become the best level designer and game environment artist.

Read More »

Home Terms of Use/Trademarks/Disclaimers Privacy Policy Donate About Contact

All content on this website is copyrighted ©2008-2024 World of Level Design LLC. All rights reserved.
Duplication and distribution is illegal and strictly prohibited.

World of Level Design LLC is an independent company. World of Level Design website, its tutorials and products are not endorsed, sponsored or approved by any mentioned companies on this website in any way. All content is based on my own personal experimentation, experience and opinion. World of Level Design™ and 11 Day Level Design™ are trademarks of AlexG.

Template powered by w3.css