UDN
Search public documentation:

KismetTutorial
日本語訳
中国翻译
한국어

Interested in the Unreal Engine?
Visit the Unreal Technology site.

Looking for jobs and company info?
Check out the Epic games site.

Questions about support via UDN?
Contact the UDN Staff

Unreal Kismet Tutorial

Document Summary: A tutorial on using UnrealKismet to create a simple sequence.

Document Changelog: Created by Alan Willard.

Introduction

For more information on using UnrealKismet, look at KismetUserGuide or KismetReference.

Tutorial

Script creation in UnrealKismet is fairly straightforward. This tutorial assumes some familiarity with level creation in UnrealEngine 3. To begin with, we'll create a simple script that turns a light on and off.

  1. Create a simple level - just a large floor with a PlayerStart and a PointLightToggleable.
  2. Enable dynamic light on the PointLightToggleable actor (properties>Light>bForceDynamicLight=true).
  3. Drop a trigger in the world and set it to not be hidden (properties>Advanced>bHidden=false).
  4. Select the light, and open the UnrealKismet workspace by clicking the K icon in the toolbar.
  5. Right click in the Kismet workspace and create an object variable by selecting the 'New Object Var Using Selected Actor' menu option (Selected Actor will be replaced with the name of the selected actor). You should now see the icon for a light inside the object variable, along with the unique name of the light.
  6. The next step is to attach an event to the Trigger. Select the Trigger in the main editor window.
  7. Right click in the Kismet workspace and create a Touch event by selecting the 'New Event Using Trigger_0'. This is context sensitive, so you will only see events that a Trigger supports. In the 'Create Event' submenu, select the 'Touch' option to create a Touch event for Trigger_0.
  8. The next step is to assign give the event an action to execute. Right click in the Kismet workspace, and select the 'NewAction -> Toggle -> Toggle'.
  9. Drag a line from the 'Touched' output on the Touch event to the 'Toggle' input on the Toggle action. You'll notice the Toggle action has a purple node on the bottom labeled 'Target'. The inputs and outputs for components in Kismet are all color coded according to the variable type that can be used with them. In this case, Target is purple, so an object variable is needed.
  10. In this case, we want to connect the target to the light object variable by dragging a line from the 'Target' node to the object variable that we created which contains the light. This will cause the Toggle action to turn the light on or off every time it is activated. If you only wanted to turn the light on or off, you would only connect to the input associated with that action.
  11. Almost done. Select the Touch event and look at the property editor below. Since we want to be able to turn this on and off more than once, set the MaxTriggerCount to 0, which is equivalent to there not being a limit.
  12. Also set the ReTriggerDelay to a small value, such as .1, to avoid possibly triggering the event twice quickly.

When you're complete it should look like this:

kismet_tutorial.gif

Now, close UnrealKismet and play the level, either using the Build menu at the top of the editor or by right-clicking in the world and selecting 'Play from here', and hit 'P' once you're in. Provided you are still running a clean version of the ExampleGame clientspec, you should now have the default character spawned in the world and attached to your camera, instead of flying around like a ghost. Find the trigger and touch it. The light should turn off. Move away from the trigger and then back and the light should turn on! Congratulations, you've created a working UnrealKismet game script.

Another method of doing this:

You could wire the touch event to Turn Off on the Toggle, and create an UnTouch event which would then be wired to the Turn On input on Toggle. This would turn the light off only while the player is touching the trigger.

Troubleshooting

For touch events to be triggered, it's necessary to play the level using a Pawn that has collision (bCollideActors) enabled. By default the ExamplePlayerController in the ExampleGame package is in spectating mode and as such will not trigger your sequence.

NOTE: You must use a 'PointLightToggleable', this will not work with 'PointLight'. If your light isn't toggling but your kismet sequence is working, check if you accidentally used the wrong kind of light.