RealMods > Mapping tutorial >Tactical Ops 2 mapping, S_Triggers and Dispatchers (A sliding door)
06/08/2001 - By Neuro

-1-

This tutorial will describe a sliding door, controlled by 2 buttons. Pushing 1 of the 2 buttons will open (or close) the door completely.
I'll here focus on the "control" aspect, not the way to build this door.

Pre-required :
- You know UnrealEd2 basics and how to make basic movers and UnrealEd2 basics.

As I'm lazy tonight, I'll use a TacticalOps 2.0 official map I made, RMS Titanic, because there is sliding doors in :)
Note thats its nearly the same for a standard rotating door, the mover is rotating instead of sliding.

-2-

Objects needed are :
- 1 Mover (the door)
- 2 S_triggers (TacticalOps specific actor)
- 1 Dispatcher (Standard UT actor)

So here's a sliding door fully operational. I moved buttons and removed useless brushes, so its clearer :



By default (keyframe #0) the mover is closed, and opened when reaching the keyframe #1. You set keyframes (positions) by selecting the mover, right click, then "Movers", then choose a keyframe (Usually #0 or #1) and place the mover.
A sliding door need only 2 keyframes. Here's the mover properties :



Tag = firedoor1 : It's the *name* of the door. The door will move each time an object having "firedoor1" in the Event field is triggered.
MoveTime = 8 : 8 secondes for the door to be fully closed or opened.
InitialState = TriggerToggle : Means that this door is controled by triggers, it won't open if you touch it.
MoverEncroachType = ME_CrushWhenEncroach : The door will crush the player if trying to cross when the door is closing. An annoying bug make that you can be crushed too when the door open, so be careful :)
You can add sound with opening the Sound browser, choosing sounds in UT packages, then clicking "Use" in the choosen field.

An eye-candy detail can be 2 llittle movers, physical buttons that move when you press hit the "use" key. Its simple movers, with "firedoor1" as tag, so it move same time as the door.

-3-

Note that this door could be controled by simple S_triggers, with "Event" = "Firedoor1", and without using a Dispatcher.
But then a major problem will appear : When a player push a button, a 2nd player can quickly push the other button, on the other side, and then reverse the movement. And then no way for the 1st player to cross this door, campers paradise :)

So what we need is a trick to force the door to open completely, even if a button is pressed while closing or opening.
A Dispatcher is "Da Guy for this job". This actor can trigger up to 8 events at various delays.

First, 2 triggers are needed, 1 each side of the door. Its S_Trigger actors, that can be found in the "Triggers" class of the main Tactical Ops 2 system package : UnrealTournament/TacticalOps/System/s_SWAT.u



InitialState = OtherTriggerToggles : Means that this trigger can be enabled or disabled by other triggers. Maybe its confusing for now, but it's very simple, see later :)
TriggerType = TT_Use will enable bUseRadius. The player will have to press the "use" key to activate the button.

This S_trigger was copy/pasted to have 2 buttons, 1 each side of the door of course.
Both S_triggers are PERFECTLY SAME, excepting the name, but no one cares :)

-4-

Last actor is a Dispatcher (it's in the "Triggers" class, a standard UT actor) :



This is how it works :

- A player push 1 of the 2 buttons with the "use" key.
- The S_trigger launch an "firedoor1_d" event, it trigger the dispatcher (Because the dispatcher got "firedoor1_d" in the "Tag" field).
- The Dispatcher starts *counting*, and after a delay of 0.00 secondes, it launch a "firedoor1_t" event. This event disable the 2 buttons, because S_triggers got "firedoor1_t" in the "Tag" field. From now, both buttons are disabled.
- After 0.02 secondes, the Dispatcher launch the "firedoor" event, and the door start to open (or close), 8 secondes needed.
- After 10 secondes, a "firedoor1_t" is launch again, to re-enable both buttons. Note that buttons are disabled during 10 secondes while the door needs only 8 secondes to move, but it's to avoid timing problems.

Or differently said :

- Each button trigger the dispatcher.
- The dispatcher disabled both buttons, move the door, and once all is done it re-enabled the 2 buttons.

In the Titanic map, I also use a Dispatcher it to initialise stuff at the beginning of each round. It open all doors, and runs the smoke at chimnies, *puf!* *puf!*

V
oila :]

You can send me comments or suggestions here.