Jump to content
Play3r

EntityKilled civilian and blufor

Recommended Posts

i have this script that i want to use for Civilian and Blufor.

 

Spoiler

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 > 0) then
            {
                 _handle = [] spawn {["HQ", "You just KILLED a civilian, You are releaved from duty !!"] spawn BIS_fnc_showSubtitle};
                Sleep 10;
                "end1" call BIS_fnc_endMission ; //or any other ending
            };
        };
    }];
};

But i have just found out that if a OpFor killes a civillian it ends the mission also, i just want to have it end the mission if BluFor (player) killes a civilian.

 

if i want the mission to end if i kill a Blufor soldier what do i have to change in this script 

Spoiler

if (isServer) then
{
    FNH_blufor_killed = 0;
    addMissionEventHandler ["EntityKilled", 
    {
        _killed = _this select 0;
        if (side group _killed == west) then
        {
            FNH_blufor_killed = FNH_blufor_killed + 1;
            if (FNH_blufor_killed > 0) then
            {
                 _handle = [] spawn {["HQ", "You just KILLED one of your own. Get ready to stand in front of a judge !!"] spawn BIS_fnc_showSubtitle};
                Sleep 10;
                "end1" call BIS_fnc_endMission ; //or any other ending
            };
        };
    }];
};

this script ends the mission if any blufor dies, how do i make it so only the mission ends if it is the BluFor (player) that killls a BluFor

 

Regards Play3r

Share this post


Link to post
Share on other sites

this should end the mission if a player kills a civilian or a blufor(if i missed something dumb blame just waking up)

if (isServer) then
{
    FNH_civilians_killed = 0;
    addMissionEventHandler ["EntityKilled", 
    {
		params ["_unit", "_killer", "_instigator", "_useEffects"];
		if (isPlayer _killer) then
		{
			_sideKilled = side _unit;
			_sideKiller = side _killer;
			if (_sideKilled == civilian) then
			{
				FNH_civilians_killed = FNH_civilians_killed + 1;
				if (FNH_civilians_killed > 0) then
				{
					_handle = [] spawn {["HQ", "You just KILLED a civilian, You are releaved from duty !!"] spawn BIS_fnc_showSubtitle};
					Sleep 10;
					"end1" call BIS_fnc_endMission ; //or any other ending
				};
			} else
			{
				if (_sideKilled isEqualTo West && _sideKiller isEqualTo West) then
				{
					_handle = [] spawn {["HQ", "You just KILLED a blufor, You are releaved from duty !!"] spawn BIS_fnc_showSubtitle};
					Sleep 10;
					"end1" call BIS_fnc_endMission ; //or any other ending
				};
			};
		};
    }];
};

 

Share this post


Link to post
Share on other sites
19 minutes ago, gokitty1199 said:

this should end the mission if a player kills a civilian or a blufor(if i missed something dumb blame just waking up)


if (isServer) then
{
    FNH_civilians_killed = 0;
    addMissionEventHandler ["EntityKilled", 
    {
		params ["_unit", "_killer", "_instigator", "_useEffects"];
		if (isPlayer _killer) then
		{
			_sideKilled = side _unit;
			_sideKiller = side _killer;
			if (_sideKilled == civilian) then
			{
				FNH_civilians_killed = FNH_civilians_killed + 1;
				if (FNH_civilians_killed > 0) then
				{
					_handle = [] spawn {["HQ", "You just KILLED a civilian, You are releaved from duty !!"] spawn BIS_fnc_showSubtitle};
					Sleep 10;
					"end1" call BIS_fnc_endMission ; //or any other ending
				};
			} else
			{
				if (_sideKilled isEqualTo West && _sideKiller isEqualTo West) then
				{
					_handle = [] spawn {["HQ", "You just KILLED a blufor, You are releaved from duty !!"] spawn BIS_fnc_showSubtitle};
					Sleep 10;
					"end1" call BIS_fnc_endMission ; //or any other ending
				};
			};
		};
    }];
};

 

Hmm if i kill a BluFor the End for Civilian is displayed.

it shows up also if i kill a civilian.

i have changes it a little..

Spoiler

if (isServer) then
{
    FNH_civilians_killed = 0;
    addMissionEventHandler ["EntityKilled", 
    {
        params ["_unit", "_killer", "_instigator", "_useEffects"];
        if (isPlayer _killer) then
        {
            _sideKilled = side _unit;
            _sideKiller = side _killer;
            if (_sideKilled == civilian) then
            {
                FNH_civilians_killed = FNH_civilians_killed + 1;
                if (FNH_civilians_killed > 0) then
                {
                    
                    "end1" call BIS_fnc_endMission ; //or any other ending
                };
            } else
            {
                if (_sideKilled isEqualTo West && _sideKiller isEqualTo West) then
                {
                    
                    "end2" call BIS_fnc_endMission ; //or any other ending
                };
            };
        };
    }];
};

 Description.ext

Spoiler

class CfgDebriefing
{  
    class End1
    {
        title = "Mission Over";
        subtitle = "NO civilian casulties";
        description = "You have killed a Civilian, You are releaved from duty !! ";
        pictureBackground = "picture\court.jpg";
        picture = "";
        pictureColor[] = {0.0,0.3,0.6,1};
    };
    
    class End2
    {
        title = "Mission Over";
        subtitle = "NO team kills";
        description = "You just KILLED one of your own. Get ready to stand in front of a judge !! ";
        pictureBackground = "picture\judge.jpg";
        picture = "";
        pictureColor[] = {0.0,0.3,0.6,1};
    };
    
};

 

