OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Serial Killer on 06 May 2005, 17:54:42
-
I need to make a random starting positions to group. How?
-
Place some empty markers on the map. Group them to the group leader. He will appear randomly at one of the markers or his original position. His group will appear around him assuming they are "In Formation".
It doesn't really matter, but I'd say this was a "General" question rather than an "Advanced" one.
-
Another question.. How can I delete the dead bodyes, when someone is dead?
-
Scripts in the Ed Depot.
-
That's all I need today :)
-
Just one more thing.. How can I activate a script for everyone in certain trigger area? I remember that it was something ...forEach thisList.
Here's what I want to be acitvated for everyone: this addeventhandler ["killed", {_this exec "erase.sqs"}]
-
put this in a trigger:
"_x addeventhandler [{killed},{_this exec {Dead.sqs}}]" forEach thislist
-
there is a more efficient way of deleting bodies than having every unit run a timed delete script or utilising a fast looping trigger
This is how it would work
The deadbody array is filled via an eventhandler killed on each ai unit
The system uses one array to fill another, then waits a period before it deletes the bodies from the newly created array
It then removes the elements in the new array from the old array and restarts the loop
This way a dead body waits at least 120 seconds (+ 60 random seconds) after death before it is removed
It uses
this addEventHandler ["killed", {tx_deadbody = tx_deadbody + [_this select 0]}]
;; in the init field of each unit
This removes the problem of having multiple remove dead body scripts running
(Very efficient when you have a hundred or so AI to kill) but allows the dead units to remain on the map for at least X seconds.
Here's the system
Mission editor
Init Field of each unit
this addEventHandler ["killed", {tx_deadbody = tx_deadbody + [_this select 0]}]
Init.sqs
?(local server): [] exec "deadbody.sqs"
deadbody.sqs
#INIT
tx_removebody = []
tx_deadbody = []
#START
tx_removebody = tx_deadbody
;; the following delay is the minimal amount of time you want a body to remain on the map
;; in the case below its between 2 and 3 minutes
~ 120 + (random 60)
{deletevehicle _x} forEach tx_removebody
tx_deadbody = (tx_deadbody - tx_removebody)
goto "START"
and heres a link to a random spawnpoint thread
http://www.ofpec.com/yabbse/index.php?board=7;action=display;threadid=23209
one day i will get around to publishing all my scripts for the editors depot