Jump to content
swiso

trigger "mission fail" if "x" amount of civilians killed

Recommended Posts

1 hour ago, Joe98 said:

Simple way:

 

Set up a trigger

Activation is Civilian, Once and Present

in the condition field:   count  thislist   <  4:

When there are less than 4 civilians in the trigger area, the trigger will fire.

 

(You have to actually use civilians. BlueForce are blue colour,  OpForce are red colour and Civilians are purple colour).

 

 

 

Not really!

A blue/red/green can be Civ (when captive)

Snakes and rabbits are civilian and counted by this trigger;

So, on same way, empty vehicles are civilian;

Ammo crates are civilian;...

Not saying, your trigger needs a world wide area and even preset condition like civilian present implies a check on each edited/spawned things like these to filter the civs things. So, an EH will always be better in this case.

 

  • Like 1

Share this post


Link to post
Share on other sites
10 hours ago, Joe98 said:

Simple way:

 

Set up a trigger

Activation is Civilian, Once and Present

in the condition field:   count  thislist   <  4:

When there are less than 4 civilians in the trigger area, the trigger will fire.

 

(You have to actually use civilians. BlueForce are blue colour,  OpForce are red colour and Civilians are purple colour).

 

 

Can't use that cause i must use a a civilian spawner script (its a whole map sandbox mission), so at mission start every trigger will fire. The code given by @Grumpy Old Man works fine, im looking for a solution to use a civilian kill counter that cover only an area of the map, any side can kills civilians.

 

 

Share this post


Link to post
Share on other sites
On 4/23/2020 at 5:35 PM, pierremgi said:

Snakes and rabbits are civilian and counted by this trigger;

So, on same way, empty vehicles are civilian;

 

I am shocked to discover you are correct. Empty cars, animals and boxes are considered to be civilians!  

 

The solution is to use Independants. Dress them like civilians and make independents friendly to everybody.  In the trigger I suggested, use Independats instead of civialins. Works just fine!

Share this post


Link to post
Share on other sites
7 hours ago, damsous said:

..........civilian kill counter that cover only an area of the map, any side can kills civilians.

 

 

 

So place the trigger over the area of the map that interests you.

Share this post


Link to post
Share on other sites
14 hours ago, damsous said:

Can't use that cause i must use a a civilian spawner script (its a whole map sandbox mission), so at mission start every trigger will fire.

 

There is a workaround for that. You can add another trigger <firstTrigger> counting civs (CAManBase ones!)  > 4 then add the condition triggerActivated firstTrigger && ... in your previous trigger. This way, at start nothing triggers, then you spawn civs. If more than 4, firstTrigger fires, then your second trigger fills the first condition and wait for kill result.

But... as said before, it's better to work with the EH.

 

14 hours ago, damsous said:

The code given by @Grumpy Old Man works fine, im looking for a solution to use a civilian kill counter that cover only an area of the map, any side can kills civilians.

You just have to place a marker or a trigger area and use an extra condition with inArea command.

  • Thanks 1

Share this post


Link to post
Share on other sites

Hey!

For the casual person browsing this thread: when I was figuring this out myself, I just created an array with all of the civilians and had the eventhandler compare the _victim to the array. 

Note that that in my case, my code creates a punishment that temporarily blurs the players screen. Obviously you can add GrumpyOldMan's counter and mission fail trigger as well in the "punishment code" bit. 
 

// Civ punishment script: local blur 

// Define civs

civslist = ["C_man_1", "C_man_1_1_F", "C_man_1_2_F", "C_man_1_3_F", "C_man_polo_1_F", "C_man_polo_1_F_afro", "C_man_polo_1_F_euro", "C_man_polo_1_F_asia", "C_man_polo_2_F", "C_man_polo_2_F_afro", "C_man_polo_2_F_euro", "C_man_polo_2_F_asia", "C_man_polo_3_F", "C_man_polo_3_F_afro", "C_man_polo_3_F_euro", "C_man_polo_3_F_asia", "C_man_polo_4_F", "C_man_polo_4_F_afro", "C_man_polo_4_F_euro", "C_man_polo_4_F_asia", "C_man_polo_5_F", "C_man_polo_5_F_afro", "C_man_polo_5_F_euro", "C_man_polo_5_F_asia", "C_man_polo_6_F", "C_man_polo_6_F_afro", "C_man_polo_6_F_euro", "C_man_polo_6_F_asia", "C_man_p_fugitive_F", "C_man_p_fugitive_F_afro", "C_man_p_fugitive_F_euro", "C_man_p_fugitive_F_asia", "C_man_p_beggar_F", "C_man_p_beggar_F_afro", "C_man_p_beggar_F_euro", "C_man_p_beggar_F_asia", "C_man_w_worker_F", "C_scientist_F", "C_man_hunter_1_F", "C_man_p_shorts_1_F", "C_man_p_shorts_1_F_afro", "C_man_p_shorts_1_F_euro", "C_man_p_shorts_1_F_asia", "C_man_shorts_1_F", "C_man_shorts_1_F_afro", "C_man_shorts_1_F_euro", "C_man_shorts_1_F_asia", "C_man_shorts_2_F", "C_man_shorts_2_F_afro", "C_man_shorts_2_F_euro", "C_man_shorts_2_F_asia", "C_man_shorts_3_F", "C_man_shorts_3_F_afro", "C_man_shorts_3_F_euro", "C_man_shorts_3_F_asia", "C_man_shorts_4_F", "C_man_shorts_4_F_afro", "C_man_shorts_4_F_euro", "C_man_shorts_4_F_asia", "C_journalist_F", "C_Orestes", "C_Nikos", "C_Nikos_aged"];

addMissionEventHandler ["EntityKilled", 
{ 
    params ["_victim","_killer","_instigator"]; 
    if (isNull _instigator) then {_instigator = UAVControl vehicle _killer select 0}; 
    if (isNull _instigator) then {_instigator = _killer}; 
    if ((typeOf _victim) in civsList) then 
	{ 
// Punishment Code


	["DynamicBlur", 400, [20]] spawn 
		{ 
 		params ["_name", "_priority", "_effect", "_handle"]; 
 		while 
			{ 
 			_handle = ppEffectCreate [_name, _priority]; 
  			_handle < 0 
 			} do 
                       { 
  						_priority = _priority + 1; 
 						}; 
 			_handle ppEffectEnable true; 
 			_handle ppEffectAdjust _effect; 
 			_handle ppEffectCommit 5; 
 			waitUntil {ppEffectCommitted _handle}; 
 			["<t color='#ff0000' size = '.8'>Warning!<br />No civilian kills.</t>",-1,-1,4,1,0,789] spawn BIS_fnc_dynamicText;
			uisleep 5;
			_handle ppEffectAdjust [0];
			_handle ppEffectCommit 2; 
			_handle ppEffectEnable false;
			ppEffectDestroy _handle;
 		};
	;
    }; 
 	}];

You can place this in initplayerlocal (for the punishment) or init if you want GrumpyOldMan's counter to work.
I'd like to add that this array does not include civilians that are spawned by the "Civilian Presence" Modules. These have their own classnames. I don't know the multiplayer performance, so I just excluded those names from the _civslist array. 

(PS pretty sure I screwed up the indentation..shouldn't make a difference)

  • Thanks 1

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

×