Jump to content
Sign in to follow this  
PixeL_GaMMa

detecting which respawn marker was selected

Recommended Posts

Hi there,

 

I'm having some issues finding a solution to my problem, basically when a player [re]spawns in from selecting any of the predefined or sleeping bag/camp respawn markers they have placed down, I would like script to have access to which spawn point was used, is this possible?

 

Any help would be appreciated.

Share this post


Link to post
Share on other sites

Do they choose from BIS  respawn menu or something else?

 

EDIT:

One method you could do something like:

player addEventHandler ["Respawn",
{
	hintSilent format ["You have spawned at: %1", mapGridPosition player];
}];

You can use distance command to check near object or something.

Share this post


Link to post
Share on other sites

hi, yes using the built in bis respawn menu, I currently do similar, but for example, I have one of my markers "respawn_opfor", and the marker is named Airdrop (this marker randomly moves around the map) - so when they respawn I set them in the air to paradrop in, however if they spawn at one of their sleeping bags, then they spawn on the ground, the problem with checking location is sometimes the marker may move just as it is checked for location which is a big issue.

  • Thanks 1

Share this post


Link to post
Share on other sites

Tested!

player addEventHandler ["WeaponAssembled",
{
	params ["_unit", "_staticWeapon"];
	_staticWeapon setVariable ["respawnPointName", "Camp Haz", true];
}];

player addEventHandler ["Respawn",
{
	_respawnPoints = nearestObjects [player, ["Land_TentDome_F"], 50];
	if (count _respawnPoints < 1) then
	{
		hintSilent format ["You have spawned at grid: %1", mapGridPosition player];
	} else
	{
		hintSilent format ["You have spawned at: %1", (_respawnPoints select 0) getVariable ["respawnPointName", "Unknown"]];
	};
}];

You can also do a check on respawn for nearest marker. The above method allows you to give specify a custom name. That will set all assembled to Camp Haz but you can have some ID which increments or something. It is a start! :)

  • Thanks 1

Share this post


Link to post
Share on other sites

Brilliant! Thanks, I never thought also about using local markers, much appreciated! :)

Share this post


Link to post
Share on other sites

Yeah. It all depends. You can even check nearby locations, etc... Town/city/village/airports/etc

Share this post


Link to post
Share on other sites

Just thinking also, when a tent is assembled, it would be considered "owned" by the player that placed it? so owner _obj should return the id of the player i would assume? If not i could always add that as a global variable.

 

e.g. would something like this work?

 

{
	if (owner _x == clientOwner) then {
		// ...
	};
} forEach _respawnPoints;

 

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  

×