Jump to content
Trilux

Deleting Objects Inside a Trigger

Recommended Posts

Yes I know this post has been made before and there’s countless different ways to resolve this but I’m attempting using a largely different formula with no variable names. Without using a script or external file I’ve created signs with a init to spawn aircraft on to a trigger using the code

 

[this, “Deploy A-10A”,

”\A3\Air_F_Jets\Plane_Fighter_01\Data\UI\Fighter01_icon_ca.paa”,

“\A3\Air_F_Jets\Plane_Fighter_01\Data\UI\Fighter01_icon_ca.paa”,

”player distance _target < 6”,

”player distance _target < 6”,

{ },

{ },

{createVehicle [“rhs_a10”, getPos aircraftpad, [ ], 0, “NONE”] setDir 270},

{ },

[[0,0,0]],

3,

0,

false,

false

] remoteExec [“BIS_fnc_holdActionAdd”, 0, this];

 

the code here works works beautifully and creates the vehicle desired and is copied and pasted on to different signs with different vehicles inserted instead and scrolling on the sign prompts a option to spawn the vehicle on the trigger after holding space for 3 seconds now I’m trying to make a sign that uses the same code above but in the command to run clears the objects inside of it being anything currently blocking the pad preventing a new vehicle to be spawned on the trigger. I’ve tried almost everything but when it does let me save it in Arma with no errors it doesn’t work or the code provided no longer works for example I’ve done.

 

[this, “Clear Pad”,

” “,

” “,

”player distance _target < 6”,

”player distance _target < 6”,

{ },

{ },

{{deleteVehicle _x} forEach nearestObjects [[aircraftpad], ["all"], 5]},

{ },

[[0,0,0]],

3,

0,

false,

false

] remoteExec [“BIS_fnc_holdActionAdd”, 0, this];

 

This ended up not removing the vehicle from the pad, I’ve been working on this with google for the past two days so figured I’d ask you brilliant people.

Share this post


Link to post
Share on other sites

You should look at the description for nearestObjects, because that's not the correct way to use nearestObjects. You could also leave the types array empty instead of using "all", but if you want to filter out planes use "Air":

{{deleteVehicle _x} forEach (nearestObjects [aircraftpad,["Air"],5])}

It might also be worth using a larger search radius than 5m. Plus, you might want to look at enabling showScriptErrors in the launcher to show when you've made an error.

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, beno_83au said:

You should look at the description for nearestObjects, because that's not the correct way to use nearestObjects. You could also leave the types array empty instead of using "all", but if you want to filter out planes use "Air":


{{deleteVehicle _x} forEach (nearestObjects [aircraftpad,["Air"],5])}

It might also be worth using a larger search radius than 5m. Plus, you might want to look at enabling showScriptErrors in the launcher to show when you've made an error.

I appreciate this greatly it's working the way intended, I can't thank you enough I apologize I thought I looked into this but couldn't figure it out as far as the ( ) placed in the wrong location that's completely an oversight I was following a fix for someone else that worked for them. https://forums.bohemia.net/forums/topic/183490-scripting-how-to-delete-all-objects-in-defined-radius-trigger-marker-etc/?do=findComment&comment=2896230 Not that I'm blaming them in any way that was completely overlooked and I didn't realize it's been in the wrong location.

  • Like 1

Share this post


Link to post
Share on other sites

@Trilux All good. It wasn't necessarily the ( ) being in the wrong place, it'll even work without them in this case due to certain commands taking priority over others (I feel like it's easier to read when using them anyway). The game breaker was the nearestObjects, which is why it's a good idea to have showScriptErrors on and have the script command wiki bookmarked to help you out 😉

Share this post


Link to post
Share on other sites
5 hours ago, Trilux said:

I’ve created signs with a init to spawn aircraft

There should be no need to remoteExec your holdAction. As the code is in the init of an object all clients loading the mission will run this init. Just place a normal full holdAction in the init without remoteExec.

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

×