Home   Help Search Login Register  

Author Topic: Delete the Dead...  (Read 812 times)

0 Members and 1 Guest are viewing this topic.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Delete the Dead...
« on: 19 Jan 2004, 00:22:22 »
I know there's few posts regarding this matter, I did a couple of searches but did not find anything concerning my prob... If there's already an answer please tell me where so we can pretend this post never even existed...  ::)

I've got a script that succesfully deletes the dead bodies. I do not want it to delete 'dead' vehicles which also works fine...

However, I'd like the script to delete the dead from inside the vehicles, so all dead crew members would be erased...
I've tried all I can think off so I thought maybe some of you can enlighten me...

Here's the code:
Code: [Select]
_unit    = _this select 0

#waitLoop
?(F_clearDead == 1): goto "delMen"
~3
goto "waitLoop"


#delMen
if (typeOf _unit != "Man") then {goto "delInside"} else {deleteVehicle _unit}

#delInside
if (!(alive driver _unit)) then {deleteVehicle driver _unit}
if (!(alive gunner _unit)) then {deleteVehicle gunner _unit}
if (!(alive commander _unit)) then {deleteVehicle commander _unit}

exit
Oh, almost forgot...
I run the script with "killed" eventHandler...
And apply it with trigger w/ forEach thisList...
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Tom Norman

  • Guest
Re:Delete the Dead...
« Reply #1 on: 19 Jan 2004, 01:47:54 »
Does this only work with those vehicles and units you create in game, or with those you installed with the editor?

Anyway, you might try teleporting the occupants out of the vehicle or ejecting them before deleting them.

Eg.

? !(Alive Driver _Unit): _DeadGuy = Driver _Unit; _DeadGuy SetPos [0,0,0]; deletevehicle _DeadGuy

or

? !(Alive Driver _Unit): _DeadGuy = Driver _Unit; _DeadGuy action["EJECT",_Unit]; deletevehicle _DeadGuy


It's might not working because you're targetting the driver, gunner and commander of a given vehicle.  Perhaps when they're dead they no longer assume that responsibility and you are therefor targetting bugger-all for deletion.  Perhaps you could designate the said unit a name initially (at the start of the script) so you can target them more precisely when you need to?

Altough perhaps not.  Not sure how it works with created units, but it's worth a shot.  Failing that, perhaps you can just teleport them through the floor and forget about them.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Delete the Dead...
« Reply #2 on: 19 Jan 2004, 02:09:40 »
Using it on plain ol' editor placed units...

I also thought that the once dead driver (or whatever) would not be the driver anymore, but tested it and it did return the drivers info altough he was dead...
But maybe the game just won't recognise him after all...

That teleport/delete is worth a shot though... Didn't even think of that...  :-[
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Tom Norman

  • Guest
Re:Delete the Dead...
« Reply #3 on: 19 Jan 2004, 02:15:42 »
Let me know if it works out for you.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Delete the Dead...
« Reply #4 on: 19 Jan 2004, 12:47:25 »
Well...

It worked...  :P

Actually it didn't at first but when I added a very short delay between the if/then sentences it started to work... Boy my CPU is crappy...
Gunner and commander were still removed from the vehicle without the delay but the driver wasn't... Which is very weird...

Only problem that remains now is that if the destroyed vehicle has any cargo the cargo won't get deleted...
Tried to monkey around with the crew command (since there's no command for cargo  >:( ) but with no results...

But anyhoo, thanks...  :cheers:
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
Re:Delete the Dead...
« Reply #5 on: 19 Jan 2004, 17:36:50 »
Place & name a gamelogic in the editor and move it into the drivers, gunners and cargo positions (mygamelogic moveindriver myvehicle, .. moveingunner .., etc). Then delete driver and gunner. Works for ppl in cargo, too (i think).

Tom Norman

  • Guest
Re:Delete the Dead...
« Reply #6 on: 19 Jan 2004, 20:19:37 »
Here's what you can do to pick out the cargo:

_ID = 0

#Update
? ((Crew _VehicleName) select _ID) == (Commander _VehicleName): _ID = _ID + 1; goto "Update"
? ((Crew _VehicleName) select _ID) == (Gunner _VehicleName): _ID = _ID + 1; goto "Update"
? ((Crew _VehicleName) select _ID) == (Driver _VehicleName): _ID = _ID + 1; goto "Update"

_Cargo = ((Crew _VehicleName) select _ID)
_Cargo SetPos [0,0,0]
~0.01
DeleteVehicle _Cargo
? (Count Crew _VehicleName) == 0: Exit
goto "Update"

That should help you pick them one by one, but assigning them all to one ID is something I'm still not sure how to do.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Delete the Dead...
« Reply #7 on: 20 Jan 2004, 13:32:05 »
Here's what you can do to pick out the cargo:

_ID = 0

#Update
? ((Crew _VehicleName) select _ID) == (Commander _VehicleName): _ID = _ID + 1; goto "Update"
? ((Crew _VehicleName) select _ID) == (Gunner _VehicleName): _ID = _ID + 1; goto "Update"
? ((Crew _VehicleName) select _ID) == (Driver _VehicleName): _ID = _ID + 1; goto "Update"

_Cargo = ((Crew _VehicleName) select _ID)
_Cargo SetPos [0,0,0]
~0.01
DeleteVehicle _Cargo
? (Count Crew _VehicleName) == 0: Exit
goto "Update"

That should help you pick them one by one, but assigning them all to one ID is something I'm still not sure how to do.
Worked like a charm...

Re-worked it a bit, but thnx anyhoo...

Solved.
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.