pendaz 10 Posted January 1, 2017 Hi All I'm wondering if its possible and if so how i can use Respawn Positions and specify certain areas to spawn it. For example. I have a mission with 2 towns that players will spawn in. I would like the players to be able to select on the respawn screen for example "Elektro" as a spawn area, but have the player load in to specified areas around the town. When i use a Respawn Module in Eden editor i am able to select the town i want to spawn in but i load in at the position of the marker. I want to some how link player spawns to this marker so they load in at the player spawns rather than on the actual marker itsself? If that doesn't make sense i think what i'm trying to re-create is similar to the respawn mechanics from DayZ Origins... Thanks in advance Share this post Link to post Share on other sites
davidoss 552 Posted January 1, 2017 So you want to respawn player on certain location with randomization of exact position? in that case simply respawn eventhandler would do the job + description.ext respawnOnStart = 1; Share this post Link to post Share on other sites
pendaz 10 Posted January 1, 2017 4 hours ago, davidoss said: So you want to respawn player on certain location with randomization of exact position? in that case simply respawn eventhandler would do the job + description.ext respawnOnStart = 1; Thanks for the reply, but could you elaborate a little? I've created Description.ext and added the line: respawnOnStart = 1; Placed an Infantry Respawn Module and named it "respawn_west" Added a bluefor unit, set my custom loadout Launched the mission in MP This allows me to select the Respawn Module for the town i want to spawn on (which is what i want) but i still spawn exactly on the respawn marker (which is not what i want) How can i have the player spawn at other locations after selecting the respawn marker? Share this post Link to post Share on other sites
killzone_kid 1332 Posted January 1, 2017 does it have placement radius value in the module? Share this post Link to post Share on other sites
pendaz 10 Posted January 1, 2017 36 minutes ago, killzone_kid said: does it have placement radius value in the module? No, but if i use this method players will spawn within the radius which will include the areas i don't want. Is it not possible to set an array of player spawns and assign them to a Respawn Module so when the player spawn on the respawn module it randomly selects a position to place the player? Share this post Link to post Share on other sites
Larrow 2823 Posted January 2, 2017 (edited) You can use GameLogics as your respawn points and when the player respawns you can get his chosen respawn point from the UINamespace variables BIS_RscRespawnControls_selected - holds selected index chosen in respawn position list BIS_RscRespawnControls_posMetadata - holds data about each respawn position < this variable gets wiped quickly after respawn You can sync triggers to your GameLogics and just use these to denote the areas to spawn the players in. So when the player respawns get the GameLogic he chose, get the triggers synced to the logic, chose a random placement with in the size of the trigger and then move him there. So for instance lets say on Stratis I place two GameLogics called "Town" and "AirBase". For each GL I place three triggers nearby and size to reflect the area I want the player to spawn in and sync them to the GL. "Town" I will place some where near to Agia Maria and "AirBase" near the Airport. initServer.sqf { _gl = _x; //Add GL as Respawn poisition for side West //Respawn point names as per GL name [ west, _gl, vehicleVarName _gl ] call BIS_fnc_addRespawnPosition; //Get synced triggers _triggers = synchronizedObjects _gl select{ typeOf _x isKindOf "EmptyDetector" }; //For each trigger make a marker of the same dimension and color red { _marker = [ format[ "%1_%2", vehicleVarName _gl, _forEachIndex ], _x ] call BIS_fnc_markerToTrigger; _marker setMarkerColor "ColorRed"; }forEach _triggers; }forEach [ Town, AirBase ]; //GameLogics Set each GL as a respawn position and name the respawn positions the same as each logics name. I have added markers to the triggers for testing. initPlayerLocal.sqf params[ "_player" ]; //Add respawn EH to player _player addEventHandler [ "Respawn", { //Get selected index from respawn menu _selected = ( uiNamespace getVariable "BIS_RscRespawnControls_selected" ) select 0; //Get respawn menu data _data = uiNamespace getVariable "BIS_RscRespawnControls_posMetadata"; //Sort data as the repsawn listbox is sorted by positions name _data sort true; //Get select GL _object = _data select _selected select 0 select 0; //Get GLs synched triggers _areas = synchronizedObjects _object select{ typeOf _x isKindOf "EmptyDetector" }; //If we have some triggers if ( count _areas > 0 ) then { //Select a random one _area = selectRandom _areas; //Get triggers area parameters triggerArea _area params[ "_a", "_b", "_angle", "_isRect" ]; //Get triggers position _pos = getPos _area; //If its a rectangle _xy = if ( _isRect ) then { //Get random offset based on triggers size _x = ( random ( _a * 2 )) - _a; _y = ( random ( _b * 2 )) - _b; [ _x, _y ] }else{ //If its a ellipse //Get random offset based on triggers size _x = random (( sin random 360 ) * _a ); _y = random (( cos random 360 ) * _b ); [ _x, _y ] }; //Rotate offset by trigger angle _xyz = ( [ _xy, -_angle ] call BIS_fnc_rotateVector2D ) + [ 0 ]; //Add offset to triggers position _pos = _pos vectorAdd _xyz; _nul = _pos spawn { //Make sure player has respawned waitUntil { alive player }; //Move him to calculated position player setPosATL _this; }; }; }]; When the player respawns get the triggers synced to the chosen GL and spawn the player somewhere within the area of a random one. TestMission Think that all works out properly didnt put my math through much testing. Edited January 2, 2017 by Larrow changed script as named respawn positions are sorted in respawn menu Share this post Link to post Share on other sites