Jump to content
Sign in to follow this  
dar

Friendly Fire / Civilian kill penalty (SP) ?

Recommended Posts

Hey guys,

I'm working on a SP mission with lots of civilians around and of course you are not allowed to shoot it. To ensure that, I want the mission to end on such an incident as A: a civilian was shot by you, B: A friendly unit was shot by you.

I tried several Arma 2 scirpts, but none of them worked, as some depended on ALICE and some didn't work for other compatibilty issues.

I found the "Friendly Fire module" in the editor, but it doesn't seem to have any effect the way I use it: Module placed. Module synched to mission end trigger. When I now kill a civilian or henchman, nothing will happen. Is this for MP only?

So what I need would be a simple script or an explanation on how to use that module properly.

Anybody around who can give me hand on this?

Share this post


Link to post
Share on other sites

how are you adding the civillians?

if you are placing them yourself a simple eventhandler killed on each of them will do the trick.

scripting wise, you could try adding the eventhander using foreach command and units civillians - methods...

Share this post


Link to post
Share on other sites

I placed the civilians by myself. What would I have to wirte in thier init line?

Share this post


Link to post
Share on other sites

in the civvy's init. (may need a handle before.. - civvy = [this] addeventhandler....)

this addEventHandler ["killed", "hint format['Killed by %1',_this select 1]"];

whack this in first as a tester. shoot a civillian and hopefully the hint will appear saying that you killed him.

then replace with the below code...


this addEventHandler ["killed", {[_this select 0, _this select 1] spawn identifyKiller}];

//make a function in a file that is preloaded prior to the game starting...

identifyKiller = {

_unitKilled = _this select 0;
_killer = _this select 1;
 if (side _unitKilled == independent && side _killer == West)
   {
        hint "you killed a civillian numpty!";
        _killer setdamage 1; //if you want to kill the player   

         //if you want to have alimit to the amount of civies you can kill then - something like this...

        //(globalVariable) - need to add in init -  //if (isnil "civillianKillCount") then {civilliankillcount = 0};


        civillianKillCount = civillianKillCount + 1;
        if (civillianKillcount == 4) then { _killer setdamage 1; //if you want to kill the player} else {hint " carefull you are close to being punishedfor civivy killin"};


   };

};

not tested of course but it should be there or thereabouts

Share this post


Link to post
Share on other sites

Thank you, man I altered it a little and now it fits my need exactly.

identifyKiller =

{ _unitKilled = _this select 0;

_killer = _this select 1;

if (side _unitKilled == civilian && side _killer == West)then

{ hint "You shot a civilian! Your mission is over, Captain.";

fail = true;

};

};

Shortened it a little. Fail is the variable triggering the mission ending.

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  

×