OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: nettrucker on 19 Nov 2007, 21:00:30
-
Hi
can someone help me out with this. I need all units in a trigger area deleted once the player is distant from the trigger. i did a search but didn't find anything.
What is the right syntax? I know the deletevehicle command, but I need everything in the trigger area to be deleted.
( deleteVehicle_x) forEach units thisList . . . I tried this but it gave me an error message. Can someone tell me the right syntax?
Any help is really appreciated.
thanks in advance
nettrucker :dunno:
-
The above syntax is correct, except for the fact you need to use curled braces {} for the forEach, and you don't need to use the units command (units is only used in conjunction with groups):
{deleteVehicle _x} forEach thisList
Remember to set the trigger activation to "Anybody", otherwise it'll just delete the units of the side specified. :)
Wolfrug out.
-
Hi wolfrug
thanks for your swift reply mate. I checked it and it worked right away but I'm still stuck maybe I should have explained myself a little bitter better and more precisely in the first message. Since the player is moving away from the trigger1 area where all units are supposed to be deleted I need this delete trigger1 to be activated by another trigger2 as a condition. Player reaches the new trigger2 area so the former trigger1 area will delete all units inside range.
I set trigger1
condition: delete
activation: {deleteVehicle _x} forEach thisList
trigger2 - activated by player
condition: this
activation: delete = true
but it doesn't work.
any ideas?
thanks
nettrucker :D :dunno:
-
If you're sure you've set up the triggers correctly, the problem may lie in your variable definition: it's always a good idea to first define a variable before using it (i.e., by giving it some value such as delete = false). So try putting somewhere (in your init.sqf/sqs preferably, but the Player unit's init field works fine for tests and such too) delete=false to declare that variable: it might work then! :good: Also, if you want to see if there's something wrong with the script you've written or something wrong with the trigger's activation, add a hint to the other trigger, something like: hint "Trigger started!"; to make sure it's at least triggered. :)
Wolfrug out.
-
Thanks a bunch I gonna try that right away.
nettrucker :D
-
Beware the anybody type triggers, you might end deleting also gamelogics vital for your game. Also, if you delete a vehicle, its crew will be "ejected" from it. So, for each vehicle you should take care to remove its crew first.
I havent tested nested foreach, it is up to you to try it:
{if (typeOf _x != "logic") then {{deleteVehicle _x} forEach crew _x;deleteVehicle _x};} forEach thisList
-
Hi Mandoble
Thanks for your help. I'll try that one too. well what i want to achieve is simply deleting units and objects in the trigger area to free ressources for the 2nd part of the mission so it won't be causing lag. i need simply to shift place in the mission. At a certain point all units in trigger1 aren't neccessary anymore and therefore i need them deleted.
I try to use the snippet you suggested now.
thanks for your reply
nettrucker :D
EDIT:
Both solutions worked perfectly thanks a lot. :good:
Regards
nettrucker :D
-
Sorry to butt in here, but if I only want to delete all units of a certain side within a trigger, how should I go about doing that?
-
jsut set da side dat activates da triger 2 da side ui wanna delete
if u wanna delete all OPFOR units have da activated by field as OPFOR
LCD OUT
-
Although Mandoble's care about logics is wise, it only protects the "logic" found in vanilla Arma. Since many addons contain derived logics, I think you'd be better protecting all types of logics:
{if (not (_x isKindOf "logic")) then {{deleteVehicle _x} forEach crew _x;deleteVehicle _x};} forEach thisList;
-
Hi everybody
sorry for digging up this old topic but I have still some issues with this. I did some extensive testing on the syntax. It will delete all units still alive when the trigger gets activated but dead units will remain. I need also the dead units to be removed but I really don't know how to implement this condition in the syntax of mandoble or spooner.
can anybody help me out?
thanks in advance
nettrucker :dunno:
-
You will not detect dead units with a trigger. Look for dead body remover scripts in the depot.
-
Thanks Mandoble
I found a remover script by Taurus are you referring to that one or is there something else.
Thanks
nettrucker :D