Jump to content
moldyshoe

Scripting: How to delete all objects in defined radius (trigger, marker, etc)

Recommended Posts

Hey guys! First post! Iv'e lurked here and there before however.
So my situation is that I got a little carried away with the amount of detail I used to create a base. Little objects and shit everywhere to give "life" to the environment. Problem with that is the frames took a pretty decent hit and considering the amount of objects, no surprise.

 

What I propose as a solution is to keep the detailed base at the beginning of a multiplayer mission and once a certain distance is reached from the base delete every object in the vicinity and replace it with utilitarian ammo boxes, med supplies and perhaps a couple of these http://www.armaholic.com/page.php?id=23020

 

However, i'm pretty stumped as to how to achieve that. Iv'e googled around and tried playing around with steps: 3 & 15 of this post: https://forums.bistudio.com/topic/165902-creating-objects-from-mcc-via-trigger-and-deleting-them-later/ however, this isn't quite the solution I was looking for as it requires all of my objects to be called by script in the first place to then delete them later and stacked objects get really jacked up and I would prefer my objects to be there in the first place; placed from the editor. 

Any help would be greatly appreciated. I'm sure it's a simple fix, unfortunately my meager scripting knowledge extends about as far as a baby's arm.

Share this post


Link to post
Share on other sites

Hmm, i'm not sure what i'm doing wrong but it doesn't seem that I can get this to work. I put down a trigger and named it "triggerArea1". In the ON ACT. field I copied and pasted from the example. That didn't work so I tried naming a marker "triggerArea1" as well as a regular nearby object to no avail.

 

All the same, I think that this command displaces the objects to somewhere else on the map. Where as deleting all of the objects makes a difference of up to 10-12 frames halfway across the map and ~18 frames up close. Haha, damn that's bad  :rolleyes:

Share this post


Link to post
Share on other sites

Hmm, i'm not sure what i'm doing wrong but it doesn't seem that I can get this to work. I put down a trigger and named it "triggerArea1". In the ON ACT. field I copied and pasted from the example. That didn't work so I tried naming a marker "triggerArea1" as well as a regular nearby object to no avail.

 

All the same, I think that this command displaces the objects to somewhere else on the map. Where as deleting all of the objects makes a difference of up to 10-12 frames halfway across the map and ~18 frames up close. Haha, damn that's bad  :rolleyes:

 

 

Forget about that function, I didn't read it properly, it only moves the objects, for cutscene purpose.

 

In order to delete all objects, use the following code:

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

For specific objects, replace ["all"] with ["classname1","classname2","classnameN"]

 

For more details look here https://community.bistudio.com/wiki/nearestObjects

 

Sorry for the inconvenience I caused by leading you to the wrong function.

  • Like 4
  • Thanks 2

Share this post


Link to post
Share on other sites

Forget about that function, I didn't read it properly, it only moves the objects, for cutscene purpose.

 

In order to delete all objects, use the following code:

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

For specific objects, replace ["all"] with ["classname1","classname2","classnameN"]

 

For more details look here https://community.bistudio.com/wiki/nearestObjects

 

Sorry for the inconvenience I caused by leading you to the wrong function.

 

WOOHOO! That worked! 

And no worries about the other function, i'm just glad people like you are willing to help  :lol: 

I'll try my best to take it from here, you've already helped immensely. Thank you!

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

×