Sandbox 2 Manual
ContentsIndexHome
PreviousUpNext
How to Set Up the Basic Game Logic

How to Set Up the Basic Game Logic

 


Overview

The following walkthrough gives you an overview how to setup a simple mission, defining a place where the level starts, one objective and a load next level trigger. 

The more non-linear your mission objectives are, the more time you need to spend testing them, so we recommend for starters to make a linear gameplay path: 1st objective complete triggers 2nd objective, triggers mission end. 

Adding a Spawn Point

From the Objects/Entity section of the RollupBar drag from the Others folder the SpawnPoint entity to a point in the perspective viewport. 


Triggering Events

 

Proximity Triggers

You can use Triggers to activate various actions in the editor. Here, we will go over 2 main ones – ProximityTriggers and AreaTriggers. You can drag to the perspective viewport Triggers in the usual way in the RollupBar


Placing an Area Trigger

 

An AreaTrigger is split into 2 parts, the area and the Trigger. The Trigger is placed in the usual way. 


Next create a Shape using the Area tool (found in the RollupBar in the Objects Type sub-menu) by clicking at 4 different spots and double-clicking to close the shape. Assign the AreaTrigger to the Shape using the Pick function while you have the Shape selected. 


Adding logic to Triggers

Creating a Flow Graph

 

To define what a Trigger should do, a Flow Graph needs to be created. Select your Trigger, then click on the Create button in the Flow Graph section of the Entity properties. 


Specify a group name for your Flow Graph. It is good practice to organize your level in layers, then give your Flow Graph a name which contains the layer it mainly affects. 

 


Adding an Entity to your Flow Graph

 

In the Flow Graph window right mouse button click(right-click) the empty field in the middle. 


Select Add Selected Entity from right-click menu. 


Make sure the ProximityTrigger Node can be seen, by zooming in with the mouse wheel or by setting Fit Graph To View


The ProximityTrigger Node has on the left side the input events and on the right side the output events. 


Adding a Mission Objective

 

Drag the MissionObjective entity to a place in the level where the player should go to. 


Open up the Flow Graph you created previously and then select your MissionObjective Entity in the perspective view. 

Now, add the MissionObjective to the Flow Graph by right-clicking in the Flow Graph's main window and selecting Add Selected Entity


Connecting entities together in Flow Graph

 

Now, move your MissionObjective object next to the ProximityTrigger by clicking and dragging the object frame. 

Once it is it in place, click on the Enter port in your ProximityTrigger, hold the mouse button down, and drag the mouse to the Activate port in your MissionObjective


The Mission Objective has several other input and outputs: 

Activate: 0 means objective is not activated and 1 mean it is activated. 

Completed: Marks an objective in the PDA as completed 

Deactivate: Removes an objective from the PDA 

Failed: Marks an objective in the PDA as failed 

SilentActive: Activates an objective without marking it on the PDA 

SilentDeactivate: Deactivates an objective without marking it on the PDA 

 

Loading a new mission

 

Once the player has finished his objective, let's load the next level (obviously you could trigger another objective after the first one, but for our test, lets load the next level). 

 

  1. Place another ProximityTrigger and create another Flow Graph on it.

 

  1. Add the MissionObjective node to this Flow Graph.

 

  1. Connect the Enter out port of your ProximityTrigger with the Completed in port of the MissionObjective.

 

  1. Now, add a Mission/EndLevelNew node.

 

  1. Connect the Completed out port to the trigger port of the EndLevelNew node.

 

  1. Select the EndLevelNew node and specify the name of the level that should be loaded in the Inputs field.

 


 

Result

When the player walks into the trigger the next mission is loaded. Note: This only works in real game mode - the Editor will not load the next level. 

You will get a warning in the console instead: [Warning] CCryAction: Suppressing loading of next level 'levelname' in Editor!

Copyright © 2008 Crytek GmbH. All rights reserved.