nuxil 2 Posted August 28, 2007 hi forum! i would like some help please.. well let me try to explain the issue. im trying to spawn/create a vehicle in a radius on 1-2 Km on map click. what i mean is that. when i click on the map. i want a vehicle to be created at a random position within a radius at 1-2 Km. "n e s w" from the click on the map. i want to simulate a inaccurat vehicile drop which i need to be looking for in my mission.. i got everything else to work exept this random positioning, how can i do this.? Share this post Link to post Share on other sites
[frl]myke 14 Posted August 28, 2007 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _map_click_pos = [x,y,z] _max_dist = 500 _dir = random 360 _nxc = _map_click_pos select 0 + ((random _max_dist))* sin _dir _nyc = _map_click_pos select 1 + ((random _max_dist))* cos _dir _drop_pos = [_nxc, _nyc] this snippet will calculate a random position in a radius of 500 (you might change this to your needs). You have to provide the mapclickposition in the first line, the random position you get in the last. And please, next time a better describing title than "Please help". Myke out Share this post Link to post Share on other sites
mattxr 9 Posted August 28, 2007 _grp = createGroup east; unit = _grp createUnit ["SoldierEAA", position player, [], 100, "FORM"] ; SoldierEAA = The Classname of the unit you want to spawn 100 = How many meters away from the players position you want it to spawn from. Random in that radius. Share this post Link to post Share on other sites