Jump to content

Recommended Posts

Hello.

I'm using an addAction at a Phone booth on my server and was wondering if there is a way to offset the point at which you spawn.

 

Here's what I'm using:

this addAction ["Teleport Central",{player setPosATL (getPosATL pb2)}];

pb2 is the phone booth. When I teleport to it sometimes I glitch into the phone booth.

 

Is there a way to offset the spawn point? Like make it a meter away from the booth?

 

Thank you.

Share this post


Link to post
Share on other sites
12 hours ago, pazuzu said:

Like make it a meter away from the booth? 

So long as you're getting your original position from an object you can very easily do this with getRelPos:

this addAction ["Teleport Central",{player setPos (pb2 getRelPos [1, (random 360)]}];

This will get a position 1m away from the object in a random direction. If there's a particular reason you need to use ATL then you'll have to go about converting the position to ATL as getRelPos will return AGL, but that shouldn't be difficult.

Share this post


Link to post
Share on other sites
14 hours ago, Chuggacharles said:

So long as you're getting your original position from an object you can very easily do this with getRelPos:


this addAction ["Teleport Central",{player setPos (pb2 getRelPos [1, (random 360)]}];

This will get a position 1m away from the object in a random direction. If there's a particular reason you need to use ATL then you'll have to go about converting the position to ATL as getRelPos will return AGL, but that shouldn't be difficult.

 

Interesting. I've never seen getRelPos. I'll try this out and report back.

 

Thank you.

Share this post


Link to post
Share on other sites
On 10/25/2023 at 3:57 AM, Chuggacharles said:

So long as you're getting your original position from an object you can very easily do this with getRelPos:


this addAction ["Teleport Central",{player setPos (pb2 getRelPos [1, (random 360)]}];

This will get a position 1m away from the object in a random direction. If there's a particular reason you need to use ATL then you'll have to go about converting the position to ATL as getRelPos will return AGL, but that shouldn't be difficult.

 

I get a missing  )  when I try using this. I can't see where it's missing.

Share this post


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

 

I get a missing  )  when I try using this. I can't see where it's missing.


Usually, the game will show a # before the word/code it expects to be different. In this case, it seems to be missing the ) to close the (pb2 , so try this:
 

this addAction ["Teleport Central",{player setPos (pb2 getRelPos [1, (random 360)])}];


Would you happen to be using wordpad or some simple text editor? Because if you try free and good stuff like Notepad++ and activate the C++ language, it will show you in different colors which of these characters are missing their enclosures 😉

  • Thanks 1

Share this post


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


Usually, the game will show a # before the word/code it expects to be different. In this case, it seems to be missing the ) to close the (pb2 , so try this:
 


this addAction ["Teleport Central",{player setPos (pb2 getRelPos [1, (random 360)])}];


Would you happen to be using wordpad or some simple text editor? Because if you try free and good stuff like Notepad++ and activate the C++ language, it will show you in different colors which of these characters are missing their enclosures 😉

 

I use Notepad ++    and C++ is enabled but I don't see any colored text.

I see what you did though and will try it.

 

Thank you.

 

Edit: Yeah that works nicely. Thanks again.

Share this post


Link to post
Share on other sites
6 hours ago, pazuzu said:

 

I use Notepad ++    and C++ is enabled but I don't see any colored text.


Oh, apologies: it was ME who had wrote it in the wrong way. What I meant was that when you put the cursor/blinker over one of those characters { [ ( / ) ] } , if it shows in regular white that means it all right, but whether it's missing it open or close pair, it will show in light red.

Try and paste that line of code from your previous attempt,  mouse/cursor over the parenthesis in (pb2 and you will see what I mean. 😎
That's very helpful, but as you start to play more and more with the language, you will naturally guess where something could be missing or duplicated.

Although I think such feature will not help you find missing semicolons.

Share this post


Link to post
Share on other sites

Apologies for the missing bracket!

 

If you use notepad++ you can install a SQF syntax plugin which should make reading code a little easier.

 

 

  • Like 1

Share this post


Link to post
Share on other sites
On 10/30/2023 at 2:33 AM, JCataclisma said:


Oh, apologies: it was ME who had wrote it in the wrong way. What I meant was that when you put the cursor/blinker over one of those characters { [ ( / ) ] } , if it shows in regular white that means it all right, but whether it's missing it open or close pair, it will show in light red.

Try and paste that line of code from your previous attempt,  mouse/cursor over the parenthesis in (pb2 and you will see what I mean. 😎
That's very helpful, but as you start to play more and more with the language, you will naturally guess where something could be missing or duplicated.

Although I think such feature will not help you find missing semicolons.

 

Ah, I didn't know about that. Thanks for the tip.

Share this post


Link to post
Share on other sites
On 10/30/2023 at 8:38 AM, Chuggacharles said:

Apologies for the missing bracket!

 

If you use notepad++ you can install a SQF syntax plugin which should make reading code a little easier.

 

 

 

Great. Thanks, I'll check that out.

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

×