OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: NightJay0044 on 26 Mar 2009, 05:51:28

Title: Switch Trigger (Solved)
Post by: NightJay0044 on 26 Mar 2009, 05:51:28
Hi I have a switch trigger like this in-game..

--------------
TRIGGER
--------------

Type: Switch
Coniditon: C1 in Helo2 && C2 in Helo2 && C3 in Helo2 && C4 in Helo2 && C5 in helo2
On Activation: p2 say "A9"; p2 say "A10"

-----------------------------]

It's a switch trigger because it has to make the waypoint "Destroy" switch to "Get Out"
Trigger is linked to a destroy waypoint, the next waypoint for destroy is getout.

I have the trigger Synced to the "destroy" waypoint.

When I play my mission, it doesn't say the sound I want, basically trigger doesn't work, the waypoint still stays the same "destroy" or "wait for others" after destroy after all the soldiers are in the helo..

Why is this, is the synced linked to the wrong waypoint is  it supposed to be at the "Get Out" waypoint?



Title: Re: Switch Trigger not working
Post by: zwobot on 26 Mar 2009, 09:26:54
I'm not sure if Switch triggers work with every waypoint type. I usually only use them with HOLD and CYCLE waypoints.

Try to use the Switch trigger with a less complex condition for testing, like Radio alpha activation...
Title: Re: Switch Trigger not working
Post by: Ext3rmin4tor on 26 Mar 2009, 09:51:45
They should work with every waypoint, I tried them also with SEARCH AND DESTROY and MOVE. I don't know if DESTROY is a particular case since it requires to be attached to an object in order to work properly and it requires the object it is attached to is destroyed to skip to the next one.
Title: Re: Switch Trigger not working
Post by: Walter_E_Kurtz on 26 Mar 2009, 15:26:00
I know what this has to do with  :whistle:

Don't make it a Switch trigger - a simple None should work fine. The waypoint will then wait for the conditions to be fulfilled and then move on to the next one. The disadvantage is that, in Cadet mode, the waypoint will show as "Waiting for Others" (which is true to a certain extent) rather than "Destroy".

You could try putting two triggers close together in the area in question. Make the first one Destroy, so that the player knows he has to find targets in that area. Once nearby vehicles have been wiped out, it should permit the player to move on to the second. For simplicity's sake, make that Destroy also and sync it to the trigger.

From the player's point of view, he's told to fly somewhere and destroy enemies in that area. Once accomplished, he has to wait for C1 - C5 to board their heli. Then he can fly home and get out.


Furthermore, the trigger condition will need reviewing in case one of them is killed. I suggest:
(count crew heli) == ({alive _x} count units bunch) + 2
Title: Re: Switch Trigger not working
Post by: NightJay0044 on 27 Mar 2009, 00:53:09
So I put

Quote
(count crew heli) == ({alive _x} count units bunch) + 2

in the condition field instead of the C1 in helo and so forth?

Title: Re: Switch Trigger not working
Post by: Walter_E_Kurtz on 27 Mar 2009, 02:25:58
Yeah.

I should have said: bunch stands for the name you've given the group, through the init line
bunch = group this

You'll have to change it to what's appropriate. It compares how many people are aboard heli2 (including the pilot & gunner), with the number of people in group bunch plus two (for the driver & gunner).
Title: Re: Switch Trigger not working
Post by: savedbygrace on 27 Mar 2009, 03:20:04
You could have simply taken all of the information within the condition and OnActivation fields of the switch trigger and inserted them into the condition and OnActivation fields of the "Getout" waypoint.

A switch trigger is usually only needed to break a "Cycle" waypoint.

The group would reach the "Destroy" waypoint and wait until the condition(s) are met in the "Getout" waypoint before moving to it and thus activating it.

I have never had problems with multiple conditions so long as the syntax is correct.
 and just as a shot in the dark you could try this, if the above does not work......
Code: [Select]
(C1 in Helo2) && (C2 in Helo2) && (C3 in Helo2) && (C4 in Helo2) && (C5 in helo2)

And as Walter stated,
Code: [Select]
(count crew heli) == ({alive _x} count units bunch) + 2 is a better code(though I am not sure what the +2 represents) to use unless your sure all of the units affecting the condition will remain alive

Title: Re: Switch Trigger not working
Post by: NightJay0044 on 27 Mar 2009, 04:14:41
Grace, with your code or the one i originally had but you enhanced. Won't it be reliant on each soldier boarding the helo?

Quote
(C1 in Helo2) && (C2 in Helo2) && (C3 in Helo2) && (C4 in Helo2) && (C5 in helo2)

Title: Re: Switch Trigger not working
Post by: ProfTournesol on 27 Mar 2009, 19:34:02
Hi,

to check if all units of a group are in a vehicle, whatever other peoples that could be inside it (driver, gunner, other cargos etc...), the following code works well as a condition :

Code: [Select]
"_x in crew name_of_vehicle" count units name_of_group == count units name_of_group
Title: Re: Switch Trigger not working
Post by: savedbygrace on 27 Mar 2009, 20:06:10
Grace, with your code or the one i originally had but you enhanced. Won't it be reliant on each soldier boarding the helo?

Quote
(C1 in Helo2) && (C2 in Helo2) && (C3 in Helo2) && (C4 in Helo2) && (C5 in helo2)



Yes, here is my qoute afterwards...
Quote
(count crew heli) == ({alive _x} count units bunch) + 2 is a better code(though I am not sure what the +2 represents) to use unless your sure all of the units affecting the condition will remain alive

So you use your original code only if you know for certain that those units will remain alive.
Title: Re: Switch Trigger not working
Post by: NightJay0044 on 28 Mar 2009, 03:09:53
Thank you all, the code;

Quote
(count crew heli) == ({alive _x} count units bunch) + 2

Works perfect.