Triggers and Examples

From Off Grid Wiki
Revision as of 16:06, 25 July 2017 by Dominic (talk | contribs) (tidy up)

Jump to: navigation, search

Setting up Triggers

Triggers are an important part of modding because they allow the level to react and change depending on the player's actions and interactions and they have many uses, including but not limited to: conversation prompts, objective updates, and some sounds which may be activated by the player like a floorboard creak or security barrier beep.

Setting up a trigger is a simple process. Firstly in the Hierarchy tab, click Create and navigate and click on Trigger as shown below, this will place the trigger into your level.

How to create the trigger

Now in the Inspector view you will see that there are already some components added into the trigger object. At this point in time you might want to change the shape of the trigger to fit a doorway, or corridor either in the 3D View or in the Transform component bear in mind that as soon as the player has touched one part of the trigger zone, it will activate its function, hence make sure that it is suitably shaped so that it will only trigger where it is intended to be interacted with. You should also give the trigger an appropriate name relating to its function, for example I've called this trigger (see below) OfficeObjectiveStart, because as the name suggests, it will start the Office Objective when the player walks into the trigger zone. I've also made sure that Trigger Only Once is ticked because I don't want the player to reactivate the objective if they have already completed it.

An example of a possible objective trigger

Now the trigger is set up, when the player walks into the trigger zone the trigger will be activated. The only problem at this point is that the trigger isn't actually set to do anything. For us to give it a function we will need to use some Lua, the Lua we use differs for what you are trying to achieve so look at the next section for specific triggers.

Examples of Triggers


Triggering an objective


Triggering a conversation