Jump to content
Schlingel mit Kringel

Player random spawn outside zone X but inside zone Y on mission start?

Recommended Posts

Title pretty much says it all: looking to spawn players (together as a group) in a random position on mission start that is located somewhere inside a ring around a fixed location. Having an ellipse would be optimal but a circle would do too if ellipse does not work.

 

For visualization: how to have the player group spawn in a random position in the blue zone only, not outside?

 

TIA

Share this post


Link to post
Share on other sites

Place a hundred markers on the map in the blue zone.

 

Select your soldier. Right click and select random start. Connect the man to each of the hundred markers. Yes, you need 100 connections.

 

Practice by using only 4 markers.  Then use the invisible markers so the markers cannot be seen during play,

Share this post


Link to post
Share on other sites

So, you want to find a position within the blue ellipse, but the red ellipse is blacklisted?

 

https://community.bistudio.com/wiki/BIS_fnc_findSafePos

 

A practical example:

_pos = ["bluemarkername", 1, 3, 2, 0, 45, 0, "redmarkername"] call BIS_fnc_findSafePos;
"respawnmarkername" setPos _pos;

 

  • Like 2

Share this post


Link to post
Share on other sites
waitUntil {!isNull player};
_randomPos = [["blueMarkerName"], ["water", "redMarkerName"]] call BIS_fnc_randomPos;
{_x setPos _randomPos} forEach units group player;

or BIS_fnc_findSafePos like Harzach says

  • Like 3

Share this post


Link to post
Share on other sites

My method moves the respawn marker, while @Crazy_Man's moves the player(s) after they spawn. Mine (I think) requires respawn on start, which can feel kind of janky if not done right (or at least creatively), while his requires all players to be spawned (or !isNull), which isn't JIP compatible.

  • Like 3

Share this post


Link to post
Share on other sites

If you don't use respawn you can use a global variable for the position.

 

initServer.sqf :

startPosition = ["bluemarkername", 1, 3, 2, 0, 45, 0, "redmarkername"] call BIS_fnc_findSafePos; 
publicVariable "startPosition";

initPlayerLocal.sqf :

waitUntil {!isNull player};
player setPos startPosition;

 

  • Like 3

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

×