Warning: include(/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php): failed to open stream: No such file or directory in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Warning: include(): Failed opening '/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Notice: Undefined index: OFPEC in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152
    Home   Help Login Register  

Author Topic: cleandead script?  (Read 4230 times)

0 Members and 1 Guest are viewing this topic.

Offline Trash Can Man

  • Members
  • *
  • We are no longer the knights who say "Ni!"
cleandead script?
« 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

Offline Lone~Wolf

  • Mission Tools & Mods
  • Members
  • *
  • Vladimir Dmitri Mikhail Andreevich Stamenov
Re: cleandead script?
« Reply #1 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.
Snarling creature, lurking in the background, still writing in .sqs

Offline Trash Can Man

  • Members
  • *
  • We are no longer the knights who say "Ni!"
Re: cleandead script?
« Reply #2 on: 05 May 2011, 21:59:30 »
well, i tried it   :confused:  I am uncertain what the activation should be...

TCM

Offline j0e

  • Members
  • *
    • j0e's home
Re: cleandead script?
« Reply #3 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?

Offline Trash Can Man

  • Members
  • *
  • We are no longer the knights who say "Ni!"
Re: cleandead script?
« Reply #4 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($)