Demo – Version 1.1 > (Demo uses old version)
#------------------------------------------------------------------------------# # Galv's Encounter Pointer #------------------------------------------------------------------------------# # For: RPGMAKER VX ACE # Version 1.2 #------------------------------------------------------------------------------# # 2013-02-22 - Version 1.2 - hide the pointer while events are running. # 2013-02-18 - Version 1.1 - fixed bug with changing number of frames # 2013-02-18 - Version 1.0 - release #------------------------------------------------------------------------------# # This script displays a pointer above the player's head that changes # depending on how many steps until the next random encounter will happen. # This is based off of the feature in the psone game 'Legend of Dragoon'. #------------------------------------------------------------------------------# # INSTRUCTIONS #------------------------------------------------------------------------------# # Get image from demo. # Put script under Materials and above Main # Check settings to see if you want to change anything. # Start a new game. #------------------------------------------------------------------------------# ($imported ||= {})["Galv_Encounter_Pointer"] = true module Galv_Enc #------------------------------------------------------------------------------# # SETUP OPTIONS #------------------------------------------------------------------------------# #---------------------# # Gameplay Options: # #---------------------# DISABLE_BUTTON = :Y # Button for player to turn it on and off :Y is "s" key DISABLE_SWITCH = 1 # Turn ON to turn pointer OFF. WARNING_LEVEL = 0.5 # When pointer turns yellow DANGER_LEVEL = 0.2 # When pointer turns red # The above levels are based on how many steps until encounter and the # encounter rate of the area. 0.5 means when steps until encounter has reached # 50% of the encounter rate. (So 15 steps in a 30 step zone). #---------------------# # Graphic Options: # #---------------------# IMAGE = "encounter_pointer" # The image to use in /Graphics/System/ FRAMES = 5 # Amount of frames the pointer animation uses SPEED = 5 # Speed of animation (higher is slower) Z_LEVEL = 100 # Make higher to display above things if it doesn't. Y_POSITION = -50 # Y position relevant to the player. #------------------------------------------------------------------------------# # END SETUP OPTIONS #------------------------------------------------------------------------------# end class Spriteset_Map alias galv_enc_point_smap_initialize initialize def initialize create_enc_symbol galv_enc_point_smap_initialize end def create_enc_symbol @enc_symbol = Sprite_EncSymbol.new(@viewport1, $game_player) end alias galv_enc_point_smap_update update def update galv_enc_point_smap_update @enc_symbol.update end alias galv_enc_point_smap_dispose dispose def dispose galv_enc_point_smap_dispose dispose_enc_symbol end def dispose_enc_symbol @enc_symbol.dispose if @enc_symbol end end # Spriteset_Map class Sprite_EncSymbol < Sprite_Character def initialize(viewport, character = nil) super(viewport, character) @character = character update end def defaults @speed_timer = 0 @enc_pattern = 1 @enc_rate = $game_map.encounter_step @enc_status = $game_player.encounter_count end def update update_enc_status set_enc_bitmap if @enc_pattern.nil? update_src_rect update_position update_other end def update_enc_status steps_left = $game_player.encounter_count.to_f / $game_map.encounter_step.to_f if steps_left <= Galv_Enc::DANGER_LEVEL @enc_status = 2 elsif steps_left <= Galv_Enc::WARNING_LEVEL @enc_status = 1 else @enc_status = 0 end end def set_enc_bitmap @enc_pattern ||= 1 @speed_timer ||= 0 self.bitmap = Cache.system(Galv_Enc::IMAGE) @cw = bitmap.width / Galv_Enc::FRAMES @ch = bitmap.height / 3 self.ox = @cw / 2 self.oy = @ch end def update_src_rect if @enc_pattern < Galv_Enc::FRAMES pattern = @enc_pattern else @enc_pattern = 1 pattern = 1 end sx = pattern * @cw sy = @enc_status * @ch self.src_rect.set(sx, sy, @cw, @ch) end def update_position self.x = @character.screen_x self.y = @character.screen_y + Galv_Enc::Y_POSITION self.z = Galv_Enc::Z_LEVEL end def update_other @speed_timer += 1 if @speed_timer > Galv_Enc::SPEED @enc_pattern += 1 @speed_timer = 0 end if $game_switches[Galv_Enc::DISABLE_SWITCH] || $game_map.interpreter.running? self.opacity = 0 else self.opacity = 255 end self.visible = !@character.transparent end end # Sprite_EncSymbol < Sprite_Character class Game_Player < Game_Character attr_reader :encounter_count alias galv_enc_point_player_move_by_input move_by_input def move_by_input if Input.trigger?(Galv_Enc::DISABLE_BUTTON) $game_switches[1] ^= true end galv_enc_point_player_move_by_input end end # Game_Player < Game_Character
Is there a way to be able to toggle the function on and off depending on the map? I ask because if I were able to turn the function off inside a house etc, that would be fantastic. But in all seriousness, nice script Galv, your talent with these scripts never ceases to amaze me!
Thanks for your kind words. The only way would be to turn the disable switch on when inside houses. I didn’t add functionality to completely disable this unfortunately
So that would be done through scripting? That’s perfect! Being unfamiliar with the workings of the script (and new to scripting, what would I put in the ‘script’ of an event?
And thank you so much for your help! :D
In the script settings it has:
DISABLE_SWITCH = 1
You choose a switch to use. Then turning the switch you use ON (with an event) the pointer will disappear
Oh! I get it! *Sigh* It’s so simple! Sorry to inconvenience you! Thanks so much for your help!
Hi Galv, LoD is literally the ‘best’ game. I Love that it inspired you to make this.
I am having an issue with the X offset however, which I assume is hardcoded as a default since I can only edit the Y and Z axis in the settings. Is there some way I can move my pointer to the right? (Error image: http://i57.tinypic.com/yzzhe.png)
Thanks ^_^
Are you using a script that makes your resolution larger? Try making your map bigger to fill the size of the window and see what happens
Not as far as I know, but it only occurs on certain maps, the ones that don’t entirely fill the screen. I’ve no doubt your suggestion will solve the issue. Thanks bro
Hello Galv, I have a question-you’re the only person I have found that has a script of this nature but it’s not quite what I’m looking for. I don’t deal with random encounters in my game, (I’m trying to use Falco Pearl Liquid ABS). I love games like Baldurs Gate and Icewind Dale and was wanting to implement the encounter rings that you see around the characters all the time. So a friendly target is a blue ring and the character group is green. If a friendly is damaged they become an enemy-which is a red ring. (And if they flee in fear under a failed morale check it is yellow). Can this script be easily modified to do that? I’ve been able to create a common event that places a ring around the main character but eventing for every NPC and switching the ring color is currently beyond me.
Sorry, that is a much more complex script and different to this one. You’ll need to find someone who can write it up for you. I recommend asking in a forum.