Kismet
From RoboBlitz Editor Wiki
Kismet is an easy to learn scripting language that enables designers and artists to script level functionality from within the RoboBlitz Editor.
Here's a quick glance at some simple Kismet in action:
Contents |
Theory
Kismet is an event driven language, which means that it receives an event and then executes actions which are "attached" to that event. Actions can be strung together so they happen in sequence. When one action finishes the next starts. The kismet element which is currently being executed "has impulse". The impulse travels along the action sequence. It can also be stopped by a closed gate or delayed with a timer. Elements can also set Kismet variables which can track either a pre-placed object in the map or be set to any number of objects based on the players actions.
Practice
Lets try a practical example. We'll make a map with a button that Blitz can use. When the button is used it will play a sound and a bright blue light will turn on.
Setup
Start off with a Basic Map. Use the Generic Browser to open the PROP_Hub package (or any of the other PROP_ packages which contain a button archetype). Find a button archetype and place it in your level. Now add a SpotLightToggleable to your level. Go to the spotlight's properties and edit it's LightComponent. We want to be able to see it clearly when it turns on, so crank it's brightness up to 10. Change the light's color by adjusting it's A value (Alpha) to 0, it's B value (Blue) to 255, and it's R and G values (Red and Green) to 0. In Lighting Channels check "Dynamic" so the light will shine on Blitz. You might also want to dim any other lights in the level so the blue light is more dramatic.
An Event
Select the button in your map and open the kismet window (
). Right click in the gray center section of the Kismet window and select "New Event Using RDestructible_0"->"Used" (your button might be named something other than RDestructible_0, that's ok). Whenever something uses the button this event will fire.
An Action
But nothing is setup to happen when this event fires. If you try using the button in a PIE session you'll notice you can use the button but nothing happens. Lets start with some button effects. Right click in the Kismet window and select New Action->RoboBlitz->Do Button Effects. Drag the little black "Out" tab on the Used Event to the black "Start" tab.
If you try the level out in PIE again you'll see that the light on the button now changes color when you use it. But only once. If you want to be able to use the button multiple times, select the Used Event and look in the lower left hand corner of the Kismet window. This where properties for kismet objects are displayed.
Changing the MaxTriggerCount value to 0 will allow the event to fire an infinite number of times (setting it to a number will only allow the event to fire that many times).
Toggling The Light
Now select the spotlight and right click in the kismet window. Select New Object Var Using SpotLightToggleable_0. This variable is a reference to the spotlight in your map. When the button used event fires we want to toggle this spotlight off. Right click and go to New Action->Toggle->Toggle. Drag the pink "Target" tab to the Spotlight variable and drag the "Finished" tab on the Do Button Effects action to the "Toggle".
Your light should turn on and off when you use the button. If you want the light to turn off and stay off, hook up the Do Button Effects Finished Tab to "Turn Off" instead of the "Toggle" tab.
You may notice that the light doesn't toggle until after the button effects finish. This is because the Do Button Effects action has impulse until it finishes; when it's done, impulse goes to the Toggle element and the light turns on. Lets make it so the light turns off immediately. First right click on the "Toggle" tab or the Finished Tab (or wherever you have the Toggle element connected to at this point) and select Break All Links and then connect the Toggle action directly to the button's used event. Now the light Should turn off immediately.
Another Variable
Lets try one more thing. Add a New Action->Camera->Camera Shake. Connect it to the "Finished" tab of Do Button Effects. Now hold down "O" on your keyboard and click in the Kismet window. This creates an "object" variable. Connect the object variable to the "Instigator" triangle on the button event. The instigator will set the object variable to whatever object made the event fire. In this case, it's the player who used the button. Now connect the Target tab of Camera Shake to the new object variable.
Now your button activates an earthquake!
You're ready for some More Complex Kismet







