Download - Introduction to Kismet
Introduction to Kismet
Sai-Keung Wong
Reference: Mastering Unreal Technology (MUT)
Contents
• What is Kismet?• Examples
Introduction to Kismet
• A visual scripting system• Easy to use• Programming experience is not required.• Examples,– Design simple queries/tasks for players– Turn on/off light sources– Change materials of a static mesh– Activate complex event sequences
Introduction to Kismet
• A network of sequence objects ( 序列對象 )• Sequence Objects: – Define specific functions– Send signals to each other
• How to use?– Make sure you understand clearly your purposes– Then everything is easy to manage
A simple example:Turn on/off a spotlight
• Purpose: – The player touches a trigger– Turn on a spotlight
• Need to do:– Add a trigger– Add a togglable spotlight– Add a point light with low intensity (dim)– Add a start position for the player– Use Kismet to define the event sequence for the trigger and
the spotlight
• File -> New -> Additive• Create an additive brush (512x512x64)• Create the geometry using the additive brush• Create a point light– Place it at the center of the newly created
geometry and move upwards a bit– Change its intensity to 0.5– Change its radius to 480
A simple example:Turn on/off a spotlight
A simple example:Turn on/off a spotlight
• Add a trigger– Set it as visible– Press F4->Display->Hidden (don’t check it)
• Add a SpotlightToggleable ( 可開關 spotlight )。 – Content browser->actor->light->spotlight-
>SpotlightToggleable– After creating the spotlight, change its properties• Disable it (F4->light->lightcomponent->Enabled? NO)• Brightness : 4.0
• Now, create an event sequence using Kismet• Select the trigger– Open the Kismet editor– Right click (click right mouse button)->New event
using trigger_0->Touch
A simple example:Turn on/off a spotlight
• Go back to the level editor• Select the SpotlightToggleable• Go back to Kismet• Right click->New action->toggle->toggle• Then, right click
->New Object Var Using SpotlightToggleable
A simple example:Turn on/off a spotlight
• Now, connect the sequence objects by dragging lines from the connectors– Press left mouse button at one connector and move the
cursor to another connector. Then release the left mouse button
• Connect “Touched” of “Tigger_0 Touch” to “Turn On” of “Toggle”
• Connect “UnTouched” of “Tigger_0 Touch” to “Turn Off” of “Toggle”
• Connect “Target” of “Toggle” to SpotlightToggleable_0• Save, build light maps and test the game level
A simple example:Turn on/off a spotlight
A simple example:Turn on/off a spotlight
• Test the game level• When the trigger is touched, the spotlight is
turned on. • But it is not turned off if the trigger is
untouched.• To solve the problem– Go back to kismet– Click “Tigger_0 Touch”
• Change “Max Trigger Count” to 0 (infinite)
• Save and test the game level
A simple example:Turn on/off a spotlight
Max Trigger Count
• Now, add a log action to show messages to players (Misc -> New Action -> Log)
A simple example:Turn on/off a spotlight
• Input “Spotlight status is changed” in “Obj Comment” of “Log”. Save and test the game level
A simple example:Turn on/off a spotlight
Messages
A simple example:Turn on/off a spotlight
• Now, add a position for the player to start to play the game. Place it at a corner.
• In level editor– Right click->add actor->add PlayerStart
• Save and test
A simple example:Turn on/off a spotlight
Sequence Object
• Input/Output connectors• Left connectors: usually for input signals– Only one input, called as “In”– Purpose: Activates other events
• Right connectors: usually for output signals
Sequence Object
• Example: Toggle (開關)– Has many inputs, depended on the functions of
the sequence object• Example, Condition – Has many outputs– Inputs (squares) & Outputs (triangles)
at the bottom Purpose: interact with variables
Types of Sequence Object
• Event (事件)• Actions (動作)• Variables (變量)• Condition (條件)• Matinee
Events (事件) • Activate a signal to start a sequence• Something occurs in the game levels• Examples: – Players touch an object– Players toggle a trigger– Etc.
Actions (動作) • Associate with event sequences• Perform certain tasks, e.g.– Change materials of an object– Change the value of a variable– Teleport a player to other place
Variables
• Variables (變量) • Store data• Can be modified in a sequence• Example,– Use a variable to represent a player– Use a variable to represent a teleporter
Variable Types
• Boolean :红色; • Integer :青色; • Object (對象):紫色; • String (字符串):綠色; • Vector (矢量):黄色; • Union (聯合体(無類型)):白色
Conditions (條件) • For testing purpose• Based on the results, control the flow a
sequence
Matinee
• Matinee • Control Matinee sequence
Kismet Sequence Flow
• Event and action sequences – An event sequence calls an action sequence– An action sequence calls another action sequence– Etc.
• There must be a starting point for activating other sequences
• Action sequences cannot be activated themselves on their own.
Sound
• Touch a trigger– Turn on a light source– Play a sound clip• In Kismet• Right click->new action->sound->play sound• Connect “Out” of “Toggle” to “Play” of “Play Sound”
Content browser->sound cues->select a sound clipIn Kismet, “use selected object in content browser for “Play Sound” object. Save and test.
Sound• Assign two sounds for “Touched” and
“UnTouched”, respectively.
Kismet: Changing Materials
• Change the material of an object– Content browser->static mesh->select a static
mesh– Go back to level editor– Place the static mesh– Content browser->create
MaterialInstanceConstant
Kismet: Changing Materials
Create and assign a material as the parent of the newly created MaterialInstanceConstant
Define a scalar parameter named as “MaterialControl”. Set its value as 1.
Kismet: Changing Materials• Assign the newly created MaterialInstanceConstant
to the static mesh
Kismet: Changing Materials
• Now, • Create a Kismet sequence to change material
of the static mesh– Create a “touch” trigger event for the trigger
• Right click->new action->material Instance->Set ScalarParam
Kismet: Changing Materials
1. Create two “Set ScalarParam”.2. Set the Scalar value of one as 1.0
and another as 0.0.3. Set the Param Name as
“MaterialControl”.4. Set the Mat Inst as the newly
created MaterialInstanceConstant
Kismet: Changing Materials
Kismet: Changing Materials
Kismet: Changing Materials
• Save and test
• Delay action
Touch the triggerto change the material.
After 3 seconds,the material is changedback automatically.
Kismet: Changing Materials
• Level startup event
Simple Example: Spawn
• actor 的 spawning (生成)• Examples, create enemies– Spawn enemies on demand– Spawn static meshes
Simple Example: Spawn
• Add navigation points– Actor->pathnode– Add around five.
• Then we will assign them to the factory spawn points
Simple Example: Spawn
• Create a trigger• In Kismet, Create New Event using Trigger_0 >
Used (使用)事件。 (press E to use in game)
Simple Example: Spawn
• Right click at an empty region next to “Trigger”
• New Action > Actor > Actor Factory 。 • Connect “Trigger”::Used to Actor Factory ::Out
Simple Example: Spawn
• Now, define the type of the actor when spawn
• Select Actor Factory– At the property dialogue of Factory– Click “create New Object”• Select ActorFactoryRigidBody (刚体 Actor 组件工
厂)。
Simple Example: Spawn
• b. uncheck bBlockActors (阻挡 Actor )
• c. select StaticMesh (静态网格物体) in content Browser
• Now, set the spawn position• a. Actor Factory->SpawnPoints->Add New
Item for 5 times. (5 items)
Simple Example: Spawn
• Assign positions to spawn points.– Select a pathnode– Then in factory property dialogue, click “use
selected object in content browser” at spawn point
Simple Example: Spawn
• Create an integer variables and connect it to Log and ModifyObjectList. Save and test.
Simple Example: Spawn
• Press ‘E’ to use a trigger.• Static meshes are created• Display messages
• The objects can be destroyed. • Create a trigger for destroy
Simple Example: Spawn
Kismet Sequence Comments
• ObjComment (对象注释)属性
Example: Changing Lights • In level editor. Use additive brushes.• Create two geometries using additive brushes• Add a trigger and a light source• Add some static meshes of interpActor, i.e.
InterpActor_0, InterpActor_1, InterpActor_2, InterpActor_3, InterpActor_4,
Example: Changing Lights
• Select the trigger• In Kismet• Right click->New Event Using Trigger_0->Touch• Right click->New Action > Toggle > Toggle Hidden 。
• Right next to the newly created “Toggle Hidden (开关隐藏)” , Right click->New Variable > Object > Object List 。
Example: Changing Lights
• Select Object List (对象列表)变量In property dialogueObjList (对象列表)属性 ->Add New Item (添加新项目) for five times. So there are five items.Input the followings:
[0]: interpActor_0 [1]: interpActor_1 [2]: interpActor_2 [3]: interpActor_3 [4]: interpActor_4
Example: Changing Lights
• Now, connect the lines such as follows:
• Now, the static meshes can be hidden.• Save and test.• Add “log” action for debug if necessary.
Example: Changing Lights
Example: Changing Lights
• Now, we lit a set of light sources one by one.• In level editor• Create five toggleable light sources.– Disable them. Light->lightcomponent->Enabled? NO– Assign different colors.
Light-> lightcomponent->lightcolor
• Create a trigger.• Note: the static meshes are selected and
hidden (Hide Selected)
Example: Changing Lights
Example: Changing Lights
• Assign different colors to light sources
Example: Changing Lights
• Now, lit the light sources one by one• Each light source is lit for 1 second and then disabled.• Select the second trigger• In Kismet• Right click->New Event Using Trigger_1->Touch.
– Make sure it’s Max Trigger Count = 1• Right click->New Action->Toggle->Toggle• Right click->New Action->Misc->Delay• Right click->New Action->Toggle->Toggle• Note: copy and paste (CTRL-C, CTRL-V)
Example: Changing Lights
• Click “Delay” and set the duration.
• Connect Toggle::Out-Delay::Start-Toggle::TurnOff
Example: Changing Lights
• Copy and paste Toggle-Delay-Togglefor four times.Select them and CTRL-C and then CTRL-V
• Connect Tigger_1::Touched - Toggle0::TurnOn
Togglei::Out – Togglei+1::TurnOn
Example: Changing Lights
• Now, add toggleable lights to toggle::target.Select a toggleable lightIn Kismet, at Toggle::target, right click->New Object Var Using xxxToggleable_?
Save and test.
Make surethe triggersare visible.
Example: Changing Lights
• Can you lit the light sources in cycles forever?
Save and test.
Make surethe triggersare visible.
Easy right?
• Then what happen if the trigger can be activated infinite times?
Example: Changing Lights • Try switch.
Link to Activated: Indices, starting from 1 (not Zero) .
Teleports
• In Level editor• Create some triggers• Create a teleporter at each trigger– Actor->Navigation point->teleporter-
>UTTeleporter• Create a particle system
at each teleporter
Teleports
Variable::player
Save and test.
Teleports
Teleports
Summary
• Learn Kismet• Change materials• Toggle lights• Understand the logic sequence of the tasks• Build the sequences• Use “Log” sequences for the debugging
purpose