Guest Access
Go to page : 1, 2
EVENTALIST
EVENTALIST
EVENTALIST
profile
This script allows you to put an arrow on the screen to point to an event.
"Mission Arrow"
Demo 2.0
Post any suggestions for future updates or any errors you may encounter here.
mr_wiggles
profile
Mission Arrow
Version: 2.4
Author: Mr Wiggles
Date: May 15, 2011
Version History
Version: 2.4
Author: Mr Wiggles
Date: May 15, 2011
Version History
- Version 1.0 4/30/11 - Original Release
- Version 2.0 5/3/11 - New System
- Version 2.4 5/15/11 - Bug Fix
Planned Future Versions
- More features and such, idk what...
Description
This script allows you to put an arrow on the screen to point to an event.
Features
- V2.0 - Uses a variable for mission id.
- V2.0 - Easy set up, just create a comment with the mission ids to point to in an event.
- V2.0 - Point to the EXACT location of the location relative to the player.
Instructions
You'll have to paste the script above main and bellow the default scripts. Download and place the "Mission Arrow" image and place it in your graphics folder.Script
- Code:
#==============================================================================
# ** Mission Arrow **
#==============================================================================
# By Mr Wiggles
# Version 2.4
# 5/15/11
#==============================================================================
# Instructions:
# -------------------------
# To make the arrow point to a loctaion use an event that has:
# "Missions [id]" in a comment within the top 5 lines.
# the top five because most scripts that read event comments read
# the first one. This was done to make the script compatible.
#
# [id] for Missions is all the ids that point to that event.This is good for
# map change events for pointers on other maps.
#
# If an event is a map transfer and you want to point to missions on that
# new map use ["all",excluding_ids]
# ex. "Missions ["all",3,4]" will point to for all other missions that
# are not 3 or 4.
#
# To make the arrow point to an object if a variable is at a certain value
# use "ifvar[id]=value" after "Missions [id]".
# ex. "Missions [1,3] ifvar[1]=10"
#
# To make the arrow point to an obect if the vairable is NOT the matching
# value use "ifvar[id]!=value" instead.
#
# To make the arrow point to an object if a switch is at a certain value
# use "ifswi[id]=value" after "Missions [id]".
# ex. "Missions [1,3] ifswi[1]=true"
#
# To make the arrow point to a specific id set the vraiable with the id
# of the "POINTVAR" to value of the destenation id. To stop pointing set
# the variable to zero.
#
# NOTE: It is important that you do not have any spaces but those between
# "Missions" and "[id]" or any arguements like "ifvar[1]=5" or "ifswi[1]=true".
# ex. "Missions ["all",1,2] ifswi[1]=false"
#
# NOTE: The mission comment tags will only work if the event page they are on
# is active. (say event page 2 needs switch[id] true, if there is a tag
# on that page it will only work if switch[id] is true.)
#
# NOTE: You can use the list as an arguement branch as well.
# ex. (event command list)
# Comment: "Missions ["all",6,10] ifswi[100]=true"
# Comment: "Missions [1,3] ifvar[1]=13"
# Comment: "Missions [5,6]"
# If the first comment arguments are not met it will move to the second
# line, and if the second are not met it will move down to the third... etc.
#==============================================================================
# Varialbe id used for point target id.
POINTVAR = 1
#------------------------------------------------------------------------------
# Show debugging information.
DEBUG = false
#------------------------------------------------------------------------------
# Location of the arrow sprite. [x, y] (320, 240 = Center Screen)
ARROW_LOC = [0, 480]
#------------------------------------------------------------------------------
# Refresh rate (lower number = faster refresh but more lag.)
REFRESH = 10
#------------------------------------------------------------------------------
# Name of the Picture file for the arrow.
POINT_IMG = "Mission Arrow"
#------------------------------------------------------------------------------
# Arrow Opacity.
AROPACIT = 180
#==============================================================================
#
# Do not eddit bellow this line unless you know what your doing.
#
#==============================================================================
# ** Scene Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
alias :wma_main :main
def main
@wma_window = Window_MNArrow.new
wma_main
@wma_window.dispose
end
#--------------------------------------------------------------------------
alias :wma_up :update
def update
wma_up
@wma_window.update
end
end
#==============================================================================
# ** Game Event
#==============================================================================
class Game_Event < Game_Character
def missions
return [] if @list.nil?
for i in 0..@list.size - 1
line = @list[i]
next if line.nil?
command = line.parameters[0]
next if command.nil? or !command.to_s.include?("Missions [")
command = command.to_s.split(" ")
if (command[2].nil? and command.size > 2) or command.size > 3
string = "Mis Arrow: Event #{self.id} has too many spaces. \n" +
"Comment: #{command.join(' - ')}"
print("#{string}")
$scene = nil
return
end
if command[0] == "Missions"
missions = command[1]
unless command[2].nil?
argue = command[2].split("=")
unless argue[0].nil?
argue[0].gsub("[", "$'")
unless $'.nil?
id = $'.sub("]", "").to_i
value = argue[1].to_i
if argue[0].include?("ifvar")
not_val = argue[0].include?("!")
unless not_val
missions = nil unless $game_variables[id] == value
else
missions = nil unless $game_variables[id] != value
end
elsif argue[0].include?("ifswi")
not_val = argue[0].include?("!")
unless not_val
missions = nil unless $game_switches[id] == eval(value)
else
missions = nil unless $game_switches[id] != eval(value)
end
end
end
else
missions = nil
end
end
break if missions != nil
end
end
missions = "[]" if command.nil?
if missions.nil?
missions = command[1].include?("all") ? "[\"all\"]" : "[]"
end
if missions.include?("all")
new_ids = []; index = 0; 9999.times{index += 1; new_ids.push(index)}
missions.delete!("\"all\",")
ids = eval(missions)
for id in ids
new_ids.delete(id.to_i)
end
ids = new_ids
else
ids = eval(missions)
end
return ids
end
end
#==============================================================================
# ** Mission Arrow Window
#==============================================================================
class Window_MNArrow < Window_Base
#--------------------------------------------------------------------------
def initialize
super(-16, -16, 700, 540)
self.contents = Bitmap.new(self.width - 32, self.height - 32)
self.contents.font.size = 20
self.opacity = 0
@update_wait = 0
@bitmap = RPG::Cache.picture(POINT_IMG) rescue nil
@arrow = Arrow_Sprite.new(@bitmap)
@angle = 0
refresh
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
pointers = []
for event in $game_map.events.values
ids = event.missions
next if ids.nil? or ids.empty?
if ids.include?($game_variables[POINTVAR])
pointers.push(event.id)
px, py = $game_player.x, $game_player.y
ex, ey = event.x, event.y
gx = ex - px; gy = ey - py
@angle = get_angle(gx, gy)
@arrow.angle = 270 + @angle; @arrow.visible = true
w, h = @bitmap.width, @bitmap.height
self.contents.blt(@arrow.x - (w / 4), @arrow.y - (h / 2), @bitmap,
Rect.new(0, 0, w / 2, h), AROPACIT)
event_id = event.id
break
else
@arrow.visible = false
end
end
id = $game_variables[POINTVAR]
return unless DEBUG and id != 0
self.contents.fill_rect(Rect.new(-24, 0, 680, 56), Color.new(0,0,0,150))
self.contents.draw_text(-24, 0, 680, 32,
"Target Mis:#{id} - Angle:#{@angle} - " +
"Event#{event_id}:[#{ex}, #{ey}] - " +
"Player:[#{px}, #{py}] - Point:[#{gx},#{gy}]", 1)
self.contents.draw_text(0, 24, 680, 32,
"Pointing at Event ID(s): #{pointers.join(', ')}", 1)
end
#--------------------------------------------------------------------------
def update
super
@update_wait -= 1
return if @update_wait > 0
@update_wait = REFRESH
refresh
@arrow.visible = false if $game_variables[POINTVAR] == 0
@arrow.update if @arrow.visible
end
#--------------------------------------------------------------------------
def dispose
@arrow.dispose
super
end
#--------------------------------------------------------------------------
def get_angle(lx, ly)
angle = (Math.atan2(lx, ly) * 100).round
angle /= 2
if angle < 0
angle *= -1; angle = 360 - angle % 360
end
angle = 0 if lx == 0 and ly > 0
angle = 90 if lx > 0 and ly == 0
angle = 180 if lx == 0 and ly < 0
angle = 270 if lx < 0 and ly == 0
return angle
end
end
#==============================================================================
# ** Arrow Sprite
#==============================================================================
class Arrow_Sprite < Sprite
#--------------------------------------------------------------------------
def initialize(bitmap)
view = Viewport.new(0, 0, 680, 480); view.z = 9000
super(view)
unless bitmap.nil?
self.bitmap = bitmap; w, h = bitmap.width, bitmap.height
self.src_rect.set(w / 2, 0, w / 2, h)
self.x, self.y = ARROW_LOC[0] - (w / 2), ARROW_LOC[1] - (h / 2)
self.x = (w / 4) if self.x < 0
self.y = (h / 2) if self.y < 0
self.x = 680 - (w / 4) if self.x > 680
self.y = 480 - (h / 2) if self.y > 480
self.ox, self.oy = w / 4, h / 2
self.opacity = AROPACIT
else
string = "Mis Arrow: \'#{POINT_IMG}\' was not found, be sure that it" +
"\n is in your Graphics\Pictures folder."
print("#{string}")
end
self.visible = false
update
end
#--------------------------------------------------------------------------
def dispose
self.bitmap.dispose unless self.bitmap.nil?
super
end
end
$wig_mission_arrow = true
"Mission Arrow"
Demo 2.0
Support
Post any suggestions for future updates or any errors you may encounter here.
Known Compatibility Issues
none that i know of.Restrictions
DO NOT post this on any other forum with out my permission, you are free to edit this in anyway for YOUR use only. EVENTALIST
Show Signature
EVENTALIST
C.O.R.N.
C.O.R.N.
C.O.R.N.
profile
BluE
profile
this is like in all those car games where you need to go to a place yeah? REALLY cool.... Like.....REALLY
C.O.R.N.
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST
profile
mr_wiggles
profile
Thanks blue, im using it in my game, its for your active missions so you can find them easier.
EVENTALIST
Show Signature
EVENTALIST
C.O.R.N.
C.O.R.N.
C.O.R.N.
profile
BluE
profile
yeah that would help alot. It wouldn't be too great if you got lost or something.
C.O.R.N.
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST
profile
mr_wiggles
profile
true that, and i always wanted a script that did this, but i couldn't find one, now that i can make scripts i just wrote it.
EVENTALIST
Show Signature
EVENTALIST
C.O.R.N.
EVENTALIST
EVENTALIST
EVENTALIST
profile
mr_wiggles
profile
i did, never worked out the way i wanted it to.
but that was a while back, i bet i could now if i wanted too.
but that was a while back, i bet i could now if i wanted too.
EVENTALIST
Show Signature
EVENTALIST
C.O.R.N.
Administrator
Administrator
Administrator
profile
G@MeF@Ce
profile
@wiggles - this will go great with any ABS! Thanks for sharing!
whether it's event commands or script, you never cease to make it more fun ^,^
whether it's event commands or script, you never cease to make it more fun ^,^
Administrator
Show Signature
Poster Mcposty
Poster Mcposty
Poster Mcposty
profile
MotionM
profile
Really great script. Kudo's mate.
Poster Mcposty
Show Signature
Go to page : 1, 2
GAMEFACE101 » MEDIA » PLAY with CODE! » PLAY with CODE (scripts and software) » RGSS (RMXP SCRIPTS) »RMXP- Mission Arrow
Similar topics