Share this post


Link to post
Share on other sites

if i remember correctly, dead AI count as civs which may cause all killed AI to appear as civilians even if their not but im not 100% sure on that. hopefully someone else will comment on it

Share this post


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

Hmm if i kill a BluFor the End for Civilian is displayed.

it shows up also if i kill a civilian.

i have changes it a little..

  Reveal hidden contents

if (isServer) then
{
    FNH_civilians_killed = 0;
    addMissionEventHandler ["EntityKilled", 
    {
        params ["_unit", "_killer", "_instigator", "_useEffects"];
        if (isPlayer _killer) then
        {
            _sideKilled = side _unit;
            _sideKiller = side _killer;
            if (_sideKilled == civilian) then
            {
                FNH_civilians_killed = FNH_civilians_killed + 1;
                if (FNH_civilians_killed > 0) then
                {
                    
                    "end1" call BIS_fnc_endMission ; //or any other ending
                };
            } else
            {
                if (_sideKilled isEqualTo West && _sideKiller isEqualTo West) then
                {
                    
                    "end2" call BIS_fnc_endMission ; //or any other ending
                };
            };
        };
    }];
};

 Description.ext

  Reveal hidden contents

class CfgDebriefing
{  
    class End1
    {
        title = "Mission Over";
        subtitle = "NO civilian casulties";
        description = "You have killed a Civilian, You are releaved from duty !! ";
        pictureBackground = "picture\court.jpg";
        picture = "";
        pictureColor[] = {0.0,0.3,0.6,1};
    };
    
    class End2
    {
        title = "Mission Over";
        subtitle = "NO team kills";
        description = "You just KILLED one of your own. Get ready to stand in front of a judge !! ";
        pictureBackground = "picture\judge.jpg";
        picture = "";
        pictureColor[] = {0.0,0.3,0.6,1};
    };
    
};

 

 

Change this line:

_sideKilled = side _unit;

 

To this:

_sideKilled = side (group _unit);

Share this post


Link to post
Share on other sites
13 hours ago, LSValmont said:

 

Change this line:

_sideKilled = side _unit;

 

To this:

_sideKilled = side (group _unit);

@LSValmont Thanks it did the job. 

@gokitty1199 also thanks to you for the script.

 

And then again it does't game is over if OpFor kills a civilian also, does any one have a idea how to do so the game don't stop if OpFor kills a civilian?

Share this post


Link to post
Share on other sites
1 hour ago, Play3r said:

@LSValmont Thanks it did the job. 

@gokitty1199 also thanks to you for the script.

 

And then again it does't game is over if OpFor kills a civilian also, does any one have a idea how to do so the game don't stop if OpFor kills a civilian?

add a check. are any players going to be OpFor? if not then simply do a isPlayer check at the top like i did. otherwise you will need to add a check in the if statement for civilians such as this

if (isServer) then
{
    FNH_civilians_killed = 0;
    addMissionEventHandler ["EntityKilled", 
    {
		params ["_unit", "_killer", "_instigator", "_useEffects"];
		if (isPlayer _killer) then
		{
			_sideKilled = side (group _unit);//thank you LSValmont for the tip
			_sideKiller = side _killer;
			if (_sideKilled == civilian && _sideKiller != east) then//make sure the killer is not opfor
			{
				FNH_civilians_killed = FNH_civilians_killed + 1;
				if (FNH_civilians_killed > 0) then
				{
					_handle = [] spawn {["HQ", "You just KILLED a civilian, You are releaved from duty !!"] spawn BIS_fnc_showSubtitle};
					Sleep 10;
					"end1" call BIS_fnc_endMission ; //or any other ending
				};
			} else
			{
				if (_sideKilled isEqualTo West && _sideKiller isEqualTo West) then
				{
					_handle = [] spawn {["HQ", "You just KILLED a blufor, You are releaved from duty !!"] spawn BIS_fnc_showSubtitle};
					Sleep 10;
					"end1" call BIS_fnc_endMission ; //or any other ending
				};
			};
		};
    }];
};

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
On 9/23/2019 at 9:21 PM, gokitty1199 said:

add a check. are any players going to be OpFor? if not then simply do a isPlayer check at the top like i did. otherwise you will need to add a check in the if statement for civilians such as this


if (isServer) then
{
    FNH_civilians_killed = 0;
    addMissionEventHandler ["EntityKilled", 
    {
		params ["_unit", "_killer", "_instigator", "_useEffects"];
		if (isPlayer _killer) then
		{
			_sideKilled = side (group _unit);//thank you LSValmont for the tip
			_sideKiller = side _killer;
			if (_sideKilled == civilian && _sideKiller != east) then//make sure the killer is not opfor
			{
				FNH_civilians_killed = FNH_civilians_killed + 1;
				if (FNH_civilians_killed > 0) then
				{
					_handle = [] spawn {["HQ", "You just KILLED a civilian, You are releaved from duty !!"] spawn BIS_fnc_showSubtitle};
					Sleep 10;
					"end1" call BIS_fnc_endMission ; //or any other ending
				};
			} else
			{
				if (_sideKilled isEqualTo West && _sideKiller isEqualTo West) then
				{
					_handle = [] spawn {["HQ", "You just KILLED a blufor, You are releaved from duty !!"] spawn BIS_fnc_showSubtitle};
					Sleep 10;
					"end1" call BIS_fnc_endMission ; //or any other ending
				};
			};
		};
    }];
};

 

Thanks for the answer, sorry for the late reply, but this one makes I work just great.  Thanks for all your help.

  • Like 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

×