Jump to content
Sign in to follow this  
alexluthor

Teleporting a whole group?

Recommended Posts

Hello all,

I'm in need of help regarding an attempt to teleport a soldier and his group to an LHD carrier. I found a great script on the net to teleport a single player using an add action in the init line of a flag. The original script goes like this:

Trigger / flag has - this addAction ["Teleport - Airfield","teleport.sqf",["Airfield"]];

Marker being called Airfield. (No real reason will edit this later)

Teleporting script

// Get the destination.

_dest = (_this select 3) select 0;

// Get a random direction

_dir = random 359;

// Move the person 15 meters away from the destination (in the direction of _dir)

player SetPos [(getMarkerPos _dest select 0)-10*sin(_dir),(getMarkerPos _dest select 1)-10*cos(_dir),+15];

I tried to modify it a bit, specially the last line so that it would do the same action to every member of the player's group using the code forEach command as described below:

// Get the destination.

_ldr = _this select 1; // Person who used the addAction

_dest = (_this select 3) select 0;

// Get a random direction

_dir = random 359;

// Move the person 15 meters away from the destination (in the direction of _dir)

{_ldr SetPos [(getMarkerPos _dest select 0)-10*sin(_dir),(getMarkerPos _dest select 1)-10*cos(_dir),+15]} forEach units group _ldr;

The code is not working. It teleports the player to the desired position but the members of his group are still left behind. Do you guys see what I'm doing wrong?

Thanks in advance for any help

AlexLuthor

Share this post


Link to post
Share on other sites
{[b]_x[/b] SetPos [(getMarkerPos _dest select 0)-10*sin(_dir),(getMarkerPos _dest select 1)-10*cos(_dir),+15]} forEach units group _ldr;

Share this post


Link to post
Share on other sites

Keep in mind, im not the best at Arma 3 Scripting, but i try.

{[B]_x[/B] SetPos [(getMarkerPos _dest select 0)-10*sin(_dir),(getMarkerPos _dest select 1)-10*cos(_dir),+15]} forEach units group _ldr;

So the script now looks like

 

// Get the destination.
_ldr = _this select 1; // Person who used the addAction
_dest = (_this select 3) select 0;


// Get a random direction
_dir = random 359;

// Move the person 15 meters away from the destination (in the direction of _dir)
{_x SetPos [(getMarkerPos _dest select 0)-10*sin(_dir),(getMarkerPos _dest select 1)-10*cos(_dir),+15]} forEach units group _ldr;

But when i run it i get an error on screen saying "Error missing ';'" on the line "{_x SetPos [(getMarkerPos _dest select 0)-10*sin(_dir),(getMarkerPos _dest select 1)-10*cos(_dir),+15]} forEach units group _ldr;" any ideas why?

 

EDIT : I know this post is like 6 years old... Just wanting to know if there may be a new way ?

Edited by Carl Taka

Share this post


Link to post
Share on other sites

never mind, just realised that {[B]_x[/B] SetPos [(getMarkerPos _dest select 0)-10*sin(_dir),(getMarkerPos _dest select 1)-10*cos(_dir),+15]} forEach units group _ldr; doesnt require the and

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  

×