Coding a Compass Script

Author Topic: Coding a Compass Script  (Read 1912 times)

You probably know the compass scripts in the links below

--> https://forum.blockland.us/index.php?topic=283656.0

--> https://forum.blockland.us/index.php?topic=304853.0

It seems like that "Armageddon" did the compass script.
So i just want to ask this...

How do you make one?

I'm just asking this because me and my Friend [Zelwin/adel] are making a "Bounty Hunter" Gamemode.

Link to our Topic --> https://forum.blockland.us/index.php?topic=315693.0



You're allowed to discuss here!



you could probably look at how they did it
it's probably just checking positions and rotations, printing out based on that

you could probably look at how they did it
it's probably just checking positions and rotations, printing out based on that

The issue is they didn't even add how it works and how it was coded

they (and you?) have the code though
the code should be able to tell you how it works
and they probably coded it by typing in the letters

and they probably coded it by typing in the letters

no they coded it by copying letters then copying and pasting them into a .cs file one letter at a time

they (and you?) have the code though
the code should be able to tell you how it works
and they probably coded it by typing in the letters
I think he means the code isn't well commented?
That can make it harder to follow easily, and is especially common among BL add-ons

if he has questions on a specific bit, or just posted the relevant bit, that would probably help more

%trans = serverconnection.getcontrolob ject().gettransform(); returns your client-sided transform, which is basically your position and rotation as a long string.

the first 2 words of the above are your position in 2d space. you dont need the y axis because your height is irellevent

2 * 3.14159 - (getword(%trans,5) * getword(%trans,6)); returns your rotation as an angle out of 360 (i think) or possibly radians.


once you have the angle you can basically decide which direction you're facing. 0 degrees is N, 45 is NE, 90 is E, 135 is SE 180 W etc
« Last Edit: December 25, 2017, 07:13:50 PM by PhantOS »

pretty sure +X is east and +Y is north
and the code for getting position may be different server sided (%player.pos or whatever)

%trans = serverconnection.getcontrolob ject().gettransform(); returns your client-sided transform, which is basically your position and rotation as a long string.

the first 2 words of the above are your position in 2d space. you dont need the y axis because your height is irellevent

2 * 3.14159 - (getword(%trans,5) * getword(%trans,6)); returns your rotation as an angle out of 360 (i think) or possibly radians.


once you have the angle you can basically decide which direction you're facing. 0 degrees is N, 45 is NE, 90 is E, 135 is SE 180 W etc

oooohh okay

@phantos this needs to be serversided which makes things easier. he wants to recreate yoke’s bounty hunter which used a bottomprint compass system like in battlefield except the only target is your own + used colors to tell you if hes above or below you

@phantos this needs to be serversided which makes things easier. he wants to recreate yoke’s bounty hunter which used a bottomprint compass system like in battlefield except the only target is your own + used colors to tell you if hes above or below you

Yes