Jump to content
Sign in to follow this  
Morten87

How do I Spawn a single unit, or groupe in a random house?

Recommended Posts

Hello.

I'am making a mission were I want a "high value target" to spawn in 1 of 3, buildings. How can I fix this?

thanks in advance :)

Share this post


Link to post
Share on other sites

put this into the activation field of a trigger

if (isnil "xxxpos") then {xxxpos = []}; xxxpos set [count xxxpos, getposasl player]; copyToClipboard str xxxpos;

set the trigger to a radio (alpha,beta, whatever) trigger and set it to repeatedly.

then you as the player/unit run around the map to where you want the person to possibley spawn at and use the radio trigger. the radio trigger grabs the location every time you activate it. so get all the random positions you want all at the same time.

when you are done getting your positions, open your notepad or whatever you use for scripting and press control v.. you should have something that looks like this

[[3569.4,3643.3,28.1114],[3571.77,3647.52,28.1114],[3569.35,3647.23,28.1114],[3573.69,3646.62,23.7164],[3573.47,3639.72,21.7414],[3575.34,3640.58,19.5514],[3573.37,3649.21,19.5514]]

thes are all the positions you just ran around and grabbed. now you need to add a few lines of code to so it will randomly choose 1 of those locations to put your HVT. the end product should look like this

if isserver then {private ["_pos","_arr"];    
_arr = [[3569.4,3643.3,28.1114],[3571.77,3647.52,28.1114],[3569.35,3647.23,28.1114],[3573.69,3646.62,23.7164],[3573.47,3639.72,21.7414],[3575.34,3640.58,19.5514],[3573.37,3649.21,19.5514]];    
_pos = _arr select floor random count _arr;   
this setposasl _pos;  }; 

you can put this code in the init field of a unit or run it thru a script, you just have to change

 this setposasl _pos;

to whatever your HVT's name is so it knows to move him.

hvtguy setposasl _pos;

Edited by Nimrod_Z

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
Sign in to follow this  

×