In my detect dead body script I want to make it possible to set a variable (LAGGY_FindBody_checkaccidents) to true or false concerning accepting if the dead unit was killed even by accident or just fire.
My script earlier dealt with checking the config side of the dead unit and the unit that finds a dead body, but since I now want the script to care about the "current" side of the finding unit I have to convert a number into a string or text. This I can't get working.
The "side" of the dead unit still needs to be a number based on config, since all dead units become civilian.
Let's see:
if ((LAGGY_BodyAndFinderCombo select 0 == EAST) AND (LAGGY_BodyAndFinderCombo select 1 == EAST)) then
{
hint "OPFOR corpse detected by OPFOR unit";
};
This is the script that checks for different combinations.
Then the eventhandler:
_deadguy = _this select 0;
_killer = _this select 1;
_numsidedeadguy = getNumber (configFile >> "CfgVehicles" >> typeOf _deadguy >> "side");
if (_numsidedeadguy == 0) then {_deadguyside = EAST};
if (_numsidedeadguy == 1) then {_deadguyside = WEST};
if (_numsidedeadguy == 2) then {_deadguyside = GUER};
if (_numsidedeadguy == 3) then {_deadguyside = CIV};
_killerside = side _killer;
sleep 1;
if (! (LAGGY_FindBody_checkaccidents) AND (_deadguyside == _killerside)) exitWith {};
while { _deadguyside != _killerside AND ! (alive _deadguy) } do
{
_finders = nearestObjects [vehicle _deadguy, ["AllVehicles"], LAGGY_FindBody_searchradius];
if (count _finders > 1) then
{
{
if (_x != vehicle _deadguy AND (alive _x)) then
{
if ((_x knowsAbout vehicle _deadguy > 0) AND (_x knowsAbout vehicle _deadguy >= LAGGY_FindBody_awareness)) then
{
_searcherside = side _x; call compile format ["LAGGY_BodyAndFinderCombo = [%1, %2]", _deadguyside,_searcherside]; publicVariable "LAGGY_BodyAndFinderCombo"; sleep 5;
};
};
} forEach _finders;
};
sleep 2;
};
It doesn't work and I get NO error messages.
Laggy