OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Trash Can Man on 05 May 2011, 05:48:09

Title: cleandead script?
Post by: Trash Can Man on 05 May 2011, 05:48:09
I have searched for a cleandead script for ofp but i am confused. Is there a script that will cleanup dead bodies,vehicles without us having to bury them? if so...where is it? I would like to have one that starts the moment we enter the mission and run all the time.

TCM
Title: Re: cleandead script?
Post by: Lone~Wolf on 05 May 2011, 10:11:10
A quick workaround that immediately comes to mind is to use a trigger which runs once for every unit on the battlefield by having the condition field to be:
Code: [Select]
{_x exec "removalscript.sqs"} forEach thislistand then writing the script such:
Code: [Select]
_p = _this

#START

@((!(alive _p))||(getdammage _p >= 1))
; When the unit is killed...

_randwait = (random 120)+60
; Pick a random time to wait
~(_randwait)
; Wait that amount of time

?(!(alive _p))||(getdammage _p >= 1) : deletevehicle _p; exit
goto "START"
; Check that they haven't respawned or come back to life and if not then delete their body and exit the script, otherwise go back to the start.
I just threw this together now so I can't guarantee it'll work but give it a try, or just search OFPEC for an already existing much better script.

Cheers.
Title: Re: cleandead script?
Post by: Trash Can Man on 05 May 2011, 21:59:30
well, i tried it   :confused:  I am uncertain what the activation should be...

TCM
Title: Re: cleandead script?
Post by: j0e on 06 May 2011, 12:41:22
The trigger parameters should be "ONCE", "PRESENT" and "ANYBODY".

However I have some notes and suggestions for you:

° trigger won't list empty vehicles (taken from "EMPTY" menu);
° trigger won't list vehicles;
° trigger will list only one crew of vehicles;

Do a test: place an armored vehicle in which
there are normally 3 soldiers (tanks, ..).
In the line "On Activation" write:

Hint Format ["%1",ThisList]

Maybe you expect to see 3 units + 1 vehicles in the hint message,
but surprise it is not so.
I don't remember which type of crew is listed, commander or driver.

° all machines will exec as many istances of the script as the listed units;

If you have 100 units, your machine execs 100 istances of the script.
I would use a unique script to monitor the units, but of course
the code must be structured in a different way.

° two or more machines COULD try to delete the same unit at the same time;

Yeah, not high probability, but still possible.

° after deletion, other machines COULD do a null-check;

This time the probability to happen is greater.
After a machine deleted a unit, f.e. "Alpha Black 1", the others could not
have reached in time the line:

?(!(alive _p))||(getdammage _p >= 1) : deletevehicle _p; exit

and since "Alpha Black 1" became a null-object, they'll do a null-check on "_p".
The program skips the null-check, because invalid, so the loop for
"Alpha Black 1" will never end.

° why to use "getdammage" and "!alive"?

Did I miss something?
I know "!Alive _p" is equal to "GetDammage _p==1", isn't?
Title: Re: cleandead script?
Post by: Trash Can Man on 07 May 2011, 22:11:45
lone wolf... u r a genius! It works very well, in fact too well! thanx for your help everyone! topic locked..

TCM($)