Jump to content
yonose

TP script not working

Recommended Posts

I want to let the players to teleport to each location by scrolling on a flagpole and choose his destination.

MP mission a dedicated server, testing in the editor.

 

Im getting:

Error getpos: Type string, expected Object, Location

(last line is getting the error)

// Get the destination.
_dest = (_this select 3) select 0;

// Get a random direction
_dir = random 359;

// Move the person a few meters away from the destination (in the direction of _dir)
player SetPos [(getPos _dest select 0)-10*sin(_dir),(getPos _dest select 1)-10*cos(_dir)];

Im calling the script using:

this addAction ["<t color='#3751d0'>Base</t>","script\teleport.sqf",["tp_base"]];
this addAction ["<t color='#669c3c'>Infantry - Basic</t>","script\teleport.sqf",["tp_infbas"]];
this addAction ["<t color='#f0a71b'>Shootingrange</t>","script\teleport.sqf",["tp_shootingrange"]];

 

Share this post


Link to post
Share on other sites

This select 3 is the params array passed to the script executed by the addAction command.

First parameter (select 0) is a string.

Hence _dest is a string.

 

Cheers

Share this post


Link to post
Share on other sites

I tried "_dest = _this select 3;" instead, but it didnt work, now im getting "Error getpos: Type Array, expected Object, Location" instead.

Share this post


Link to post
Share on other sites

Keep:

_dest = _this select 3 select 0;

and, as you're playing with markers:

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

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Okey.. I thought if i used getPos instead of getMarkerPos, it would use the flagpole position instead of the marker.

So i renamed the markers to the same variable name, it works now.

 

Thank you both.

  • 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

×