Triggers
by RED
Well first I will start off explain what a trigger does and is used for, if you picture a man running along then tripping a wire that sets off a alarm.
Make sure you are in Advanced mode first.
Now place a trigger (F3) and click on map Give it these settings ( pictures just to show where the selection boxes are) :
X = 50, Y = 50,
Activation : West,
Activated once,
on activation : hint "Trigger has been activated"
Now move the trigger to any place on the map and make a man next to him ( side west ) and preview in editor, now run straight into the trigger and it should come up with a message in the top right hand corner saying, "trigger has been activated"
This at the moment is not much use, you can use triggers for
most things for example,
Making a group of units wait at a waypoint before moving to next when a town
has been clear of enemies,
Make a group of men move in to a position from a radio call.
Activate a camera script.
The list goes on.
Moving a group of men with waypoints and triggers
We will now get a group of men to move using waypoints and a trigger to move to a certain place.
1. Create the group of men anywhere on the map, ( You can be
in this group or you can just make your self not part of the group so you can
watch)
2. Give them a waypoint right next to them of any type, then give them another
waypoint place on the place you want them to move to,
3. In the first waypoint change the condition field from "true" to
wp1==1,
4. Now create a trigger with Radio Alpha as its type, it doesn't matter about
the other settings now,
5. In its on activation field put wp1=1, ( note only 1 equals mark this time )
6. It should now look some thing like this,
7. now when you pre-view the mission and Radio Alpha the men should run to the
waypoint you selected them to.
Activating a script
Making a script active is pretty straight forward.
1. Place your .SQS file in the mission's directory,
2. Make a trigger ( however it is to be activated i.e.. with radio or a unit
present )
3. Then in the on activation field put : [] exec "yourscript.sqs"
4. Then run the mission and it should work, providing the script is correct.
Using a Radio Trigger to move a group of Men
To get a group of units to move into a area is the same as getting a group of men to move using waypoints and a trigger to move to a certain place but with a modified trigger,
Just instead of making the trigger have activated by radio make it activated when east ( or west ) not present in a area you put the trigger over, make the trigger larger or smaller with the X and Y parameters at the top of the trigger selection menu.
Trigger Activated by certain unit
Getting a trigger activated by a certain unit.
1. Create the person that you want to activate the trigger
place him anywhere for now
2. Make a trigger then group it with the person you just created, with the F2
button held drag from the man and drop on top of the trigger, if it worked a
blue line should of just appeared going from the trigger to the man.
3. Put : hint "Trigger has been activated" in the triggers on activation
field.
4. give the man a waypoint to the trigger and it should become active when he
enters it.
Ending a mission
In the trigger Type change it from none to End1 now select the properties you want the trigger to end the mission on, i.e. east not present, so the mission will end when all east presence had been eliminated in a set area.
List of commands that can be used in the On activation Field
Command |
Use |
unit addAction ["blowbomb","bomb.sqs"] |
Activates a script when the player selects it from the action list. |
unit removeAction 1 |
Removes the first action that is displayed on the action list. |
player addweapon "M21" |
Adds a M21 to player. |
removeallweapons player |
Removes all of players weapons |
player remove weapon "M21" |
Takes an M21 away from the player. |
[] exec "script.sqs" |
Activates a script |
hint "hello" |
Puts a hint up on the screen with hello in it. |
var1 = var1 +1 |
Adds 1 to the value of var1 |
player setdammage 1 |
Kills player |
For a complete listing of all the commands take a look at the Command Ref
Tutorial by RED