Jump to content
Nicole_UK

Delete everything in trigger area - NEED HELP

Recommended Posts

Hello! Im needing some help with deleting stuff inside a trigger area.

 

Im wanting to make my own base, its very detailed and will be very laggy to keep for the whole mission. Im only at the base for the start of the mission then I travel away. I am wanting to be able to delete everything when I am away from it.

 

Im thinking I need to make a trigger big enough to cover my base then when I move away and pass another trigger which deletes everything in the first trigger?

 

Iv seen someone on a similar post say you can do it by using   

{deleteVehicle _x} forEach nearestObjects [player, ["all"], 200]

  but Im not sure where to put this. Also Im not wanting the nearest objects to me to be deleted Im wanting everything inside a trigger area to be deleted (objects, vehicles, ai units, the whole base) when I am far enough away from it.

 

Can someone help me please? It seems like it should be really simple but Im struggling lol

Share this post


Link to post
Share on other sites

@Nicole_UK,

Remove or hide/show all objects in a layer,

Spoiler

=========================hide or remove layers==========================
EXAMPLE: hide layers
[["layer_0", "layer_1"] true] call you_hide_layers

EXAMPLE: show layers
[["layer_0", "layer_1"]] call you_hide_layers

EXAMPLE: remove (permanent)
[["layer_0", "layer_1"], false, true] call you_hide_layers
========================================================================

you_hide_layers={

    params [["_layers", []], ["_show", false], ["_remove", false], ["_exec", {}]];

    if _remove then {_exec ={deleteVehicle _x}} else {_exec= {_x hideObjectGlobal _show}};

    for "_i" from 0 to count _layers -1  do {
        {call _exec} forEach ((getMissionLayerEntities (_layers select _i)) select 0)
    }
};

Put your base objects in a layer and then call this function on the layer. You can delete the objects (see 3rd example) or just hide/show them when appropriate.

Have fun!

  • Like 3

Share this post


Link to post
Share on other sites
1 hour ago, wogz187 said:

you_hide_layers={ params [["_layers", []], ["_show", false], ["_remove", false], ["_exec", {}]]; if _remove then {_exec ={deleteVehicle _x}} else {_exec= {_x hideObjectGlobal _show}}; for "_i" from 0 to count _layers -1 do { {call _exec} forEach ((getMissionLayerEntities (_layers select _i)) select 0) } };

 

Thanks for replying! So I just add this code to a layer and it will remove everything? (including the ai units and vehicles aswell as the objects?) and how does this work in terms of removing them? does it remove them after I am a certain distance away... sorry for the questions I havent done a layer thing before (Im still learning when it comes to mission making)

Share this post


Link to post
Share on other sites

@Nicole_UK,

Quote

So I just add this code to a layer and it will remove everything?


1) Create a new layer (folder) in the editor and title it something like "base_objects"
2) Place your base objects into this new folder
3) Create a trigger on your base, player activated (not present)
4) Paste, (to delete)

[["base_objects"], false, true] call you_hide_layers

in the trigger ON ACTIVATION field

or

3) Create a trigger on your base, player activated (present), repeatable
4) Paste, (to toggle show/hide)
ON ACTIVATION:

[["base_objects"]] call you_hide_layers

ON DEACTIVATION:

[["base_objects"] true] call you_hide_layers

5) Paste the function somewhere, it only has to be loaded once. It can go basically anywhere. Paste it in your player's init field if you like.

you_hide_layers={

    params [["_layers", []], ["_show", false], ["_remove", false], ["_exec", {}]];

    if _remove then {_exec ={deleteVehicle _x}} else {_exec= {_x hideObjectGlobal _show}};

    for "_i" from 0 to count _layers -1  do {
        {call _exec} forEach ((getMissionLayerEntities (_layers select _i)) select 0)
    }
};

Have fun!

  • Like 3

Share this post


Link to post
Share on other sites

@Nicole_UK,
To do what you originally asked,

{ deleteVehicle _x } forEach (nearestObjects [thisTrigger, ["all"], (triggerArea thisTrigger) select 0]);

in a trigger which includes all the base objects within its area.

Have fun!

  • Like 4

Share this post


Link to post
Share on other sites

Thank you so much!!

 

I will try this tonight and see how i get on! 

 

really appreciate your help 🙂

Share this post


Link to post
Share on other sites

@Nicole_UK

 

 

You don't need a trigger around your base.

 

Just name an object in roughly the middle of your base, and name it,  MyBase

 

In the trigger that you want the player to enter that will delete the base, put in the on activation field.

 

Quote

{deleteVehicle _x} forEach nearestObjects [MyBase, ["all"], 200];

 

 

This will delete everything within 200 meters of the object named, MyBase

 

Note  When I say it will delete everything, I mean the objects you placed in the editor, not objects that are part of the map. 

 

 

  • Like 4

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×