Jump to content
Sign in to follow this  
Antorugby

Teleport adn Altitude

Recommended Posts

I was searching for a script to teleport the vehicle player where the player clicked on the map and I found this:

titleText["Select Map Position", "PLAIN"];
onMapSingleClick "vehicle player setPos _pos;

But of course this just change the position of the player and not the height.

So I've looked into the wiki for setPos, setposASL/ATL etc, I've tried all the combination but nothing worked.

The only way that I found to work is this, where "+150" is the altitude:

titleText["Select Map Position", "PLAIN"];
onMapSingleClick "vehicle player setPos _pos;
vehicle player setPos [ getPos vehicle player select 0, getPos vehicle player select 1, (getPos vehicle player select 2) +150] 
onMapSingleClick '';";

It works fine, but I get an error, something like "type nothing expected bool", why?

Share this post


Link to post
Share on other sites

The command reference's exemple specifies that a boolean is needed at the end. I suppose its used to allow you to add a condition to the mini-script to decide whether or not the action must be done. Not sure about it tbh.

Also your script has extra bits that can be removed.

Try this (untested) :

onMapSingleClick "vehicle player setPos [_pos select 0, _pos  select 1, (_pos select 2) +150]; true;";

edit: Tested, works.

Edited by YattaYatta

Share this post


Link to post
Share on other sites

titleText["Select Map Position", "PLAIN"];
onMapSingleClick "vehicle player setPos _pos;
vehicle player setPos [ getPos vehicle player select 0, getPos vehicle player select 1, (getPos vehicle player select 2) +150] 
onMapSingleClick '';";

It works fine, but I get an error, something like "type nothing expected bool", why?

you left some garbage behind...

titleText["Select Map Position", "PLAIN"]; // you don't need this necessarily
onMapSingleClick "vehicle player setPos _pos; true;"; // added matching closing quote
vehicle player setPos [ getPos vehicle player select 0, getPos vehicle player select 1, (getPos vehicle player select 2) +150]; // added semicolon in the end
// onMapSingleClick '';"; removed altogether

Edit: ninja'ed

Share this post


Link to post
Share on other sites
The command reference's exemple specifies that a boolean is needed at the end. I suppose its used to allow you to add a condition to the mini-script to decide whether or not the action must be done. Not sure about it tbh.

Also your script has extra bits that can be removed.

Try this (untested) :

onMapSingleClick "vehicle player setPos [_pos select 0, _pos  select 1, (_pos select 2) +150]; true;";

edit: Tested, works.

So the boolean was the "true"?

Anyway, yes it works really good, thank you!

EDIT; It was there the first time that I tried the script, probably i've just deleted it when I was trying different ways.

Thank you both for the explanation and for clearing the script!

Edited by Antorugby

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  

×