Jump to content
Sign in to follow this  
TAW_T-Bone

Howto trigger set off for 2 units?

Recommended Posts

I am looking and reading and can't find it.

i want a trigger to go off when 2 vehicles went through the trigger.

And then as action come up with a text to show to all clients that those 2 vehicles are coming. vehicles are run by players no AI's.

Share this post


Link to post
Share on other sites

Place a trigger and have in the condition:

{typeOf _x in ["Mytruck","mytruck2"]} count thislist > 0

Have the vehicle types in the list it checks through. You could have lots of different things here aswell, say you named the vehicles in the editor.

{typeOf _x in [Vehicle1, Vehicle2]} count thisList > 0

Basically what it does, is counts how many true statements are returned from that loop.

ie.

If the trigger has a man, a car and a tank in the activation field.

ThisList = [man, car, tank]

and

MrX = man

{_x == MrX} count thistList > 0

Would return 1 as there is 1 unit that is equal to MrX in the array "ThisList".

Hope that helps?

Share this post


Link to post
Share on other sites

should i leave "this" in the condition cause when i hover over the trigger in the editor it has a ? infront of the line.

I got in condition: {typeOf _x in [tank1, tank2]} count thisList > 0;

I got as action: hint "tanks are moving in"

When i drive both tanks through it doesn't say anything.

Share this post


Link to post
Share on other sites

The pure trigger-based way, OFP old school :

name your 2 vehicles "vec1" and "vec2"

create 2 triggers.

In condition of 1st trigger :

({(vehicle _x) == vec1} count thislist) > 0

In condition of 2nd trigger :

({(vehicle _x) == vec2} count thislist) > 0

Create a LOGIC

add a Waypoint to your logic, type "AND". Synchronize this waypoint with the 2 triggers above

add another waypoint somewhere away for your LOGIC. Create a 3rd trigger containing the last LOGIC waypoint, group this third trigger with the LOGIC. Go into "effect" tab of the trigger, add some text with the warning you need to print on screen.

Edited by whisper

Share this post


Link to post
Share on other sites

tank1 in thislist && tank2 in thislist

on act: hint "tanks coming"

Share this post


Link to post
Share on other sites

Vehicles are empty at mission start, not sure the simplest way works fine

Share this post


Link to post
Share on other sites
{vehicle _x == tank1 || vehicle _x == tank2} count thislist > 1

Share this post


Link to post
Share on other sites

That is Rommel's solution :)

Now, second problem : what if both vehicle goes through the trigger, but not at the same time?

Share this post


Link to post
Share on other sites

In that case you'd want 3 triggers probably. One to check if veh1 went through and to set a variable to true, another to check if veh2 went through and to set another variable to true (or add to the first) then a third to check when those variables are true (or the variable is > 1 or something) and trigger whatever you'd wanted to happen.

Share this post


Link to post
Share on other sites
Now, second problem : what if both vehicle goes through the trigger, but not at the same time?

2 triggers, which can set a bool var true, or just do nothing and you use triggerActivated on the 3rd one that shows the message. No need for bunch of game logics, waypoints and sync.

Share this post


Link to post
Share on other sites

:) Sure, there are tons of ways to do things in A2.

I keep reading there's too much scripting in A2 editor to make it friendly, I just try to propose some new lights on possibilities of the editor ;)

Edited by whisper

Share this post


Link to post
Share on other sites

Oops, I came in late to the thread and missed the LOGIC stuff. Good approach, I like offloading stuff to the editor sometimes, though keeping track of it can be a challenge in some cases.

Share this post


Link to post
Share on other sites

Well, it still takes 3 triggers, scripting or no scripting. I'd still rather write:

triggeractivated t1 && triggeractivated t2

than add extra stuff with editor.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×