Jump to content
Sign in to follow this  
sauerxz

Help on "free for all" deathmatch mission

Recommended Posts

Basically, I have this situation similar to a deathmatch (free for all), and I'd like to "addscore" to players ONLY when they kill other players, not AI's.

Digging the internet, I found some scripts (meant for punishing teamkills), worked around them a little bit and got this:

 

 

killscript.sqf

 

if (local player)then{
_unit=(_this select 0);
_killer=(_this select 1);

_unit addMPEventHandler ["MPkilled", {
 _unit=        (_this select 0); // UNIT THAT DIED
 _killer=    (_this select 1); // UNIT THAT KILLED THE UNIT
 

if (isplayer _killer && _unit != _killer)then{ // IF KILLER IS A PLAYER

_killer addScore 2;
 _id =        format ["%1 killed %2.",name _killer,name _unit]; // UNIQUE MARKER NAME
hint _id;


    
 _unit removeAllEventHandlers "killed";
            };

        }];
    };

 

I must admit that I could not create such a thing, but I did some modifications and it ALMOST worked as intended.

 

What it does:

Player A kills player B

Player A gets his score (2), yay.
Player B respawns.
 

Then, Player C kills player D

Player C gets more points than he should get.

And this keeps happening like:

 

Score behavior:

Kill 1 : 2 points
Kill 2 : 4 points
Kill 3 : 6 points (...) <- I'm not sure about these values, but I do know that they keep growing.

 

 

I believe that this is happening because of the accumulated bodies of players, but I wasn't able to delete them to test it out.

 

If any of you guys can help me, it would be appreciated! :)

 

 

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  

×