Jump to content
BlackbirdSD

Is it possible to teleport anywhere by using a radio command?

Recommended Posts

As in a previous post about getting stuck in a rock, is it possible to teleport out where I want on the map, by using a radio command?

Thanks

Share this post


Link to post
Share on other sites

@BlackbirdSD,

A button like this would work in Single-player,

Spoiler

you_resetPos= player addAction ["Reset Postition", {

	private	_pos = [player, 1, 150, 3, 0, 20, 0] call BIS_fnc_findSafePos;
	player setPos _pos;
				
		},[],9,true,true,"","alive player && isNull objectParent player"];

 

In Multi-player each playable unit would need the button applied.

findSafePos

Have fun!

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, wogz187 said:

@BlackbirdSD,

A button like this would work in Single-player,

  Hide contents


you_resetPos= player addAction ["Reset Postition", {

	private	_pos = [player, 1, 150, 3, 0, 20, 0] call BIS_fnc_findSafePos;
	player setPos _pos;
				
		},[],9,true,true,"","alive player && isNull objectParent player"];

 

In Multi-player each playable unit would need the button applied.

findSafePos

Have fun!

For multiplayer does that go in the init field?

Share this post


Link to post
Share on other sites
1 hour ago, Harzach said:

setPos

onMapSingleClick

 

Or if you're running your mission from the editor, just hold ALT and click on the map.

WOW I never knew that before.  Does running a mission from the editor have a negative effect on FPS or any other issues?

Thanks

Share this post


Link to post
Share on other sites
1 hour ago, wogz187 said:

@BlackbirdSD,

A button like this would work in Single-player,

  Hide contents


you_resetPos= player addAction ["Reset Postition", {

	private	_pos = [player, 1, 150, 3, 0, 20, 0] call BIS_fnc_findSafePos;
	player setPos _pos;
				
		},[],9,true,true,"","alive player && isNull objectParent player"];

 

In Multi-player each playable unit would need the button applied.

findSafePos

Have fun!

Is it possible to limit the amount of uses?  Also can it be used in a radio command instead so its not so easy to use by accident?

Share this post


Link to post
Share on other sites
1 hour ago, wogz187 said:

@BlackbirdSD,

A button like this would work in Single-player,

  Hide contents


you_resetPos= player addAction ["Reset Postition", {

	private	_pos = [player, 1, 150, 3, 0, 20, 0] call BIS_fnc_findSafePos;
	player setPos _pos;
				
		},[],9,true,true,"","alive player && isNull objectParent player"];

 

In Multi-player each playable unit would need the button applied.

findSafePos

Have fun!

Can you explain this more please? "In Multi-player each playable unit would need the button applied."  How so?  This does work in single player as you say but not multiplayer when adding this to the init feild of the player.

Share this post


Link to post
Share on other sites

Or just jump on top of this rock/building:


 

player addAction ["unstick", {
  params ["_plyr"];
  _pos = (getPos _plyr vectorAdd [0,0,100]);
  _plyr setVehiclePosition [_pos,[],0,"CAN_COLLIDE"]
}];

In MP add it in initPlayerLocal.sqf (and in your respawn code).

Share this post


Link to post
Share on other sites
5 hours ago, pierremgi said:

Or just jump on top of this rock/building:


 


player addAction ["unstick", {
  params ["_plyr"];
  _pos = (getPos _plyr vectorAdd [0,0,100]);
  _plyr setVehiclePosition [_pos,[],0,"CAN_COLLIDE"]
}];

In MP add it in initPlayerLocal.sqf (and in your respawn code).

Thank you.

Share this post


Link to post
Share on other sites

In MP, it's a little bit weird, allowing the players to act this code which work also for any house/building. On the other hand, this is not very resource demanding because the code only runs when the player decides it, not depending on a (complex) condition loop waiting for him to be stuck inside a rock.

 

So, you can improve this addAction (condition / menu ), keeping in mind that condition into it is on each framed;

 

or, try to find an event handler (+ condition) to limit how many times this condition is checked. As examples, even if this EH has nothing to do with the purpose, an opening inventory could run a check for player stuck (in a rock) but you have to explain the inventory opening is (also) a tool for that. You can also add this in a "animation Changed" event handler. It's rather natural for a player trying to crouch or prone when stuck, so he could be freed without thinking about something special. But here, this EH fires far more often than the inventory opening one (but far less than each frame).

I hope it's clear: check for condition / condition is pretty demanding / so avoid checking too often / use an EH, specific or not, as support of this check.

Example: When stuck in rock (above) player, if player prone, he is freed:

 

player addEventHandler ["animChanged", {
  params ["_plyr","_anim"];
  if (_anim find "pne" > -1) then {
    private _rocks = nearestTerrainObjects [getpos _plyr, ["rock"],20];
    private _ceils = (lineIntersectsSurfaces [getPosASL player vectorAdd [0,0,50],getposASL player,objNull,player,false,-1,"VIEW","FIRE"]);
    if (!(_rocks isEqualTo []) && {!(_ceils isEqualTo [])} && {_ceils #0#2 in _rocks}) then {
      _plyr setposASL _ceils #0#0;
    };
  };
}];

 

Share this post


Link to post
Share on other sites

Your other method works perfect for getting out of the rocks and that was all i really wanted.  Thank you

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

×