Jump to content
Sign in to follow this  
fluffy_nosed_horse

Number of Civs Killed > 5 end mission

Recommended Posts

Hi Guys.

 

Im new to mission making, not very good at scripting, but i am using the eden editor. i want to try and stay in there, and have a trigger that activates the end mission when a certain number of civilians are killed in an area.  Is it possible or do i have to make little sqf files and all that wierd stuff that scares me. can i do it in eden or is it impossible?  this is for a multiplayer coop scenario.

 

Cheers for your help in advance.

Share this post


Link to post
Share on other sites

Try this, put it in init.sqf in mission directory

 

if (isServer) then
{
	FNH_civilians_killed = 0;
	addMissionEventHandler ["EntityKilled", 
	{
		_killed = _this select 0;
		if (side group _killed == civilian) then
		{
			FNH_civilians_killed = FNH_civilians_killed + 1;
			if (FNH_civilians_killed > 5) then
			{
				failMission "LOSER"; //or any other ending
			};
		};
	}];
};
  • Like 5

Share this post


Link to post
Share on other sites

Am I right in assuming that won't work if you're spawning in civilians by using ALiVE or COS?

Share this post


Link to post
Share on other sites

Am I right in assuming that won't work if you're spawning in civilians by using ALiVE or COS?

 

Why do you think so?

Share this post


Link to post
Share on other sites

Why do you think so?

I was just asking. In the past I've looked and found it hard to find a script that does that when the units aren't present at initialization.

If this will do that then that's awesome.

Share this post


Link to post
Share on other sites

Since you count any civilian after initializing the mission it works in alive.

Share this post


Link to post
Share on other sites

just place 2 triggers

trigger1 - this one will cover the area you want civillians counted
 

conditions are: CIVILLIAN, PRESENT

note that it doesnt matter if the trigger fires or not, you just need it to monitor the list of civillians within the area

trigger2 - this one checks how many civs are alive in trigger1

condition field: {alive _x} count (list trigger1) < 15

result: when the amount of civs in trigger1 area drops below 15, trigger2 fires

OR

you could just have one trigger to check how many civs are on the map like {_x side CIVILIAN} count allunits == 0
 

there is a few more ways to go around that depending what you actually want to do

Share this post


Link to post
Share on other sites

 

Try this, put it in init.sqf in mission directory

 

if (isServer) then
{
	FNH_civilians_killed = 0;
	addMissionEventHandler ["EntityKilled", 
	{
		_killed = _this select 0;
		if (side group _killed == civilian) then
		{
			FNH_civilians_killed = FNH_civilians_killed + 1;
			if (FNH_civilians_killed > 5) then
			{
				failMission "LOSER"; //or any other ending
			};
		};
	}];
};

Thanks, KK!

Share this post


Link to post
Share on other sites
On 5/28/2016 at 7:32 AM, killzone_kid said:

Try this, put it in init.sqf in mission directory

 


if (isServer) then
{
	FNH_civilians_killed = 0;
	addMissionEventHandler ["EntityKilled", 
	{
		_killed = _this select 0;
		if (side group _killed == civilian) then
		{
			FNH_civilians_killed = FNH_civilians_killed + 1;
			if (FNH_civilians_killed > 5) then
			{
				failMission "LOSER"; //or any other ending
			};
		};
	}];
};

 

Hi killzone_kid, your code works great. How do I run this code only if "WEST" units kill civilian ?
Thank you 😃

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  

×