NOTE: This script is designed for use with followers. If you won’t use followers, a streamlined script can be found here.
#------------------------------------------------------------------------------# # Galv's Superman Ability (F) #------------------------------------------------------------------------------# # For: RPGMAKER VX ACE # Version 1.3(F) (Followers Added) #------------------------------------------------------------------------------# # 2012-11-30 - Version 1.3 - can set equip/skill/actor requirements to fly # - fixed talking and trying to fly/land bug # - added script calls to force takeoff and land # 2012-11-14 - Version 1.2 - can no longer land on same-as-player events # 2012-11-13 - Version 1.1 - priority bug when flying fixed # 2012-11-13 - Version 1.0 - spawned from original version - added followers #------------------------------------------------------------------------------# # # This script allows the player to gain the power of flight and land/takeoff # whenever they want to. This version gives options for followers to fly, too. # # NOTE: This is the "Follower" version. If you use followers in your game, # use this script. Otherwise, use the other version as it has a lot # less processing in it. # #------------------------------------------------------------------------------# # INSTRUCTIONS: # Read the setup options below and set it up as desired. #------------------------------------------------------------------------------# # SCRIPT CALLS: #------------------------------------------------------------------------------# # # flying? # return true or false. Use in conditional branch if ACTIVATE_EVENTS # # is set to true in the settings below # # $game_player.force_land # script call to force player to land # $game_player.force_takeoff # script call to force player to take off # #------------------------------------------------------------------------------# # NOTETAG ACTORS / EQUIPS / SKILLS: #------------------------------------------------------------------------------# # # <flight> # if REQUIREMENTS = true, then the leader requires a notetag on # # them, one of their equips or a skill they know. # #------------------------------------------------------------------------------# ($imported ||= {})["Galvs_Superman_Ability"] = true module Galv_Superman #------------------------------------------------------------------------------# # SCRIPT SETUP OPTIONS #------------------------------------------------------------------------------# ENABLE_SWITCH = 1 # Can only fly when this switch is ON REQUIREMENTS = true # Leader requires actor/equip/skill <fly> tag # false = dont need to tag anything to fly SPEED_BONUS = 1 # Speed increases by this number when flying. BUTTON = :X # Button to press to fly and land. :X is "a" key. FLY_EXTENSION = "_fly" # Character set for when actor is flying. If your # actor uses "Actor1.png" then you must have a file # called "Actor1_fly.png" if this extenstion is set # to "_fly". The actor must be in the same position # in both charsets. ACTIVATE_EVENTS = true # If true, can still activate events as normal. # If false, will work like airship does, unable to # activate events until landed. MAX_FOLLOWERS = 4 # Default RPGmaker this is 4. If you have a script # that changes this, change it here as well. FOLLOWERS_FLY = true # Followers need fly charsets too as they also fly. # Set to false to make followers gather into leader # instead and only the leader flies. #------------------------------------------------------------------------------# # END SCRIPT SETUP OPTIONS #------------------------------------------------------------------------------# end class RPG::BaseItem def flight if @flight.nil? if @note =~ /<flight>/i @flight = true else @flight = false end end @flight end end # RPG::BaseItem class Scene_Map < Scene_Base alias galv_superman_map_initialize initialize def initialize galv_superman_map_initialize end alias galv_superman_map_update_scene update_scene def update_scene galv_superman_map_update_scene $game_player.take_off if $game_player.taking_off $game_player.land if $game_player.landing end end # Scene_Map < Scene_Base class Game_Player < Game_Character attr_accessor :through attr_accessor :altitude attr_accessor :step_anime attr_accessor :move_speed attr_accessor :priority_type attr_accessor :in_air attr_accessor :taking_off attr_accessor :landing alias galv_superman_player_initialize initialize def initialize galv_superman_player_initialize @altitude = 0 @in_air = false end alias galv_superman_player_move_by_input move_by_input def move_by_input galv_superman_player_move_by_input if Input.trigger?(Galv_Superman::BUTTON) && !@taking_off && !@landing return if !$game_switches[Galv_Superman::ENABLE_SWITCH] return if !$game_player.can_fly? || !$game_player.normal_walk? || $game_map.interpreter.running? if @in_air return if !$game_map.airship_land_ok?($game_player.x, $game_player.y) || !blocking_event? force_land else force_takeoff end end end def blocking_event? $game_map.events_xy($game_player.x, $game_player.y).each do |event| return false if event.priority_type == 1 end return true end def force_land $game_player.through = false if $game_player.followers.visible && $game_party.members.count > 1 || !Galv_Superman::FOLLOWERS_FLY $game_player.followers.gather end $game_player.move_speed -= Galv_Superman::SPEED_BONUS @in_air = false @landing = true end def force_takeoff if !Galv_Superman::FOLLOWERS_FLY $game_player.followers.gather $game_party.leader.set_graphic($game_party.leader.character_name + Galv_Superman::FLY_EXTENSION, $game_party.leader.character_index, $game_party.leader.face_name, $game_party.leader.face_index) else $game_party.members.each do |mem| mem.set_graphic(mem.character_name + Galv_Superman::FLY_EXTENSION, mem.character_index, mem.face_name, mem.face_index) end end $game_system.menu_disabled = true $game_player.step_anime = true @in_air = true $game_player.through = true $game_player.priority_type = 2 if Galv_Superman::FOLLOWERS_FLY $game_player.followers.each do |fol| fol.priority_type = 2 end end @taking_off = true $game_player.refresh end def take_off $game_player.altitude += 1 if Galv_Superman::FOLLOWERS_FLY $game_player.followers.each do |fol| fol.altitude += 1 end end if $game_player.altitude >= 32 $game_player.altitude = 32 if Galv_Superman::FOLLOWERS_FLY $game_player.followers.each do |fol| fol.altitude = 32 end else $game_player.followers.visible = false $game_player.refresh end $game_player.move_speed += Galv_Superman::SPEED_BONUS @taking_off = false end end def land $game_player.altitude -= 1 if Galv_Superman::FOLLOWERS_FLY $game_player.followers.each do |fol| fol.altitude -= 1 end else $game_player.followers.gather end if $game_player.altitude <= 0 $game_player.altitude = 0 $game_player.followers.each do |fol| fol.altitude = 0 fol.priority_type = 1 end if Galv_Superman::FOLLOWERS_FLY $game_party.members.each do |mem| mem.set_graphic(mem.character_name.chomp(Galv_Superman::FLY_EXTENSION), mem.character_index, mem.face_name, mem.face_index) end else $game_party.leader.set_graphic($game_party.leader.character_name.chomp(Galv_Superman::FLY_EXTENSION), $game_party.leader.character_index, $game_party.leader.face_name, $game_party.leader.face_index) end $game_player.followers.visible = $game_temp.follower_setting $game_player.refresh $game_system.menu_disabled = false $game_player.step_anime = false $game_player.priority_type = 1 @landing = false end end def can_fly? # Check switch return true if !Galv_Superman::REQUIREMENTS # Check actor return true if $data_actors[$game_party.leader.id].flight # Check actor's skills $game_party.leader.skills.each do |s| return true if s.flight end # Check equips no_equips = $game_party.leader.equips.count no_equips.times { |i| if $game_party.leader.equips[i] != nil return true if $game_party.leader.equips[i].flight end } return false end def screen_y super - @altitude end alias galv_superman_in_airship? in_airship? def in_airship? if !Galv_Superman::ACTIVATE_EVENTS @vehicle_type == :airship || @altitude > 0 else galv_superman_in_airship? end end alias galv_superman_player_get_on_vehicle get_on_vehicle def get_on_vehicle return if @altitude > 0 galv_superman_player_get_on_vehicle end end # Game_Player < Game_Character class Spriteset_Map alias galv_superman_map_initialize initialize def initialize galv_superman_map_initialize @follower_shadow = [] create_follower_shadows if Galv_Superman::FOLLOWERS_FLY end alias galv_superman_update_shadow update_shadow def update_shadow if $game_player.altitude > 0 player = $game_player @shadow_sprite.x = player.screen_x @shadow_sprite.y = player.screen_y + player.altitude @shadow_sprite.opacity = player.altitude * 8 @shadow_sprite.update if Galv_Superman::FOLLOWERS_FLY follower = $game_player.followers count = Galv_Superman::MAX_FOLLOWERS - 1 count.times { |i| if $game_party.members[i+1].nil? || !$game_player.followers.visible @follower_shadow[i].opacity = 0 else return if @follower_shadow.nil? @follower_shadow[i].x = follower[i].screen_x @follower_shadow[i].y = follower[i].screen_y + follower[i].altitude @follower_shadow[i].opacity = follower[i].altitude * 8 end @follower_shadow[i].update } end else galv_superman_update_shadow end end def create_follower_shadows count = Galv_Superman::MAX_FOLLOWERS - 1 count.times { |i| @follower_shadow[i] = Sprite.new(@viewport1) @follower_shadow[i].bitmap = Cache.system("Shadow") @follower_shadow[i].ox = @follower_shadow[i].bitmap.width / 2 @follower_shadow[i].oy = @follower_shadow[i].bitmap.height @follower_shadow[i].z = 180 } end end # Spriteset_Map class Game_Follower < Game_Character attr_accessor :altitude attr_accessor :priority_type alias galv_superman_follower_initialize initialize def initialize(member_index, preceding_character) galv_superman_follower_initialize(member_index, preceding_character) @altitude = 0 end def screen_y super - @altitude end end # Game_Follower < Game_Character class Game_Followers alias galv_superman_followers_initialize initialize def initialize(leader) galv_superman_followers_initialize(leader) $game_temp.follower_setting = @visible end end # Game_Followers class Game_Temp attr_accessor :follower_setting end # Game_Temp class Game_Interpreter def flying? $game_player.altitude > 0 end alias galv_superman_command_216 command_216 def command_216 galv_superman_command_216 $game_temp.follower_setting = $game_player.followers.visible end alias galv_superman_interpreter_command_129 command_129 def command_129 galv_superman_interpreter_command_129 $game_party.members.each do |mem| if !mem.character_name.include?(Galv_Superman::FLY_EXTENSION) && flying? mem.set_graphic(mem.character_name + Galv_Superman::FLY_EXTENSION, mem.character_index, mem.face_name, mem.face_index) elsif mem.character_name.include?(Galv_Superman::FLY_EXTENSION) && !flying? mem.set_graphic(mem.character_name.chomp(Galv_Superman::FLY_EXTENSION), mem.character_index, mem.face_name, mem.face_index) end end end end # Game_Interpreter
This script is just what I needed for my game! Thanks a lot ^^!
After finally learning to read a little ruby, I’ve noticed this code’s instructions makes the same typo as the no-followers code did. The notetag required is “flight” while the instructions say to use “fly”. |D Thanks again for the awesome scripts! :)
Thanks again :)
So I am probably doing something wrong, but whenever I try to use this, I get this error:
Script ‘Flight’ line 44: NoMethodError occurred
undefined method `-@’ for true:TrueClass
Any help would be great!
nevermind, figured it out.
thanks for the awesome script! :D
Hello it’s me again and I got a little request again, is there a small chance, that you add region ID’s or Terrain ID tags?
A second question is more a question for an add on, because I thought of adding the same for diving, so the character fly’s on pressing button “x” and dives if presses “y”.
Sorry, if I bothered to much, but thank you in advance. :D (\s/)
Unfortunately I am too busy to do requests