Jump to content
Sign in to follow this  
Vectif

How to make an addAction teleport player in radius to player that used the Action

Recommended Posts

hello! I'd like to know how I could make an addAction so that when a player is within X radius of an area (e.g. within a house, or inside of a trigger area), if a player uses the addAction command it'll teleport that player, or any within those conditions, to them. This addaction shouldn't be for everyone but only for specific units. 

 

How would I go about doing this?

Thanks!

Share this post


Link to post
Share on other sites
17 minutes ago, stanhope said:

What's the intended use case? 

Funny I thought of including that originally but I went straight to the point haha.

I am making non-Zeused missions for my unit, aka I will script a mission to work entirely as it is on it's own without needing to go into Zeus unless something goes critically wrong, someone DCs or glitches out. I run other scripts and such to make the mission flow interesting, have things a bit more intricate than with Zeus, and randomised so even I don't know exactly what's going on.

Nonetheless, I realised that an issue happens if a player disconnects, or crashes - that when they rejoin, I'd have to go tab out and get into Zeus and teleport them in. I wanted to be able to have an addAction synchronized to my unit (my player character) so that when this happens, I could teleport said person to me in a quicker manner, since Zeus also takes a while for me to load.

I thought that the best way to go about it was to make a "ready for TP" or "go there if you're ready" area in the base or respawn so that once they get their kits ready and can be TPd, I just trigger that addAction and if they're within that area, they'll get teleported to me.

Share this post


Link to post
Share on other sites

Create an addaction that sets a global variable on the player that wants to be teleported using setVariable (for example: player addAction ["Ready to TP", {player setVariable ["_readyToTp", true, true]}];) And have an action on you that teleports all players who have said variable (for example: player addAction ["TP all ready players", {  {if (_x getVariable ["_readyToTp", false]) then {_x setPos (getPos player)};} forEach allPlayers;}];)  (code is untested but you should get the idea).  I'd add some conditions to it so the actions don't show up for players if they're already ready or if they're too far from base. 

  • Like 1

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  

×