Forum Jump :

Author Message

Posts: 18

Level: Member

Country: nz
In-game name:

#1 Posted at 2017-08-18 11:16        
Hi good gents.

I am sick of banging my head against a wall over a simple little script.

This is for an MP PvP mission where there are two resistance players (E1 and E2) and a bunch of player blufor hunters.
I want a trigger to go off, which will essentially be the "win" trigger for blufor.

The trigger needs to go off when all resistance players are captive (because of ACE handcuffs) and present in a holding cell (represented by an area trigger).

A couple of things make this slightly tricky though.

1) Sometimes there may be only one person playing as resistance, not necessarily two. If only one resistance player, the other resistance character will not be present in the mission as AI either.
2) I don't want the trigger to go off if only one resistance guy is captured, as the other fella may be there to rescue him.

Issues I've encountered so far is that when captured, the script command "side" will register E1 and E2 as being civilian, not resistance - so I've found faction _x == "IND_F" may be a good work around.

I have tried what feels like dozens of combinations to get this happening, but keep failing.

My best effort was a "Whole group" present trigger with This && (captive E1) && (captive E2) in the condition - but I'm not sure what will happen if there's only E1 or E2 being played.

I've tried lots of things like {captive _x && faction _x == "IND_F"} forEach player, but I usually get generic error messages and such.

Thoughts and problem solves welcome.

Author Message

Posts: 59

Level: Member

Country: ca
Location: Quebec
In-game name:

#2 Posted at 2017-08-22 15:32        
Uhm... Maybe give this a try:

In INIT.SQF add this code:

if (isServer) then {
Hunted = []; // empty array
if (!isNil "E1") then Hunted = Hunted + [E1]; // if E1 exists, add him to array
if (!isNil "E2") then Hunted = Hunted + [E2]; // if E2 exists, add him to array

And then, for your trigger:

({(alive _x) && (_x isKindOf "CAManBase") && (Side _x == INDEPENDENT) && (captive _x)} count thisList == count Hunted);

So basically, the amount of alive and captive Independent men within the trigger must be equal to the amount of players assigned to E1 and E2 (Hunted array).

If this doesn't work, then maybe the captive condition is clashing with the Independent Side. In that case, try changing INDEPENDENT for CIVILIAN...