Logic
Focus on gameplay mechanics and logic
- Player Spawns And Team-AI Idling
- Whisper State - Stealth and Loud
- Security Cameras
- Environmental Damage - KillZone Element
Player Spawns And Team-AI Idling
For players and Team-AI to spawn, you need to set up PlayerSpawner Elements. By default a new project already has a PlayerSpawner Element, however you should create at least 3 more so players and AI don't clip into each other when spawning.
To set up Player spawns, spawn at least 4 Player Spawner Elements at the positions you want the heist to start.
To keep things organized, you can place a MissionScript Element and let that one execute those 4 player spawns. Player Spawner need to be executed on startup, or by the startup-element.
You can place as many spawns as you want. The game will automatically spawn players and Team-AI randomly at any executed PlayerSpawner element.
A common setup is to have multiple groups of PlayerSpawner elements, with separate MissionScripts executing them. Instead of the startup element executing all PlayerSpawner at once, it executes a Random Element, which randomly picks one of the spawner groups.
To add idle animations for AI-Teammates, place an AreaTrigger over the same location as a player spawner and set it the instigator to ai_teammates
. The area trigger then executes a SpecialObjective with the animation you want. Make sure to disable the area triggers after spawning, otherwise they may accidentally trigger again mid-heist if an AI-Teammate walks through them.
Whisper State - Stealth and Loud
Whisper State determines whether or not your level is in Stealth or Loud mode. It can be toggled using the WhisperState Element.
If Whisper state is enabled, your level is in stealth mode. The AI will be idle or do the via SpecialObjective assigned animations and not engage unless they get alerted by something or someone, in which case they sound the alarm and attack the player.
Setting the Whisper state to disabled, the level will switch to loud. Civilians and manually spawned enemies will try to reach a FleePoint Element to despawn, unless told otherwise. Additionally, the game will now loop through different assault phases.
Security Cameras
To have working security cameras in your level, you first need to place the right camera props. The correct Unit you need is called gen_equipment_security_camera
. Next you spawn a SecurityCamera Element and connect it to the camera prop with the Camera unit button or by holding SPACE and clicking the unit. Below you can change what direction the camera prop is facing. AI Enabled will activate the camera and it will be able to spot players as well as loot bags or bodies. The position and rotation of the Element is not important. Execute the Element when you want the camera to be active.
To disable a camera, place another SecurityCamera Element, but with AI Enabled set to off. Executing it will disable the camera and it will no longer be able to spot anything.
Breaking the camera prop will also automatically disable it.
To be able to see through a camera, you spawn an AccessCamera Element and again link it to the camera prop. The position for this element is not important, but the rotation is. The cone must face in roughly the same direction as the camera prop, otherwise you will look in the wrong direction when accessing the camera feed.
In the Element you can give your camera a custom name that shows up in the bottom left when accessing the camera feed, as well as limit how much you can turn the camera. You don’t need to execute the Element for it to work, but you do need specific Units to access the feed, like gen_prop_security_console
or gen_equipment_camera_hackingtool
.
Breaking the camera prop will automatically disable the camera for the feed and you will see white noise when accessing it, and you can also manually disable cameras using an AccessCameraOperator Element set to destroy
.
Environmental Damage - KillZone Element
Environmental damage like fire or teargas that damage players, or even enemies in some cases, are easily set up using Area Trigger and Killzone elements.
Defining The Area
To define the area in which the damage should apply, place a Shape element and adjust the width, depth and height if needed. Multiple Shape elements can be used for more complex areas.
Set Up The Elements
Place a AreaTrigger element and link it to the Shape element. Either use the Manage Use Shape Element ID List button, or hold spacebar while clicking on the Shape element.
Using Shape elements for this is not actually required, however if more than one type of instigator (players, enemies, civilians, etc.) should be affected, multiple AreaTrigger elements are required since they can only use 1 type per trigger.
The area would need to be set up individually for each trigger element. Using Shape elements instead, the whole process only needs to be done once and any AreaTrigger element can just link to and use the Shapes.
Place a KillZone element, choose a damage type and have it get executed by the AreaTrigger.
Keep in mind that not every damage type is available to every instigator, more information on that can be found here.
AreaTrigger Settings
Depending on who should get damaged, the AreaTrigger needs to be set up differently.
Player / Team AI
For players and team AI, set Trigger On to "both", Instigator to "player" or "ai_teammates" as well as Trigger Times to "0".
This will execute the KillZone every time someone enters the AreaTrigger, activating the damage effect. When leaving the AreaTrigger, the KillZone gets executed once again, deactivating the effect.
The Trigger Times set to "0" ensures that it can execute infinitely without disabling itself.
Enemies / Civilians
For enemies and civilians, it also depends on what damage type is set in the KillZone.
If the instigator should get affected instantly when entering, set the instigator to either "enemies" or "civilians". For Trigger On set it to "on_enter" and Trigger Times to "0".
If instead a random instigator should get picked with a delay in between, set Trigger On to "while_inside" and Trigger Times to "1".
Place a Toggle element and have it get executed by the KillZone element with a short delay, for example "2.0" seconds. Link the Toggle to the AreaTrigger and set the Set Trigger Times to "1".
Extras
Here are some extra steps to enhance your KillZone experience even further.
Effects And Sounds
The KillZone and AreaTrigger elements don't have any visualization that they deal damage when entering. Signal the player that the area is dangerous using PlayEffect elements playing, for example, teargas, fire or electric spark effects.
Additionally PlaySound elements can be used to add to the immersion. A list with sound IDs can be found here.
Simply execute the PlayEffect and PlaySound elements when the AreaTrigger gets enabled and tweak the timing if needed.
Toggles
The AreaTrigger can be toggled on and off at any point during the heist to enable and disable getting damaged by it.
For example when cops fill a room on your level with teargas mid heist, or something gets lit on fire and later extinguished.