pliskin124 4 Posted April 9, 2017 Greetings, I have done an extensive search on the internet for a script or command to call to "addRating" to the player when enemy AI are killed, however all I can find is the addScore ability when it comes to scripting. The forum posts I found are only related to a specific EOS module, I'm looking to give rating on ALL enemy AI. I am using both EOS and ALiVE to ambiently spawn in AI. Any help would be appreciated, thanks. tldr; Give player rating from killing AMBIENTLY SPAWNED IN AI (ALiVE / EOS) Share this post Link to post Share on other sites
kagenekosama 4 Posted April 11, 2017 I was thinking aboit making a script today whit that function (adding score on player for several actions including shooting and killing npcs) I will make sure to give it to you if i get it to work tomorrow. Share this post Link to post Share on other sites
pierremgi 4743 Posted April 11, 2017 There is no difficulty, overriding what the engine scores: https://community.bistudio.com/wiki/ArmA:_Rating_Values Just for info because BI documentation is not updated. You can use the MP event handler MPkilled. As any killed is civilian, you need to check the side of the victim before he dies: {_x setVariable ["oldSide",side _x]} forEach allUnits; // in a loop if you spawn units. then, for example: player addMPEventHandler ["MPkilled", { params ["_victim","_killer"]; if (!isplayer _killer or _victim == _killer) exitWith {}; if (_victim getVariable "oldSide" == west) exitWith { [_killer,{_this addRating -3000}] remoteExec ["call",_killer]; parseText "<t color = '#ff9900'>You just killed a friendly unit!<br/>Cease blue on blue.<t/>" remoteExec ["hintsilent",_killer]; }; if (_victim getVariable "oldSide" == civilian) exitWith { [_killer,{_this addRating -1000}] remoteExec ["call",_killer]; parseText "<t color = '#ffff00'>You just killed an innocent!<br/>Cease firing at unarmed civilians.<t/>" remoteExec ["hintsilent",_killer]; }; }]; 1 Share this post Link to post Share on other sites
pliskin124 4 Posted April 17, 2017 On 4/11/2017 at 1:51 AM, pierremgi said: There is no difficulty, overriding what the engine scores: https://community.bistudio.com/wiki/ArmA:_Rating_Values Just for info because BI documentation is not updated. You can use the MP event handler MPkilled. As any killed is civilian, you need to check the side of the victim before he dies: {_x setVariable ["oldSide",side _x]} forEach allUnits; // in a loop if you spawn units. then, for example: player addMPEventHandler ["MPkilled", { params ["_victim","_killer"]; if (!isplayer _killer or _victim == _killer) exitWith {}; if (_victim getVariable "oldSide" == west) exitWith { [_killer,{_this addRating -3000}] remoteExec ["call",_killer]; parseText "<t color = '#ff9900'>You just killed a friendly unit!<br/>Cease blue on blue.<t/>" remoteExec ["hintsilent",_killer]; }; if (_victim getVariable "oldSide" == civilian) exitWith { [_killer,{_this addRating -1000}] remoteExec ["call",_killer]; parseText "<t color = '#ffff00'>You just killed an innocent!<br/>Cease firing at unarmed civilians.<t/>" remoteExec ["hintsilent",_killer]; }; }]; Sorry just saw this response. I assume "{_x setVariable ["oldSide",side _x]} forEach allUnits; // in a loop if you spawn units." would go into a trigger detecting anyone and repeatedly set off? Or should I put this somewhere else, also _x should be replaced with EAST right? As for the second half of the code, would that go into a .sqf file? initServer? or what This is technically for a bounty system rather than killing civilians, so I would change the addrating to a positive, and if I wanted to remove the text prompt I could just delete that line parseText and it would run fine? Share this post Link to post Share on other sites
pierremgi 4743 Posted April 17, 2017 No need to "detect" somebody. allUnits is all units. If you're spawning units, especially enemies, allUnits must be updated to add (set) a variable with the side of the unit when alive. Why? Because, when dead, all units are civilian. In other words, in init.sqf, or in a script run by everyone, or in a trigger set to true: 0 = [] spawn { while {true} do { sleep 2; { if (isNil {_x getVariable "oldside"}) then { _x setVariable ["oldSide",side _x]; } } forEach allUnits; } }; 1 Share this post Link to post Share on other sites