Jump to content
sinny

Let the player decide where to spawn

Recommended Posts

Hello,

 

Is it possible that before a mission starts, get the opportunity with the mouse cursor to point out on the map where you want to spawn?

 

I thinking that the player could pointing at a place where the player wants to spawns and all the vehicles and friendly AI's will spawn there...

 

Has enyone seen something like that? 

Is it even possible?

Share this post


Link to post
Share on other sites

Wow, thanks for quick answer!

Share this post


Link to post
Share on other sites

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

 

For using complete vanilla, scroll down to MenuPosition. you'll want to add a respawn template to the description .ext, and it will automatically recognize new respawn points placed in zeus. You could probably even temporarily give a person zeus at the start to place the respawn point down, and then gets the position of that point and spawns structures and vehicles relative to is. I'm rambling again, MCC probably does it better.

Share this post


Link to post
Share on other sites

Quick simple example ripped from an old mission and updated with new EHs.

//initPlayerLocal.sqf

waitUntil { disableSerialization; ( time > 0 || getClientState isEqualTo "BRIEFING READ" ) && !isNull ( call BIS_fnc_displayMission ) };

//If the player does not have a map give him one to enable choosing start position
private _hasMap = true;
if !( "ItemMap" in assignedItems player ) then {
	_hasMap = false;
	player linkItem "ItemMap";
};

openMap true;
cutText ["Choose your insertion point","BLACK IN",10];
waitUntil{ visibleMap };

//Do we have a marker denoting a default position to show on the map
if !( getMarkerPos "default_start" isEqualTo [0,0,0] ) then {
	mapAnimAdd [ 0, 0.08, getMarkerPos "default_start" ];
}else{
	mapAnimAdd [ 0, 0.08, [ worldSize/2, worldSize/2 ] ];
};

mapAnimCommit;

//Make sure player cannot close map
_forceMap = addMissionEventHandler [ "Draw3D", {
	if !( visibleMap ) then {
		openMap true;
	};
}];

//Event to capture player chosen position
_clickMap = addMissionEventHandler [ "MapSingleClick", {
	playerStartPos = _this select 1;
}];

waitUntil{ !isNil "playerStartPos" };

removeMissionEventHandler [ "MapSingleClick", _clickMap ];

//If water place player at surface
if ( surfaceIsWater playerStartPos ) then {
	player setPosASLW playerStartPos;
}else{
	player setPosATL playerStartPos;
};

//Use playerStartPos here to move anything relative to the choosen position

removeMissionEventHandler [ "Draw3D", _forceMap ];

cutText ["Inserting at choosen location","BLACK IN",10];
openMap false;

//If player did not start with a map then remove given one
if !( _hasMap ) then {
	player unlinkItem "ItemMap";
};
Map opens at map center unless "default_start" marker is defined. player is placed at the position he clicked, if its water he is placed on the surface.

Can be improved some but will do as a quick example.

  • Like 2

Share this post


Link to post
Share on other sites

Wow, you are the best!

Many thanks!

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

×