Jump to content
Tidloc

Tidloc's compass

Recommended Posts

Tidloc's compass v.1.1
by Tidloc


Introduction
simply a script, that allows to show a compass if a coordinate for a map is set.

Features:

  • shows a compass on the screen if a coordinate for the map you're on is set.
  • hides that compass if no coordinate is set or is has been cleared.
  • completely compatible with my Questlog.

Screenshots

 



How to use
simply paste this script above main, (my header is not needed for this script.)

Demo
I think not needed, simply follow the instructions in the first lines of the script and us script commands looking like that:

https://www.dropbox.com/s/9oh1njewy4d3vc8/compass_command.png?dl=0

Script
Download this file: https://www.dropbox.com/s/o89x1v97eoyzfbj/tidloc_compass.rb?dl=0
You'll also need a graphic for the compass in the path: \Graphics\Pictures\ like:


(as it is now, the graphic will be shrinked by half of the height and width)
 
FAQ

Q: I found a bug or have a suggestion, how ca I contact you?

A: please look into my signature, there you'll always find the most recent contact information!


nothing asked so far, if important things appear, I will update this part.

Credits and Thanks
Tidloc

Author's Notes
This script has been requested by Niko

 

Changelog:

Spoiler

05/25/2012: implemented this script

04/29/2018: updated contact information.

 

Edited by Tidloc

Share this post


Link to post
Share on other sites

Incredible, thanks Tidloc.

 

By the way, you forgot to put the graphic for the compass in here, lol

Edited by Niko Jose DelValle

Share this post


Link to post
Share on other sites

This is a very cool script - nice one Tidloc.

 

I'm getting a problem when trying this out. The compass works, points the right direction and everything is fine until the actor steps on the actual location co-ordinates it brings up this error:

 

Script 'Compass Script' line 80:Math::DomainError occurred.

Numerical argument is out of domain - "atan2"

 

Tried on a fresh project, too - same thing happens.

Share this post


Link to post
Share on other sites

I encountered that problem to. Just make sure there is something to prevent the player from stepping on the tile. Make sure it's an event or something, at least it seems to be the best option for now anyways.

Edited by Niko Jose DelValle

Share this post


Link to post
Share on other sites

I was actually hoping to use this for finding buried treasure and you need to dig on that spot :D

 

Would it be difficult to perhaps make the compass spin in circles or even change the picture once someone is standing on the co-ordinates?

Share this post


Link to post
Share on other sites

Well, even I can figure out what's causing the error... once you step on the event, it has nowhere to point so it gets an error. It should be a rather simple fix to just make the graphic change to something else once you step on top of where it is.

 

Still, for what it is, this is a rad script.

Share this post


Link to post
Share on other sites

lol, somehow I oversaw this ^__^

 

updated, so if you're on the marked spot either it shows another picture or erases the compass.

I couldn't find out how to rotate it, as it doesn't work the way i thought it would... -__-

Edited by Tidloc

Share this post


Link to post
Share on other sites

I really appreciate you fixing this up, Tidloc :)

However, I can't get the updated script to work at all now.

 

Script 'Compass Script' line 93: SyntaxError occurred.

unexpected $end, expecting keyword_end

 

I wish I knew some scripting, it sounds like a missing end line or something? I tried adding and removing ends but didn't know what I was doing and didn't get it to work :P

Share this post


Link to post
Share on other sites

Nice one. I'd use it as a quest compass, maybe.

 

That's what I'm using it for. My game has a huge open world, without something to guide the player from point to point, a lot of exploring would be done, lol

Share this post


Link to post
Share on other sites

Can we move the position of the Compass to the other side? I currently have a clock I am displaying in the right-hand corner... and would love to put the Compass in the left-hand corner. It seems like it should be easy enough, but I am not seeing where to do it in the script.

Share this post


Link to post
Share on other sites

Gotcha! That Graphics.width - was what was making me nervous.... hehe. Wasn't certain if I wanted to remove that to test...

Thanks Galv!

And way to go Tidloc! This is great :)

 

EDIT:

Found a bug! If the compass is displayed on the world map... and you save the game... the compass will still be there.

If you then quit the game, and load the game from that save, you will see the compass for about a frame or two before it dissapears...

