RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Mission Arrow

0 Members and 1 Guest are viewing this topic.

****
Rep:
Level 83
A small script that I made that makes and arrow on the screen that points to a location on the map.

Code: [Select]
#==============================================================================
# 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.
« Last Edit: March 30, 2010, 09:09:50 PM by Mr_Wiggles »
Spoiler for:
METALFRESH is a paint contractor that specializes in refinishing metal and vinyl siding. We paint metal buildings as well as siding on homes.

We also

    Refinish decks
    Do custom interior painting
    Strip wallpaper
    Refinish cedar siding
    Metal front doors and sidelights
    Metal garage and service doors
    Grained fiberglass doors

    If your structure is *RUSTED *FADED *CHALKING *IN NEED OF COLOR CHANGE, we can fix it with a guarentee!

northern Illinois and southern Wisconsin.

http://metalfreshcoatings.com


*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member

***
Rep:
Level 83
Kidfox70. It happens.
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
I don't say bless you when people sneeze, cause i'm not God. Blessing people is his job. Lolo?

****
Rep:
Level 83
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.
Spoiler for:
METALFRESH is a paint contractor that specializes in refinishing metal and vinyl siding. We paint metal buildings as well as siding on homes.

We also

    Refinish decks
    Do custom interior painting
    Strip wallpaper
    Refinish cedar siding
    Metal front doors and sidelights
    Metal garage and service doors
    Grained fiberglass doors

    If your structure is *RUSTED *FADED *CHALKING *IN NEED OF COLOR CHANGE, we can fix it with a guarentee!

northern Illinois and southern Wisconsin.

http://metalfreshcoatings.com


**
Rep: +0/-0Level 86
I like Stuff :D
oo... nice
Surprised? That the Dark side doesnt have cookies? Well you shouldnt be.