Jump to content
Sign in to follow this  
*TEK*TONI

Need help with Endtrigger / count alive Units

Recommended Posts

Hello Gents,

starting with saying sorry bringing up an old topic, but I haven´t been able to solve my problem by myself.

Situation:

My goal is to create an endtrigger, wich is activating, when all alive units are inside the trigger area.

All my missions are only designed to work on Dedicated Servers. So multiplayer, JIP, respawn/revive is making this task a bit difficult to me.

I know that I have to create a player array somewhere in the init.sqf and then put something like "!(alive _x)} count myPlayerArray == count myPlayerArray)" in the condition field of the trigger. DOESN´T work.

I´ve been reading also the BIS WIKI, but I´m not able to take use out of this infos, since I´m not a pro scripter.

Playerarray: tek_player_units = [G1,G2,G3,G4,G5,G6,G7,G8,G9]; ...is that correct? G1,G2..and so on are the names of my squadmember. Do I need to stick with P1 for player1 or can I remain using G1, do I need to put the names in "" or do I need to leave space after the coma? You see, this might be stupid questions, but I just don´t know how to do it?

This topic was discussed quite a few times. Here and at the ofpec forum, but I still need some good explained help.

Mainly my goal/dream is to kinda reproduce Ghost Recon style missions. The squad, always the with the same names, G1 - G9, have to go for a few tasks and at the end to the extraction zone. The mission ends, when all alive units are in the trigger area.

The revive script I´m using is leaving the dead bodys of the squadmembers on the floor, so I´m not sure if this is creating a problem, but if so, I could change this feature in the revive script.

Help is more than appreciated!! Thanks for taking time reading this.

Share this post


Link to post
Share on other sites

Place a trigger, name it ExitArea (this will be the area you want your players to gather), activated by anybody present.

In another trigger (this will be your end condition trigger), use the following condition:

{(isPlayer _X) && (alive _X) && !(_X in list ExitArea)} count allUnits <= 0

Should fire when all remaining alive players are simultaniously within ExitArea.

Share this post


Link to post
Share on other sites

Hello Big Dawg KS,

thanks a lot for your support.

So there is no playerarray in the init.sqf needed. I´ve read so much about it and now there is this one lil array. Hopefully it works.

Thanks again...

Share this post


Link to post
Share on other sites

The allUnits command returns, you guessed it, all units in the mission. This code counts how many of those units are players who are alive and not in the exit area. Once that number is 0, all living players will be in the exit area.

Share this post


Link to post
Share on other sites

I'm having issues getting this trigger to work in MP sometimes it will just randomly fire at the outset of the mission, but in editor it works right all the time. Any suggestions?

Share this post


Link to post
Share on other sites

You can use playableunits in MP and switchableunits in SP to get a hold of all the players without ever needing to worry about their groups. Obviously, if you want, you can limit the check to a specific group as well. For example:

{group _x == grpSomething && alive _x} count playableunits

Share this post


Link to post
Share on other sites

I have a different type of question...How do I make it to where after taking out the 3 helicopters, and 2 planes...the mission ends? (like triggering where the evac or end is after taking those 5 things out).

Share this post


Link to post
Share on other sites

Just in the end trigger in the condition box put

!(alive heli1) && !(alive heli2) && !(alive heli3)

heli123 being whatever you want to name the units you want dead, and the trigger won't fire until they all are dead. Be sure to put axis A and axis B to 0 as well so it checks globally to see if they are alive or dead. If you group that trigger to the playable group leader where you want them to extract with a small radius, and activation set to whole group, the trigger will fire when A. All of the units you want dead, are. B. The whole group is at the extraction point. Hope that clears up any confusion.

Share this post


Link to post
Share on other sites

{(isPlayer _X) && (alive _X) && !(_X in list ExitArea)} count allUnits <= 0

this did not work for me - as soon as one of the players enters it triggers endmission - while half of the players are not in the zone.

Share this post


Link to post
Share on other sites

There is an easier way if you only have one group playing. And that is in the editor to make the ending trigger the size you want. Then group it with the team leader of the group.

The activation in the trigger has now changed, and you can select "whole group", and the trigger will not be activated until the entire group is within the trigger area.

I don't know how well this works with revive, but it may be worth a try?

Kind Regards

Melvin

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  

×