If you transfer into a map ... then transfer back, it fixes it. (I have mine set to a switch that is set to on far prior to the save...)

I have not yet tried this on a clean project... but I assume it will repeat...

Edited by Nate The Great

Share this post


Link to post
Share on other sites

Hey guys, when I had the issue with this I tracked down the member the script was written for and got the original working script and used it in my project. Here's the working script:

################################################################################
#    Compass script v.1.0.1                                                    #
#         by Tidloc                                                            #
#==============================================================================#
#  simple script, that allows on given maps a compass to appear and point at a #
#  given point on that map. To define that point use th following command:     #
#     Tidloc::Set_Coord(*map*,*x*,*y*)                                         #
#  were x and y are the x and y coordinates on that map.                       #
#  If no coordinates are saved for a specific map, no compass will appear.     #
#==============================================================================#
#  Only adjustable thing in this script is the name of the graphic for the     #
#  compass, and the place where the compass will be shown. Everything else     #
# will be calculated on its own by using the stated command. You can erase the #
# saved coordinates with the command:                                          #
#     Tidloc::Clear_Coord(*map*)                                               #
#  You are free to leave the map out, then all coordinates will be erased.     #
#==============================================================================#
#  Feel free to use this script, but please credit me for my work! ^__^        #
################################################################################

$imported = {} if $imported.nil?
$imported["Tidloc-Compass"] = true


module Tidloc
  module Compass
    Graphic = "compass_needle"
    Target  = "compass_exclamation"
    X = Graphics.width - 75 #Graphics.width - 32
    Y = 82
  end
 
################################################################################
################################################################################
################################################################################

  class<<self
    def Set_Coord(map,x,y)
      $game_temp._tidloc_compass[map] = [x,y]
    end
    def Clear_Coord(map = nil)
      if map == nil
        $game_temp._tidloc_compass = []
      else
        $game_temp._tidloc_compass[map] = nil
      end
    end
  end
end

class Game_Temp
  attr_accessor :_tidloc_compass
  alias wo_compass_init initialize
  def initialize
    self._tidloc_compass = []
    wo_compass_init
  end
end

class Scene_Map < Scene_Base
  alias wo_compass_update update
  def update
    wo_compass_update
    if $game_temp._tidloc_compass[$game_map.map_id]
      x = Tidloc::Compass::X
      y = Tidloc::Compass::Y
      $game_map.screen.pictures[101].show(Tidloc::Compass::Graphic,
                                           1, x, y, 50, 50, 255, 0)
      xdif = $game_player.x - $game_temp._tidloc_compass[$game_map.map_id][0]
      ydif = $game_player.y - $game_temp._tidloc_compass[$game_map.map_id][1]
      angle = 0
      if    ydif == 0 && xdif > 0
        angle = 180
      elsif ydif == 0 && xdif < 0
        angle = -180
      elsif  xdif == 0 && ydif > 0
        angle = 0
      elsif xdif == 0 && ydif < 0
        angle = 360
      elsif xdif == 0 && ydif == 0
        $game_map.screen.pictures[101].erase
        unless Tidloc::Compass::Target.nil?
          $game_map.screen.pictures[101].show(Tidloc::Compass::Target,
                                           1, x, y, 50, 50, 255, 0)
        end                                   
      else
        angle = Math::atan2(xdif + 0.0, ydif + 0.0) * 360.0 / Math::PI
      end
      $game_map.screen.pictures[101].rotate(angle)
    else
      $game_map.screen.pictures[101].erase
    end
  end
end

Share this post


Link to post
Share on other sites

trying a few, compass and custom equips missing so far. but the custom equip demo is good.

Copied the script displayed by adamsakaru and downloaded the graphic. Tested and works well.

Edited by roninator2
add on

Share this post


Link to post
Share on other sites
5 hours ago, roninator2 said:

trying a few, compass and custom equips missing so far. but the custom equip demo is good.

Copied the script displayed by adamsakaru and downloaded the graphic. Tested and works well.

 

I'd not use the demo's scripts, they may be well out of date and buggy (not that long for the custom equips I think) but updated the mentioned script's links!
Damn dropbox with their stop of supporting the public folder, some links work, other don't and others again stop working after some time, it seems... >_>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×