PDA

View Full Version : Trigger kill all but players.



speeder
Dec 13 2010, 19:08
Trigger kill all but players.

I tried doing this in a trigger, but it also kills players.
What should it look like instead?


{if(_x != player) then {_x setDamage 1;};} forEach allUnits;

Loki
Dec 13 2010, 19:31
this is probably too complex for what you want.. but it shows how i do it in the lost key.

//WEST
if (playerSide == west) then {
//kill the east sith
triggerOrder66 = createTrigger ["EmptyDetector", position player];
triggerOrder66 setTriggerArea [5000, 5000, 0, false];
triggerOrder66 setTriggerActivation ["EAST", "PRESENT", true];
triggerOrder66 setTriggerType "SWITCH";

//kill the Res. Rebels
triggerOrder66R = createTrigger ["EmptyDetector", position player];
triggerOrder66R setTriggerArea [5000, 5000, 0, false];
triggerOrder66R setTriggerActivation ["GUER", "PRESENT", true];
triggerOrder66R setTriggerType "SWITCH";
sleep 1;
private ["_sith_loons","_rebel_loons"];

_triggerOrder66List = list triggerOrder66;
sleep 0.01;
_triggerOrder66ListR = list triggerOrder66R;

_sith_loons = 0;
_rebel_loons = 0;

{_sith_loons = _sith_loons + ({ alive _x } count (crew _x)) } forEach (list triggerOrder66);
{_rebel_loons = _rebel_loons + ({ alive _x } count (crew _x)) } forEach (list triggerOrder66R);

sleep 1;
//get the vehicles first
{deletevehicle _x} foreach _triggerOrder66List;
sleep 0.01;
{deletevehicle _x} foreach _triggerOrder66ListR;
sleep 2;
//get those knocked out of the vehicles
{deletevehicle _x} foreach _triggerOrder66List;
sleep 0.01;
{deletevehicle _x} foreach _triggerOrder66ListR;
sleep 1;
// for those tuff bassturds...
{deletevehicle _x} foreach _triggerOrder66List;
sleep 0.01;
{deletevehicle _x} foreach _triggerOrder66ListR;

hint "killed ya.. you sith bassturds... and your little rebel friends too.";

sleep 1.5;

deletevehicle triggerorder66;
deletevehicle triggerorder66R;
};

[ASA]ODEN
Dec 13 2010, 19:47
try:
{ if(!isPlayer _x) then { _x setDamage 1; }; } forEach allUnits;

kylania
Dec 13 2010, 19:51
endMission;

I can't really think of a situation where you'd want to kill all other units and still keep players in a mission?

Muzzleflash
Dec 13 2010, 23:03
Agree with kylania, however, this should do it:


{if(!isPlayer _x) then {_x setDamage 1;};} forEach allUnits;

Loki
Dec 14 2010, 00:10
I can't really think of a situation where you'd want to kill all other units and still keep players in a mission?

<2 cents>
its exactly why i use order66 in the lost key. in the S.I.T.C.O.M. (situational command) section, i have built several missions in the 3-d editor that can be spawned on any map. and anytime the mission is over.. the map needs to be cleared of anything not going to be in the next mission. (left overs)
<\2cents>

:)

kylania
Dec 14 2010, 01:52
hehe order66. :)

Guess that's just a different playstyle I guess, since I've never "reused" a map with a mission I just completed. Always just played missions.

speeder
Dec 14 2010, 02:48
I'm using it in a shooting range with life targets. It's nice to be able to reset the course.

GDICommand
Dec 14 2010, 16:12
well in that case, it seems like you would want to use deleteVehicle...instead of just killing them off
{if(!isPlayer _x) then {deleteVehicle _x;};} forEach allUnits;

Loki
Dec 15 2010, 07:29
well in that case, it seems like you would want to use deleteVehicle...instead of just killing them off
{if(!isPlayer _x) then {deleteVehicle _x;};} forEach allUnits;

very nice.. would make a good function called 'kill_em_all'

should work for what speeder needs with no problems.

speeder
Dec 18 2010, 11:43
Seems to work just fine - cheers.