OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: bardosy on 21 Sep 2009, 09:17:25
-
In OFP/ArmA1 I usually remove dead bodies to save CPU. But in ArmA II I couldn't.
First I tried new funcion: allUnit. So I create a forEch allUnits and when the not alive _x, I deleteVehicle _x. But it didn't work, because allUnits don't contain deads.
Second I create a list (eg: deletables = [];) and when I create new dynamic units, I added all to this list (deletables = deletables + units newgroup). And later I try again a forEach deletables... But same effect. In ArmA 2 the dead bodies automaticly removed from every list.
It's means in ArmA II, no need to delete dead bodies, because they don't use the CPU?
And how can I save the CPU in any other method?
-
Dead bodies shouldn't use the CPU at all.
They only take space when joining a server or when being displayed.
But your second method should work. Be aware that deleted units won't get removed from the array, even in ArmA.
Can you hand over some code?
-
I know it's not delete the deleted units from the list - but this version is used allUnits.
But believe me if I change the allUnits to a list name like "deletable", it will not delete the dead bodies...
LAC_needfuneral = true;
while {LAC_needfuneral} do {
{
if (side _x == EAST) then {
if (_x isKindOf "SoldierEB") then {
if (!alive _x) then {
if (_x distance player > 50) then {
deleteVehicle _X;
sleep 0.5;
};
};
};
if (_x isKindOf "LandVehicle") then {
if (getDammage _x > 0.8 and _x distance player > 150) then {
deleteVehicle _x;
sleep 0.5;
};
};
if (_x isKindOf "Air") then {
if (getDammage _x > 0.8 and _x distance player > 250) then {
deleteVehicle _x;
sleep 0.5;
};
};
};
} forEach allUnits;
sleep 15;
};
And I know, it works only for the east side, but it didn't. I created tests, with use "Hint" command and if I shoot down an east soldier, this script never chek him anymore... And didn't delete.
-
killed units doesn't appear in allUnits.
Try to add an "killed" event handler to those units.
-
I used a very own list (deletable) and I added every dynamically created units to this list and this script looped not allUnits but deletable and it didn't work neighter.
in the init.sqs
deletable = []
in the creator script
deletable = deletable + units _group
and funeral script (above):
forEach deletable
-
:D
side of death units is civil
-
Thanks! :D
And the destroyed vehicles?
-
*starting ArmA II*
*placing M1A1 with health = 0*
*shooting at the M1A1 since not destroyed*
*boom*
*side M1A1 = CIV*
:)
-
Thnak you for the CIV info. I tried it yestersday and everything is fine!