Jump to content
revv

How To Check If Trigger Area is Clear Of Everything?

Recommended Posts

As the title says I am trying to do a check if a trigger area is completely empty before spawning an object via an addAction.
Here is the addAction on an object:

this allowDamage false;
this enableSimulation disable;
this addAction ["Get Wheel","scripts\boxWheel.sqf"];

and here is the script:

wheelBox = [getPos boxSpawn,0,"ACE_Wheel",WEST] call BIS_fnc_spawnVehicle;

the name of my trigger is: boxTrigger_01
How do I set it to check if the trigger area is completely empty before executing the addAction/script?

Share this post


Link to post
Share on other sites

If you just wnt to prevent spawned object from spawning in colision with buildings or trees, then findsafepos should be enough.

 

example from the wiki:

Find position minimum 1m from from player but not further than 150m, not closer than 3m to any other object, not in the water, maximum gradient of 20, not on the shoreline:
_pos = [player, 1, 150, 3, 0, 20, 0] call BIS_fnc_findSafePos;

 

Share this post


Link to post
Share on other sites

No the issue is I click the addAction to spawn a wheel on the pad then click it again and it spawns into the first one which results in a wheel flying up to the sky. I just need to check if either the pad or trigger area are clear of all objects then spawn i, if not clear maybe show a hint

Share this post


Link to post
Share on other sites

What about adding deletevehicle to the script?  i gues you have some "spawner" with the addaction  close to the spawn place, a noticeboard maybe?

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

 

Share this post


Link to post
Share on other sites

I have a crate with the addAction to spawn the wheel just a meter or two away and there's another crate which does the same for tracks, I don't really want to delete anything just check if it's clear

Share this post


Link to post
Share on other sites

found this not exacly what you want, but looks simmilar.

Share this post


Link to post
Share on other sites
6 minutes ago, Mirek said:

found this not exacly what you want, but looks simmilar.

similar but his is more specific I just want to check for any or all objects/vehicles, thanks though!

Share this post


Link to post
Share on other sites

inAreaArray is nice for this, use the first syntax with nearObjects:

- Search around the trigger position
- Use "All" as types, otherwise honeybees and terrain objects may interfere. Search radius is trigger area
- nearObjects also finds the trigger itself so remove it from the search result

- use that final nearObjects result with  inAreaArray boxTrigger_01 and count the resulting array
- if count == 0 --> free to create wheel

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

×