A small script that I made that makes and arrow on the screen that points to a location on the map.
#==============================================================================
# Mission Arrow
#------------------------------------------------------------------------------
# By Mr Wiggles
# V 1.0
#------------------------------------------------------------------------------
# CONFIG
#==============================================================================
LOCATION_X_VAR = 1 # Variable used for the Map X location of Object
LOCATION_Y_VAR = 2 # Variable used for the Map Y location of Object
ARROW_SWITCH = 1 # Switch to Turn Arrow on and off
DEBUG_MODE = false # Display Player X/Y, Location X/Y, Arrow Info.
#==============================================================================
class Mission_Arrow < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 480)
self.opacity = 0
self.contents = Bitmap.new(width - 32, height - 32)
@x = 0
@y = 0
@sx = 0
@sy = 0
@direction = 0
update
end
#--------------------------------------------------------------------------
# * Turn To Objective
#--------------------------------------------------------------------------
def turn_to_objective
# Get difference in player coordinates
@sx = $game_player.x - @x
@sy = $game_player.y - @y
# If coordinates are equal
if @sx == 0 and @sy == 0
return @direction = 0
end
if @sx.abs > @sy.abs
# Turn to the right or left towards player
@sx < 0 ? turn_left : turn_right
# If vertical distance is longer
else
# Turn up or down towards player
@sy < 0 ? turn_down : turn_up
end
end
#--------------------------------------------------------------------------
# * Turn Down
#--------------------------------------------------------------------------
def turn_down
@direction = 2
refresh(@direction)
end
#--------------------------------------------------------------------------
# * Turn Left
#--------------------------------------------------------------------------
def turn_left
@direction = 4
refresh(@direction)
end
#--------------------------------------------------------------------------
# * Turn Right
#--------------------------------------------------------------------------
def turn_right
@direction = 6
refresh(@direction)
end
#--------------------------------------------------------------------------
# * Turn Up
#--------------------------------------------------------------------------
def turn_up
@direction = 8
refresh(@direction)
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
if $game_switches[ARROW_SWITCH] == true
@x = $game_variables[LOCATION_X_VAR]
@y = $game_variables[LOCATION_Y_VAR]
turn_to_objective
else
refresh(0)
end
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(direction)
self.contents.clear
arrow = RPG::Cache.character("Misson Arrow", 0)
if $game_switches[ARROW_SWITCH] == true
case direction
when 2 # down
src_rect = Rect.new(0, 0, 30, 30)
when 4 # left
src_rect = Rect.new(0,30, 30, 30)
when 6 # right
src_rect = Rect.new(0,60, 30, 30)
when 8 # up
src_rect = Rect.new(0,90, 30, 30)
end
self.contents.blt(260 , 0, arrow, src_rect)
end
#-----------------------------
# Debugger
if DEBUG_MODE == true
old_size = self.contents.font.size
self.contents.font.size = 18
# Player Location
self.contents.draw_text(0, 0, 220, 32, "player X: " + $game_player.x.to_s)
self.contents.draw_text(0, 20, 220, 32, "player Y: " + $game_player.y.to_s)
# Location Location
self.contents.draw_text(0, 60, 220, 32, "Location X: " + @x.to_s)
self.contents.draw_text(0, 80, 220, 32, "Location Y: " + @y.to_s)
# Arrow Info
self.contents.draw_text(0,120, 220, 32, "Arrow Direction: " + @direction.to_s)
self.contents.draw_text(0,140, 220, 32, "Arrow SX: " + @sx.to_s)
self.contents.draw_text(0,160, 220, 32, "Arrow SY: " + @sy.to_s)
self.contents.font.size = old_size
end
#-----------------------------
end
#--------------------------------------------------------------------------
end #class
#==============================================================================
# * Scene_Map
#==============================================================================
class Scene_Map
#----------------------------
# Create Arrow
alias arrow_main main
def main
@mission_arrow = Mission_Arrow.new
arrow_main
@mission_arrow.dispose
end
#----------------------------
# Update Arrow
alias arrow_update update
def update
@mission_arrow.update
arrow_update
end
#----------------------------
end #class
Features:
The arrow is a character set.
Easy configure
Debug Mode - Displays information about Players location and such on the screen
Screen Shot:
http://screensnapr.com/u/i/hswsd0.png
Give credit if you use this.
Cool
This is really nice. So many things came to mind when I saw this. Mini Games. An item that lets the user better find things. To use during the Core story part of the game to help the player go to different places they need to vist. The list can go on...haha. Nice Work Mr_Wiggles! ;D
Yea i incorporated this into a mission script, and the player can activate a mission by selecting it from the list, and then the arrow will point to the location.
oo... nice