Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
AlphaKappa

How could I use "isFlatEmpty" to spawn a Scud launcher in a random flat/empty area?

Recommended Posts

I want to have a hidden Scud that spawns somewhere on the map, but obviously it needs to spawn on level ground so it doesn't look ridiculous. I really don't understand how to use "isFlatEmpty", so could one of you beautiful gentlemen help me out?

How should I go about scripting this beast?

Thanks in advance!

Share this post


Link to post
Share on other sites
Did you read the example of it on the wiki?

Yeah, I did, and I really tried to get it working but I just don't know how to make a Scud Launcher "search" for the nearest flat area. I just don't know what to do with it outside of that command.

Share this post


Link to post
Share on other sites

In might not be exactly what you want, but I've just used something similar and you're welcome to adapt it to your needs:

call compile preprocessfile "SHK_pos\shk_pos_init.sqf"; // Initialise the SHK_pos function.
_pos = ["c130loc"] call SHK_pos; //Use the SHK_pos function (http://forums.bistudio.com/showthread.php?89376-SHK_pos) to select a random within the area of the marker "c130loc" I have placed in the editor.
_newPos = _pos isFlatEmpty[50, 1, 0.7, 5, 0, false, c130]; //isFlatEmpty when given position _pos should return a flat and empty area close by if it can. If it cannot it returns an empty variable presumably. You may want to alter the values inside the square brackets.
while {(count _newPos) < 1} do { //Loop the following code so long as isFlatEmpty cannot find a valid position near the current _pos.
_pos = ["c130loc"] call SHK_pos;
_newPos = _pos isFlatEmpty[50, 1, 0.3, 40, 0, false, c130];
};

Then create/setPos the SCUD using _newPos as its position.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×