Jump to content
Sign in to follow this  
maxjoiner

Create unit in random pos from x to y

Recommended Posts

Hi all, I have a little problem.

When I create a unit in a random position ex:

_grp1 = Creategroup civilian;

_civil1 = _grp1 createUnit ["RU_Citizen2",position player, [], 300, "NONE"];

often that unit appears in front of player.

I'd like that 300 starts from 200 until 300.

Is it possible?

Share this post


Link to post
Share on other sites

Yes it is, but you have to calculate a position yourself. This is one way:

_grp1 = Creategroup civilian;
//Find a position between 200 and 300m from the player
_pos = [getPos player, 200 + random 100, random 360] call BIS_fnc_relPos;
//Spawn exactly on our own calculated random position
_civil1 = _grp1 createUnit ["RU_Citizen2",_pos, [], 0, "NONE"]; 

Share this post


Link to post
Share on other sites

I find this script very useful for the Stalker Mod to respawn a bloodsucker at a random position, but I do not know how is it going to behave in MP. Is the Bloodsucker respawning around which player? the one who activated it? I have this for single player working fine.

---------- Post added at 12:32 AM ---------- Previous post was at 12:26 AM ----------

And by the way, how can I give to the respawned unit the weapons I want?

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  

×