Jump to content
Sign in to follow this  
AdirB

Check if player killed a unit in east side

Recommended Posts

Hello,

I'm trying to make a system that adds 1 kill point to a player.

I do that because the ACE3 medical system messes with arma 3's score system.

 

So what I try to do is run a loop which detects when a player has killed an east side unit and when he did, he will get 1 infantry kill point.

 

Is there a way to do that?

Share this post


Link to post
Share on other sites

Something like this:

 

addMissionEventHandler ["EntityKilled",{

params ["_killed", "_killer", "_instigator"];

if (isPlayer _instigator AND side group _killed isEqualTo east) then {

//your stuff here

};

}];

Cheers

Share this post


Link to post
Share on other sites
5 hours ago, Grumpy Old Man said:

Something like this:

 


addMissionEventHandler ["EntityKilled",{

params ["_killed", "_killer", "_instigator"];

if (isPlayer _instigator AND side group _killed isEqualTo east) then {

//your stuff here

};

}];

Cheers

Thanks for your response!

 

That's what I did:

addMissionEventHandler ["EntityKilled",{ 
 
params ["_killed", "_killer", "_instigator"]; 
 
if (isPlayer _instigator AND side group _killed isEqualTo east) then { 
 
_instigator addPlayerScores [(getPlayerScores _instigator select 0)+1, getPlayerScores _instigator select 1, getPlayerScores _instigator select 2, getPlayerScores _instigator select 3, getPlayerScores _instigator select 4];

_instigator_kills = getPlayerScores _instigator;
hint format["%1",_instigator_kills];
}; 
 
}];

But it didn't work at all, it didn't do anything.

 

And then I found that instead of getting 1 point I'm getting a multiplied score.

PE_PL addPlayerScores [(getPlayerScores PE_PL select 0)+1, getPlayerScores PE_PL select 1, getPlayerScores PE_PL select 2, getPlayerScores PE_PL select 3, getPlayerScores PE_PL select 4];

_pe_pl_kills = getPlayerScores PE_PL select 0;
hint format["%1",_pe_pl_kills];

 

Share this post


Link to post
Share on other sites

Anyone who can help me please?

Share this post


Link to post
Share on other sites

addPlayerScores   Here is an example of poorly (badly) documented command. If you read the link this command is server side. So, what the hell the example and comment refer to player?????

I guess you need to identify the said "player" instead of using the player variable.

we should read: soldier1 addPlayerScores [0, 1, 0, 0, 1]; // which soldier1 is a player (or not, AIs can have score if i'm right)

 

Anyway:

The addMissionEventHandler "entityRespawned" should run on server, here, for this special purpose (most of the time you need it locally for loadout or else).

So place it in initServer.sqf or... in init.sqf with:
 

if (isServer) then {
  addMissionEventHandler ["EntityKilled",{
    params ["_killed", "_killer", "_instigator"];
    if (isPlayer _instigator && side group _killed isEqualTo east) then {
     _instigator addPlayerScores [1, 0, 0, 0,0]; // to add one more point than the standard score against infantry
     _instigator_kills = getPlayerScores _instigator;
     format ["%1",_instigator_kills] remoteExec ["hint",_instigator];
   };
  }];
};

 

It doesn't work in SP.

 

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  

×