Home   Help Search Login Register  

Author Topic: Removing dead bodies and destroyed vehicles  (Read 2583 times)

0 Members and 1 Guest are viewing this topic.

Offline bardosy

  • Honoured Contributor
  • ***
  • campaign designer
    • CartooDiv
Removing dead bodies and destroyed vehicles
« 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?
Fix bayonet!

Offline i0n0s

  • Moderator
  • *****
Re: Removing dead bodies and destroyed vehicles
« Reply #1 on: 21 Sep 2009, 11:19:14 »
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?

Offline bardosy

  • Honoured Contributor
  • ***
  • campaign designer
    • CartooDiv
Re: Removing dead bodies and destroyed vehicles
« Reply #2 on: 21 Sep 2009, 12:54:15 »
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...


Code: [Select]
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.
Fix bayonet!

Offline i0n0s

  • Moderator
  • *****
Re: Removing dead bodies and destroyed vehicles
« Reply #3 on: 21 Sep 2009, 13:46:20 »
killed units doesn't appear in allUnits.
Try to add an "killed" event handler to those units.

Offline bardosy

  • Honoured Contributor
  • ***
  • campaign designer
    • CartooDiv
Re: Removing dead bodies and destroyed vehicles
« Reply #4 on: 21 Sep 2009, 14:07:19 »
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
Code: [Select]
deletable = []
in the creator script
Code: [Select]
deletable = deletable + units _group
and funeral script (above):
Code: [Select]
forEach deletable
Fix bayonet!

Offline i0n0s

  • Moderator
  • *****
Re: Removing dead bodies and destroyed vehicles
« Reply #5 on: 21 Sep 2009, 14:53:48 »
:D
side of death units is civil

Offline bardosy

  • Honoured Contributor
  • ***
  • campaign designer
    • CartooDiv
Re: Removing dead bodies and destroyed vehicles
« Reply #6 on: 21 Sep 2009, 15:05:27 »
Thanks!  :D

And the destroyed vehicles?
Fix bayonet!

Offline i0n0s

  • Moderator
  • *****
Re: Removing dead bodies and destroyed vehicles
« Reply #7 on: 21 Sep 2009, 16:19:36 »
*starting ArmA II*
*placing M1A1 with health = 0*
*shooting at the M1A1 since not destroyed*
*boom*
*side M1A1 = CIV*
:)

Offline bardosy

  • Honoured Contributor
  • ***
  • campaign designer
    • CartooDiv
Re: Removing dead bodies and destroyed vehicles
« Reply #8 on: 22 Sep 2009, 07:32:21 »
Thnak you for the CIV info. I tried it yestersday and everything is fine!
Fix bayonet!