Jump to content
Sign in to follow this  
Durka-Durka

Multiple Units Entering a Trigger

Recommended Posts

Hi all. I've looked and looked and can't find a decent answer to my question, so I'm going to post it here rather than do the trial and error thing for the next few days....

I'm making a MP mission where one side has to bring a convoy safely into a town. I'm trying to make it to where, once the vehicles enter the town (trigger) alive, the mission ends. I currently have three empty vehicles named "truck_1, truck_2, and truck_3." and a trigger with "end#1" set.

Ideally, the mission would be successful if over 50% of the vehicles enter town, but I'm not sure how to do that, so I'll settle for at least one making it if the former isn't possible.

Can someone please give some sort of example code I can work off of, or point me in the right direction so I don't waste so much time on one simple task? Thanks for any help you may give.

-Durka

Share this post


Link to post
Share on other sites

In a script:

_arrayCheck = list trigger1;
if ((truck_1 in _arrayCheck) or (truck_2 in _arrayCheck) or (truck_3 in _arrayCheck)) then {hint 'success!'};

In the editor:

1. In the activation of the trigger, create TWO triggers. One containing WEST (or other side if trucks other side), PRESENT, etc... with no actions on activation. Make sure it is recurring. Name that trigger (eg. Trigger1).

2. Then place a SECOND trigger that activates the winning condition, replace the "this" with:

((truck_1 in (list trigger1)) || (truck_2 in (list trigger1)) || (truck_3 in (list trigger1)))

Share this post


Link to post
Share on other sites

Thanks for your help. I'm not sure I understand this fully.

Anyways, I've made that trigger, and On Act: I've put what you had in bold above and it keeps telling me I'm "missing )"

I've already created a working trigger where the West (convoy hunters) win, but I'm just trying to figure out a way to only have to place one trigger in the town so it is a success if the East convoy reaches its destination.

I can make it to where one vehicle reaches town, but if he gets blown up, I want the others to be able to make it as well.

Share this post


Link to post
Share on other sites

Another way would be to set an variable for each vehicle you want to check.

So put this in the init of each truck.

this setVariable ["value",1]

And this in the trigger:

{_x getVariable "value" == 1} count thisList >= 2

That should activate the trigger if 2 or more of the trucks are present. (not tested)

Share this post


Link to post
Share on other sites

Doable with only 1 trigger :

Let's say the side of the convoy is West and the whole convoy is grouped

Create you trigger, triggered by West, and link it with the group leader of the convoy.

"triggered by" should have changed to "any member". Leave it at that

In the "condition" field (containing "this"), put :

this and ((count thislist) >= ((count units group (thislist select 0)) / 2)

Should do the trick (syntax errors may have slipped here and there, long time I didn't use this kind of solutions :) )

Share this post


Link to post
Share on other sites

Looks like I'm getting closer with what you gave me Whisper. Is there a way to group empty vehicles? I'd like to make the vehicles playable, but start the mission without drivers. Thanks a lot for everyone's help so far!

By the way, your code is missing an ")" the editor says. It seems to work like this for anyone else wanting to use it....

this and ((count thisList) >= ((count units group (thislist select 0)) / 2))

Edited by Durka-Durka

Share this post


Link to post
Share on other sites

No, can't group empty things AFAIK

You'd need to check on the group of driver units (the actual soldiers driving), I think

Share this post


Link to post
Share on other sites

Mmmh hmm well the setVariable thing would work with any object regardless of its state, as long as it has the variable set. :)

Share this post


Link to post
Share on other sites

Indeed, going for this kind of solution instead of mine would work if you really want to start with empty vehicles :) So all dependant on your needs

Share this post


Link to post
Share on other sites

I'm gonna fiddle with it some more and see what I come up with some time next week. Thanks for the input. :yay:

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  

×