DOWNLOAD DEMO:
Demo – Version 1.2 >
(This demo also includes Galv’s Animated Battlers)
SCRIPT:
#------------------------------------------------------------------------------# # Galv's Battle Pets #------------------------------------------------------------------------------# # For: RPGMAKER VX ACE # Version 1.2 # Based on a Request by Holder (for use with his Mag series) #------------------------------------------------------------------------------# # 2013-07-03 - Version 1.2 - Fixed bug with too many pets and scrolling # 2013-07-02 - Version 1.1 - Victors animated battlers + actor battlers works # 2013-07-01 - Version 1.0 - release #------------------------------------------------------------------------------# # Holder's animated battler spritesheets can be found here: # http://animatedbattlers.wordpress.com/ #------------------------------------------------------------------------------# #------------------------------------------------------------------------------# # WHAT IS THIS SCRIPT? # -------------------- # This is NOT a plug and play script. It requires setting up. While I tried to # explain everything as best I can, it probably isn't friendly to those just # starting to use VX Ace. Basic database knowledge required. # # This script adds the ability to have a pet attached to each actor that gives # them bonus skills and features like equipment. These pets do not use normal # equip slots and have their own management scene where you can equip them to # actors and feed them items to raise their level. # # In addition, it will also display the pets alongside animated battlers. # Currently tested and appears to work with: # # - Galv's Animated Battlers # - Victor's Animated Battlers + Actor Battlers (both required) # - Yami's Battle Symphony # # Pets can be used without animted battlers by setting ENABLE = false in the # settings further below. # # PET SPRITESHEET # --------------- # This script is designed to work with holder's mag sprite layout. This is # similar to his animated battlers but with only 2 rows. 1 row for the pet and # one row for the spritesheet creator info. # # SET UP # ------ # The initial bonuses (parameter changes and features) of a pet are taken from # an ARMOR that you choose. This armor and other options must be set up in the # script under PET SETUP heading. # You will also need to set up LEVEL TYPES which will control how you want # your pet's bonuses to grow with feeding. # # FEEDING PETS # ------------ # Specify a food type (a number) to each item using a note tag. Items without # a note tag cannot be eaten. Pets cannot eat their hated food type and get # bonus exp when eating their liked food. # # Each item with tag specifies how much exp the pet gains. Every level up a # pet gets decreases the amount gained. Food_exp / pet_level. # Pets need the same amount of exp for each level, but will need to be fed # higher quality foods else the exp gain will be lower and lower. # Food can only ever grant 1 level up. If a pet has 99/100 exp to gain a level # and eats food that would give 500 exp, they would only gain 1 to level. # # GAINING SKILLS # -------------- # There's only enough room for 6 skills in the menu for a pet. For this reason # I made it possible for the pet to forget old skills when levelling up as # well as learning new ones. This is set up in the LEVEL TYPE. # Skills will be greyed out in the pet status if the actor equipped doesn't # have the skill type to use them. # # EQUIPPING PETS # -------------- # The armor used for the pet has an Armor Type as normal in the database. An # actor must have the feature that allows them to equip that armor type # else they will not be be able to equip the pet. In the demo I have done a # basic example of male pets and female pets as the armor types. # #------------------------------------------------------------------------------# # # The pet manager scene is called: # Scene_PetManager # #------------------------------------------------------------------------------# #------------------------------------------------------------------------------# # BASIC INSTRUCTIONS #------------------------------------------------------------------------------# # 1. Get holder style battlers + mags (http://animatedbattlers.wordpress.com/) # 2. Import battlers into /Graphics/Battlers folder # 3. Put this script below Materials and above main. Maks sure it is under any # battle scripts in the script list also # 4. Read all instructions and settings # 5. Set up desired pets in the PET SETUP section below # 6. Set up LEVEL TYPES for those pets # 7. Set up the armors assosciated with those pets # 8. Remember to start a NEW GAME instead of loading a save file that was made # prior to adding this script # 9. Keep in mind I spent ages writing detailed info on how to use this. # Before you ask how something is done, please read over it! #------------------------------------------------------------------------------# #------------------------------------------------------------------------------# # SCRIPT CALLS #------------------------------------------------------------------------------# # # manage_pets # Manually call the pet managing scene # # gain_pet(pet_id) # Pet is added to the party's pets # lose_pet(pet_id) # Pet is removed from the party's pets # # equip_pet(id,pet_id) # Equip actor (id) with pet (pet_id) # remove_pet(pet_id) # Unequip specified pet from whichever actor has it # actor_remove_pet(id) # Unequip specified actor from whatever pet he has # # lock_pet(pet_id,status) # status can be true or false. If false, pet can not # # be equipped/unequipped/fed etc. # # pet_exp(pet_id,amount) # Give specified pet a chosen amount of exp # actor_pet_exp(id,amount) # Give an actor's pet a chosen amount of exp # # pet_teach(pet_id,skill_id) # Give specified pet a skill # actor_pet_teach(id,skill_id) # Give specified actor's pet a skill # # pet_forget(pet_id,skill_id) # Remove specified pet skill # actor_pet_forget(id,skill_id) # Remove skill from specified actor's pet # #------------------------------------------------------------------------------# # SOME EXAMPLES OF USE # gain_pet(3) # pet 3 is added to the party # lose_pet(6) # pet 6 is removed from the party # equip_pet(1,3) # pet 3 is equipped to actor 1 # remove_pet(3) # pet 3 is removed from whatever actor is equipped # remove_actor_pet(4) # whatever pet actor 4 has equipped is unequipped # pet_exp(2,20) # pet 2 gains 20 exp # actor_pet_exp(4,39) # pet actor 4 has equipped gains 39 exp #------------------------------------------------------------------------------# #------------------------------------------------------------------------------# # SCRIPT - For use in CONTROL VARIABLE or CONDITIONAL BRANCH SCRIPT etc. #------------------------------------------------------------------------------# # These are just common things you might want to use in variables or check in # conditional branches. There are of course a lot more... but I am not writing # them all here. #------------------------------------------------------------------------------# # # SCRIPT CODE VALUE RETURNED (NUMBER) # ----------- ----------------------- # $game_system.pets[id].exp # amount of exp # $game_system.pets[id].level # current level # $game_system.pets[id].params[x] # value of parameter x # $game_system.pets[id].owner # id of the actor holding the pet # # (0 if no actor) # $game_actor[id].pet_id # id of pet (-1 if not holding pet) # # # SCRIPT CODE VALUE RETURNED (BOOLEAN) # ----------- ------------------------ # $game_actor[id].pet # true or false if actor holding pet # $game_system.pets[id].in_party # true or false if in party # $game_system.pets[id].locked # true or false if locked # # # SCRIPT CODE VALUE RETURNED (STRING) # ----------- ----------------------- # $game_system.pets[id].name # name of pet # #------------------------------------------------------------------------------# #------------------------------------------------------------------------------# # Note tag ITEMS, ARMORS, WEAPONS #------------------------------------------------------------------------------# # # <food: a,b> # a is amount of exp pet gets by eating it. # # b is the food type (a number, used later) # # any item without this tag will NOT show in the feed list. # #------------------------------------------------------------------------------# #------------------------------------------------------------------------------# # Note tag ACTORS #------------------------------------------------------------------------------# # # <no_pet> # actors with this tag cannot equip a pet # #------------------------------------------------------------------------------# ($imported ||= {})["Galv_Battler_Pets"] = true module GALV_BPET #------------------------------------------------------------------------------# # # ** SETTINGS # #------------------------------------------------------------------------------# # Pet spritesheet ENABLE = true # make false if you are not using a supported animated battlers # script but wish to use the pet equipping functionality. PET_FLIP = false # true = flip pet battler image horizonatally COLS = 4 # Number of animation frames in battler sheet ROWS = 2 # Number of animation rows. This script only supports 2, the # first row for the pet, the second row is for artist info. # Unless a patch is released there's no need to change this. # Menu INCLUDE_IN_MENU = true # Add menu command to default menu MENU_TXT = "Pets" # Text for menu command FONT_SIZE = 18 # Font size of menu commands and pet description MENU_WIDTH = 180 # Width of the left column menus NO_EQUIP_ICON = 186 # Icon that appears next to actors with no pet equipped # Menu Vocab FEED = ["Feed Pet", 297] # Text and icon used for feed command EQUIP = ["Equip Actor",275] # Text and icon used for equip command UNEQUIP = ["Unequip Actor",121] # Text and icon used for equip command CLEAR = ["Unequip All",12] # Text and icon used for unequip all command LOCK_TXT = "LOCKED" # Text that appears over a locked pet CANT_EQUIP_TXT = "CANT EQUIP" # Text that appears over un unequippable pet UNEQUIPPED_TXT = "---" # Text that appears on unequipped pet EXP_NAME = "EXP" # Pet experience text. Keep this short. # Pet Feeding Settings EXP_PER_LEVEL = 100 # Amount of exp required before a pet levels up # Exp from food is divided by the pet's level # so will require better food sources to level # higher. An item can only ever give 1 level up. LEVEL_CAP = 100 # Max level a pet can reach LIKE_BONUS = 2 # Exp gained for liked food is multipled by this. # Sound Effects EAT_SE = ["Damage3",100,100] # ["SEName", volume, pitch] SE when eating food EQUIP_SE = ["Equip1",100,100] # ["SEName", volume, pitch] SE when equip pet UNEQUIP_SE = ["Equip2",100,100] # ["SEName", volume, pitch] SE when unequip CLEAR_SE = ["Equip2",100,100] # ["SEName", volume, pitch] SE when unequip all LEVELUP_SE = ["Raise1",100,100] # ["SEName", volume, pitch] when pet level up #------------------------------------------------------------------------------# # # ** PET SETUP # #------------------------------------------------------------------------------# # This list is to setup your pets. These pets work much like actors, each one # you make will be unique. All pets start on level 1 and start with paramaters, # features, icon and description the same as the ARMOR you specify. These # armors are used to make pet settings easier, not designed to be given to the # player during a game (Although there is nothing stopping you from doing so). #------------------------------------------------------------------------------# PET = [] # don't touch #------------------------------------------------------------------------------# PET[0] = ["Andhaka", # "Pet Name", "PetAndhaka", # "ImageName, 30,-20, # x_offset, y_offset, 58, # armor_id :strong, # level type [1,2], # hated food types [3,4], # liked food types ] #------------------------------------------------------------------------------# PET[1] = ["Apsaras", # "Pet Name", "PetApsaras", # "ImageName, 30,-20, # x_offset, y_offset, 59, # armor_id :smart, # level type [3,4], # hated food types [2], # liked food types ] #------------------------------------------------------------------------------# PET[2] = ["Diwari", # "Pet Name", "PetDiwari", # "ImageName, 30,-20, # x_offset, y_offset, 60, # armor_id :lucky, # level type [6,7,8], # hated food types [1,2], # liked food types ] #------------------------------------------------------------------------------# PET[3] = ["Surya", # "Pet Name", "PetSurya", # "ImageName, 30,-20, # x_offset, y_offset, 61, # armor_id :lucky, # level type [], # hated food types [1,2], # liked food types ] #------------------------------------------------------------------------------# PET[4] = ["Tapas", # "Pet Name", "PetTapas", # "ImageName, 30,-20, # x_offset, y_offset, 62, # armor_id :lucky, # level type [1,8], # hated food types [1,2], # liked food types ] #------------------------------------------------------------------------------# PET[5] = ["Tapas", # "Pet Name", "PetTapas", # "ImageName, 30,-20, # x_offset, y_offset, 62, # armor_id :lucky, # level type [1,8], # hated food types [1,2], # liked food types ] #------------------------------------------------------------------------------# PET[6] = ["Tapas", # "Pet Name", "PetTapas", # "ImageName, 30,-20, # x_offset, y_offset, 62, # armor_id :lucky, # level type [1,8], # hated food types [1,2], # liked food types ] #------------------------------------------------------------------------------# PET[7] = ["Tapas", # "Pet Name", "PetTapas", # "ImageName, 30,-20, # x_offset, y_offset, 62, # armor_id :lucky, # level type [1,8], # hated food types [1,2], # liked food types ] #------------------------------------------------------------------------------# PET[8] = ["Tapas", # "Pet Name", "PetTapas", # "ImageName, 30,-20, # x_offset, y_offset, 62, # armor_id :lucky, # level type [1,8], # hated food types [1,2], # liked food types ] #------------------------------------------------------------------------------# PET[9] = ["Tapas", # "Pet Name", "PetTapas", # "ImageName, 30,-20, # x_offset, y_offset, 62, # armor_id :lucky, # level type [1,8], # hated food types [1,2], # liked food types ] #------------------------------------------------------------------------------# PET[10] = ["Tapas", # "Pet Name", "PetTapas", # "ImageName, 30,-20, # x_offset, y_offset, 62, # armor_id :lucky, # level type [1,8], # hated food types [1,2], # liked food types ] #------------------------------------------------------------------------------# # Pet Type Explanation #------------------------------------------------------------------------------# # PET[id] = the id you will use to refer to or access that pet. # "Pet Name" = the name of the pet that is displayed in menus # "ImageName" = the name of the pet spritesheet from /Graphics/Battlers/ # x_offset = the position of the pet in relation to the actor's battler X # y_offset = the position of the pet in relation to the actor's battler Y # armor_id = the id of the ARMOR item the pet uses to setup features and # initial paramater gain for a level 1 pet. # level type = the selection from the LEVEL TYPES list below, which can be set # to determine param gain per pet level and skills gained. # hated food = pet will not eat items with <food: a,b> note tag that includes # a hated food type. # liked food = pet will gain bonus exp when eating liked food. #------------------------------------------------------------------------------# #------------------------------------------------------------------------------# # # ** LEVEL TYPES # #------------------------------------------------------------------------------# # This list allows you to determine parameter and skill gain for levelling up # your pets. These level types can be used on multiple pets if required. #------------------------------------------------------------------------------# LTYPE = { # don't touch #------------------------------------------------------------------------------# #------------------------------------------------------------------------------# :strong => [ #[mhp,mmp,atk,def,mat,mdf,agi,luk], variance [100,10, 20, 20, 40, 10, 0, 0], 50, {# Lvl => [[gained skills],[removed skills]], 2 => [[81], []], 4 => [[15], []], 7 => [[16], []], }], #------------------------------------------------------------------------------# #------------------------------------------------------------------------------# :smart => [ #[mhp,mmp,atk,def,mat,mdf,agi,luk], variance [34, 100,0, 10, 30, 10, 4, 10], 0, {# Lvl => [[gained skills],[removed skills]], 2 => [[14,19,20], []], 4 => [[15], [14,19,20]], 7 => [[16], [15]], }], #------------------------------------------------------------------------------# #------------------------------------------------------------------------------# :lucky => [ #[mhp,mmp,atk,def,mat,mdf,agi,luk], variance [20, 20, 2, 3, 5, 5, 20, 30], 20, {# Lvl => [[gained skills],[removed skills]], 2 => [[14], []], 4 => [[15], []], 7 => [[16], []], }], #------------------------------------------------------------------------------# #------------------------------------------------------------------------------# # Pet Type Explanation #------------------------------------------------------------------------------# # :type = the name of your level type to be used in the pet setup # [mhp,mmp...] = the parameter bonuses pets gain per level up # variance = randomize the amount gained per level by this % up or down # eg. if set to 6 atk per level, variance 50 means it could result # in a number between 3 and 9 (50% variance either way) # Lvl => [[gained skills],[removed skills]], # This determines skills learned and forgotten on the levels specified. # eg. the below would learn skills 14,19,20 and forget 5,6,7,8 on level 2. # 2 => [[14,19,20], [5,6,7,8]], #------------------------------------------------------------------------------# } # don't touch #------------------------------------------------------------------------------# #------------------------------------------------------------------------------# # # ** END OF SETTINGS # #------------------------------------------------------------------------------# end #----------------------# #---| GAME_INTERPRETER |---------------------------------------------------- #----------------------# class Game_Interpreter def manage_pets; SceneManager.call(Scene_PetManager); end def gain_pet(pet_id); $game_system.pets[pet_id].in_party = true; end def lose_pet(pet_id); $game_system.pets[pet_id].in_party = false; end def lock_pet(pet_id,status); $game_system.pets[pet_id].locked = status; end def equip_pet(id,pet_id) $game_actors[id].equip_pet(pet_id) SceneManager.scene.refresh_pets if SceneManager.scene_is?(Scene_Battle) end def actor_remove_pet(id) return if $game_actors[id].pet.nil? $game_actors[id].unequip_pet SceneManager.scene.refresh_pets if SceneManager.scene_is?(Scene_Battle) end def remove_pet(pet_id) return if $game_system.pets[pet_id].nil? $game_actors[$game_system.pets[pet_id].owner].pet = nil $game_system.pets[pet_id].owner = 0 SceneManager.scene.refresh_pets if SceneManager.scene_is?(Scene_Battle) end def pet_exp(pet_id,exp); $game_system.pets[pet_id].gain_exp(exp); end def actor_pet_exp(id,exp) return if $game_actors[id].pet.nil? $game_actors[id].pet.gain_exp(exp) end def pet_teach(pet_id,skill_id) $game_system.pets[pet_id].learn_skill(skill_id) end def actor_pet_teach(id,skill_id) return if $game_actors[id].pet.nil? $game_actors[id].pet.learn_skill(skill_id) end def pet_forget(pet_id,skill_id) $game_system.pets[pet_id].forget_skill(skill_id) end def actor_pet_forget(id,skill_id) return if $game_actors[id].pet.nil? $game_actors[id].pet.forget_skill(skill_id) end end # Game_Interpreter #-------------------# #---| RPG::BASEITEM |------------------------------------------------------- #-------------------# class RPG::BaseItem def food_exp if @food_exp.nil? @food_exp = food_value(0) end @food_exp end def food_type if @food_type.nil? @food_type = food_value(1) end @food_type end def food_value(index) if @note =~ /<food: (.*),(.*)>/i value = [$1.to_i,$2.to_i] result = value[index] else result = -1 end return result end end # RPG::BaseItem #----------------# #---| GAME_ACTOR |---------------------------------------------------------- #----------------# class Game_Actor < Game_Battler attr_accessor :pet attr_accessor :pet_opacity attr_accessor :can_pet alias galv_bpet_ga_setup setup def setup(actor_id) galv_bpet_ga_setup(actor_id) @pet_opacity = 255 if $data_actors[actor_id].note =~ /<no_pet>/i @can_pet = false else @can_pet = true end end def pet_id return @pet ? @pet.id : -1 end alias galv_bpet_ga_feature_objects feature_objects def feature_objects galv_bpet_ga_feature_objects + pet_features end def pet_features return @pet ? [@pet] : [] end alias galv_bpet_ga_param_plus param_plus def param_plus(param_id) galv_bpet_ga_param_plus(param_id) + pet_params(param_id) end def pet_params(param_id) return @pet ? @pet.params[param_id] : 0 end def equip_pet(pet_id) return if !pet_equippable?($game_system.pets[pet_id]) # remove pet from anywhere equipped if $game_system.pets[pet_id].owner > 0 return if $game_actors[$game_system.pets[pet_id].owner].pet.locked $game_actors[$game_system.pets[pet_id].owner].pet = nil end # if pet equipped, remove it @pet.owner = 0 if @pet # assign new pet ownership. Assign pet to actor $game_system.pets[pet_id].owner = @actor_id @pet = $game_system.pets[pet_id] end def unequip_pet return if !@pet return if @pet.locked @pet.owner = 0 @pet = nil end def pet_equippable?(item) return false if !@can_pet return equip_atype_ok?(item.atype_id) return false end end # Game_Actor < Game_Battler #-----------------# #---| GAME_SYSTEM |--------------------------------------------------------- #-----------------# class Game_System attr_accessor :pets attr_accessor :menupet alias galv_bpet_gs_initialize initialize def initialize galv_bpet_gs_initialize create_pets end def create_pets @pets = [] GALV_BPET::PET.each_with_index { |data,i| next if data.nil? @pets << Game_BPet.new(data,i) } end end # Game_System #---------------# #---| GAME_BPET |----------------------------------------------------------- #---------------# class Game_BPet attr_accessor :icon_index attr_accessor :name attr_reader :level attr_reader :exp attr_accessor :description attr_accessor :image attr_accessor :x # x_offset in relation to actor battler attr_accessor :y # y_offset in relation to actor battler attr_accessor :in_party # true, false attr_accessor :owner # 0, actor_id (the actor who has it equipped) attr_reader :id # array index attr_reader :features # equip features attr_reader :params # param bonus attr_accessor :locked # true or false. Cannot access via menu attr_reader :liked_food # bonus exp for eating liked food attr_reader :hated_food # will not eat hated food attr_accessor :level_type # how pet levels up, in settings attr_reader :atype_id # armor type (to determine if equippable) def initialize(data,index) @data = Array.new(data) @id = index setup_pet end def setup_pet @level = 1 @exp = 0 @name,@image,@x,@y,@armor_id,@level_type,@hated_food,@liked_food = @data @status = false @features = Array.new($data_armors[@armor_id].features) @params = Array.new($data_armors[@armor_id].params) @icon_index = $data_armors[@armor_id].icon_index @description = $data_armors[@armor_id].description @atype_id = $data_armors[@armor_id].atype_id @owner = 0 @locked = false end def gain_exp(amount, liked = false) like_mod = liked ? GALV_BPET::LIKE_BONUS : 1 @exp += (amount / @level) * like_mod do_levelup if @exp >= GALV_BPET::EXP_PER_LEVEL @exp = 0 if @exp < 0 end def do_levelup return if @level >= GALV_BPET::LEVEL_CAP @level += 1 @exp = 0 # gain params ltype[0].each_with_index { |bonus,i| change = apply_variance(bonus) @params[i] += change } if ltype[2][@level] # gain skills ltype[2][@level][0].each { |skill_id| learn_skill(skill_id) } # lose skills ltype[2][@level][1].each { |skill_id| forget_skill(skill_id) } end end def learn_skill(skill_id) @features.push(RPG::BaseItem::Feature.new(43, skill_id, 0)) end def forget_skill(*args) skills = [*args] forget_list = @features.collect { |f| f if f.code == 43 && skills.include?(f.data_id) } forget_list.compact.each { |s| @features.delete(s) } end def apply_variance(bonus) variance = ltype[1] amp = [bonus.abs * variance / 100, 0].max.to_i var = rand(amp + 1) + rand(amp + 1) - amp bonus >= 0 ? bonus + var : bonus - var end def ltype; GALV_BPET::LTYPE[@level_type]; end end # Game_BPet #----------------------# #---| SPRITESET_BATTLE |---------------------------------------------------- #----------------------# class Spriteset_Battle alias galv_bpet_sb_create_actors create_actors def create_actors galv_bpet_sb_create_actors create_pets end def create_pets @pet_sprites = [] return if !GALV_BPET::ENABLE $game_party.battle_members.each { |actor| @pet_sprites << Sprite_PetBattler.new(@viewport1, actor) if actor.pet } end def refresh_pets dispose_pets create_pets end alias galv_bpet_sb_update_actors update_actors def update_actors galv_bpet_sb_update_actors @pet_sprites.each { |sprite| sprite.update } end alias galv_bpet_sb_dispose dispose def dispose dispose_pets galv_bpet_sb_dispose end def dispose_pets @pet_sprites.each { |sprite| sprite.dispose if sprite } end end # Spriteset_Battle #------------------# #---| SCENE_BATTLE |-------------------------------------------------------- #------------------# class Scene_Battle < Scene_Base def refresh_pets @spriteset.refresh_pets end end #-----------------------# #---| SPRITE_PETBATTLER |--------------------------------------------------- #-----------------------# class Sprite_PetBattler < Sprite_Base def initialize(viewport, battler = nil) @battler = battler @pet = @battler.pet init_variables super(viewport) end def init_variables @pattern = 0 @speed_timer = 0 @pose = 0 end def update if @battler && @battler.animated_battler update_bitmap update_src_rect update_anim update_position end super end def update_bitmap new_bitmap = Cache.battler(@pet.image,@battler.battler_hue) if bitmap != new_bitmap self.bitmap = new_bitmap spritesheet_normal end end def spritesheet_normal @cw = bitmap.width / GALV_BPET::COLS @ch = bitmap.height / GALV_BPET::ROWS self.ox = @cw / 2 self.oy = @ch self.x = @battler.screen_x + @pet.x self.y = @battler.screen_y + @pet.y set_mirror end def set_mirror self.mirror = GALV_BPET::PET_FLIP end def update_src_rect if @pattern >= GALV_BPET::COLS @pattern = 0 end sx = @pattern * @cw sy = 0 self.src_rect.set(sx, sy, @cw, @ch) end def update_anim @speed_timer += 1 if @speed_timer > 8 @pattern += 1 @speed_timer = 0 end end def target_x; @battler.screen_x + @pet.x; end def target_y; @battler.screen_y + @pet.y; end if $imported["Galv_Animated_Battlers"] def move_speed @battler.move_speed.to_f - 1 end else def move_speed (self.x % target_x) - 30 end end def update_position if self.x < target_x self.x = target_x elsif self.x > target_x self.x -= [move_speed,1].max end self.y = target_y self.z = @battler.screen_z self.opacity = @battler.alive? ? @battler.pet_opacity : 0 end def dispose super end end # Sprite_PetBattler < Sprite_Base #------------------------------------------------------------------------------- if $imported["Galv_Animated_Battlers"] #-------------------------# #---| SPRITE_ACTORBATTLER |------------------------------------------------- #-------------------------# class Sprite_ActorBattler < Sprite_AnimBattler def update; super; @battler.pet_opacity = self.opacity; end end else # if not using Galv's Animated Battlers #--------------------# #---| SPRITE_BATTLER |------------------------------------------------------ #--------------------# class Sprite_Battler < Sprite_Base alias galv_bpet_sb_update update def galv_bpet_sb_update @battler.pet_opacity = self.opacity end end # Sprite_Battler < Sprite_Base #------------------------# #---| SPRITE_BATTLERBASE |-------------------------------------------------- #------------------------# class Game_BattlerBase attr_accessor :pet_opacity attr_accessor :animated_battler alias galv_bpet_gbb_initialize initialize def initialize galv_bpet_gbb_initialize @pet_opacity = 255 @animated_battler = true end end # Game_BattlerBase end # if $imported["Galv_Animated_Battlers"] #------------------------------------------------------------------------------- #----------------------# #---| SCENE_PETMANAGER |---------------------------------------------------- #----------------------# class Scene_PetManager < Scene_MenuBase def start super create_command_window create_pet_window create_item_window create_actors_window create_help_window create_status_window refresh_pet_info end #---- Create Stuff def create_command_window @command_window = Window_PetCommand.new(0, 0) @command_window.viewport = @viewport @command_window.set_handler(:equip, method(:command_equip)) @command_window.set_handler(:unequip, method(:command_equip)) @command_window.set_handler(:feed, method(:command_feed)) @command_window.set_handler(:clear, method(:command_clear)) @command_window.set_handler(:cancel, method(:return_scene)) @command_window.select(0) end def create_pet_window ww = Graphics.width - @command_window.width wx = @command_window.width @pet_window = Window_Pet.new(wx,0,ww,80) @pet_window.viewport = @viewport @pet_window.set_handler(:ok, method(:on_pet_ok)) @pet_window.set_handler(:cancel, method(:on_pet_cancel)) @pet_window.deactivate @pet_window.select(0) $game_system.menupet = @pet_window.item end def create_item_window wy = @command_window.height ww = @command_window.width wh = Graphics.height - @command_window.height @item_window = Window_PetItems.new(0,wy,ww,wh) @item_window.viewport = @viewport @item_window.set_handler(:ok, method(:on_item_ok)) @item_window.set_handler(:cancel, method(:on_item_cancel)) @item_window.unselect @item_window.deactivate @item_window.refresh end def create_actors_window wy = @item_window.y ww = @item_window.width wh = @item_window.height @actor_window = Window_PetActors.new(0,wy,ww,wh) @actor_window.viewport = @viewport @actor_window.set_handler(:ok, method(:on_actor_ok)) @actor_window.set_handler(:cancel, method(:on_actor_cancel)) @actor_window.deactivate @actor_window.hide end def create_help_window wx = @item_window.width ww = Graphics.width - @item_window.width @help_window = Window_PetHelp.new(wx,ww) @help_window.viewport = @viewport end def create_status_window wx = @item_window.width ww = Graphics.width - @item_window.width wy = @pet_window.height wh = Graphics.height - @pet_window.height - @help_window.height @status_window = Window_PetStatus.new(wx,wy,ww,wh) @status_window.viewport = @viewport end #---- Handlers def on_pet_ok $game_system.menupet = @pet_window.item case @command_window.current_symbol when :feed Sound.play_ok @item_window.activate @item_window.select(0) when :equip equip_actor end end def on_pet_cancel @pet_window.deactivate case @command_window.current_symbol when :feed @command_window.activate show_window(@item_window,-1) when :equip @actor_window.activate show_window(@actor_window,-1) end end def command_equip if @command_window.current_symbol == :unequip @actor_window.unequip = true else @actor_window.unequip = false end show_window(@actor_window) @actor_window.activate @actor_window.select(0) end def command_feed show_window(@item_window) @pet_window.activate end def command_clear unequip_all @command_window.activate end def on_item_ok eat_food end def on_actor_ok case @command_window.current_symbol when :equip @pet_window.refresh @pet_window.activate when :unequip; unequip_actor; end end def on_actor_cancel @actor_window.unselect @command_window.activate end def on_item_cancel @item_window.deactivate @pet_window.activate @item_window.unselect end #---- Functionality def show_window(window,select = 0) return if window.visible @item_window.deactivate.hide @actor_window.deactivate.hide window.show window.refresh if @command_window.active window.unselect else window.select(select) end end def update super update_info_window update_pet_window end def update_info_window if @command_window.active case @command_window.current_symbol when :equip, :clear show_window(@actor_window) when :feed show_window(@item_window) end end end def update_pet_window if @actor_window.active && @command_window.current_symbol == :equip if @pet_window.actor != @actor_window.item @pet_window.actor = @actor_window.item @pet_window.refresh end elsif !@pet_window.active if !@pet_window.actor.nil? @pet_window.actor = nil @pet_window.refresh end end end def refresh_pet_info $game_system.menupet = @pet_window.item @help_window.update_desc($game_system.menupet) @status_window.refresh @item_window.unselect @item_window.refresh end def eat_food item = @item_window.item clevel = $game_system.menupet.level like = $game_system.menupet.liked_food.include?(item.food_type) $game_system.menupet.gain_exp(item.food_exp,like) se,vol,pit = GALV_BPET::EAT_SE RPG::SE.new(se,vol,pit).play $game_party.lose_item(item,1) @help_window.update_desc($game_system.menupet) @status_window.refresh @pet_window.refresh @item_window.refresh if @item_window.index >= @item_window.item_max @item_window.select([@item_window.item_max - 1,0].max) end if $game_system.menupet.level > clevel se,vol,pit = GALV_BPET::LEVELUP_SE RPG::SE.new(se,vol,pit).play end @item_window.activate end def equip_actor actor = @actor_window.item if actor.pet_equippable?($game_system.menupet) actor.equip_pet($game_system.menupet.id) se,vol,pit = GALV_BPET::EQUIP_SE RPG::SE.new(se,vol,pit).play else Sound.play_buzzer end @status_window.refresh @actor_window.refresh @pet_window.refresh @pet_window.activate end def unequip_actor @actor_window.item.unequip_pet se,vol,pit = GALV_BPET::UNEQUIP_SE RPG::SE.new(se,vol,pit).play @status_window.refresh @actor_window.refresh @pet_window.refresh @actor_window.activate end def unequip_all $game_party.members.each { |actor| actor.unequip_pet } @status_window.refresh @actor_window.refresh @pet_window.refresh @command_window.activate end def terminate super end end # Scene_PetManager < Scene_MenuBase #------------------------# #---| IF INCLUDE IN MENU |-------------------------------------------------- #------------------------# if GALV_BPET::INCLUDE_IN_MENU class Window_MenuCommand < Window_Command alias galv_bpet_wmc_add_original_commands add_original_commands def add_original_commands add_command(GALV_BPET::MENU_TXT, :pets, main_commands_enabled) end end # Window_MenuCommand < Window_Command class Scene_Menu < Scene_MenuBase alias galv_bpet_sm_create_command_window create_command_window def create_command_window galv_bpet_sm_create_command_window @command_window.set_handler(:pets, method(:command_pets)) end def command_pets SceneManager.call(Scene_PetManager) end end # Scene_Menu < Scene_MenuBase end #----------------# #---| WINDOW_PET |---------------------------------------------------------- #----------------# class Window_Pet < Window_Selectable attr_accessor :actor def initialize(x, y, width, height) super @data = [] refresh end def item_max; @data ? @data.size : 1; end def item; @data && index >= 0 ? @data[index] : nil; end def current_item_enabled? enable?(@data[index]) # check end def include?(item) return false if item.nil? return true if item.in_party == true return false end def enable?(item) return false if item.nil? return false if @actor && !@actor.pet_equippable?(item) return !item.locked end def make_item_list @data = $game_system.pets.select {|pet| include?(pet) } @data.push(nil) if include?(nil) end def draw_item(index) item = @data[index] if item rect = item_rect(index) rect.width -= 4 draw_pet(item, rect.x, rect.y, enable?(item)) end end def draw_pet(item,x,y,enabled = true) draw_pet_image(x,y,item) change_color(normal_color,enabled) contents.font.size = GALV_BPET::FONT_SIZE - 3 txt = item.owner > 0 ? $game_actors[item.owner].name : GALV_BPET::UNEQUIPPED_TXT draw_text(x, y + 44, item_width, line_height, txt, 1) txt = Vocab::level_a + item.level.to_s draw_text(x + 6, y, item_width, line_height, txt, 0) if item.locked draw_text(x, y + 22, item_width, line_height, GALV_BPET::LOCK_TXT,1) elsif !enabled draw_text(x, y + 22, item_width, line_height, GALV_BPET::CANT_EQUIP_TXT,1) end end def draw_pet_image(x,y,item) bitmap = Cache.battler(item.image,0) iw = bitmap.width / GALV_BPET::COLS ih = bitmap.height / GALV_BPET::ROWS ix = (iw - item_width) * 0.5 rect = Rect.new(ix, 0, iw, ih) contents.blt(x, y - 10, bitmap, rect, 255) end def update_help @help_window.set_item(item) end def refresh make_item_list create_contents draw_all_items end #----- HORZ STUFF def visible_line_number; return 1; end def col_max; return 4; end def spacing; return 0; end def item_height; return 68; end def standard_padding; 6; end def contents_width; (item_width + spacing) * item_max - spacing; end def contents_height; item_height; end def item_rect(index) rect = super rect.x = index * (item_width + spacing) rect.y = 0 rect end def top_col ox / (item_width + spacing) end def top_col=(col) col = 0 if col < 0 pet_count = $game_system.pets.count col = col_max + pet_count if col > col_max + pet_count self.ox = col * (item_width + spacing) end def bottom_col top_col + col_max - 1 end def bottom_col=(col) self.top_col = col - (col_max - 1) end def ensure_cursor_visible self.top_col = index if index < top_col self.bottom_col = index if index > bottom_col end def cursor_down(wrap = false); move_cursor; end def cursor_up(wrap = false); move_cursor; end def cursor_left(wrap = false); wrap = false; super; move_cursor; end def cursor_right(wrap = false); wrap = false; super; move_cursor; end def cursor_pagedown; end def cursor_pageup; end def process_ok if current_item_enabled? Input.update deactivate call_ok_handler else Sound.play_buzzer end end def move_cursor; SceneManager.scene.refresh_pet_info; end end # Window_Pet < Window_Selectable #-----------------# #---| PET_COMMAND |--------------------------------------------------------- #-----------------# class Window_PetCommand < Window_Command def initialize(x, y) super(x, y) @actor = nil end def window_width return GALV_BPET::MENU_WIDTH end def visible_line_number return 4 end def make_command_list add_command(GALV_BPET::FEED[0], :feed, true) add_command(GALV_BPET::EQUIP[0], :equip, true) add_command(GALV_BPET::UNEQUIP[0], :unequip, true) add_command(GALV_BPET::CLEAR[0], :clear, true) end def draw_item(index) contents.font.size = GALV_BPET::FONT_SIZE + 2 change_color(normal_color, command_enabled?(index)) rect = item_rect_for_text(index) icon = 0 case @list[index][:symbol] when :feed; icon = GALV_BPET::FEED[1] when :equip; icon = GALV_BPET::EQUIP[1] when :unequip; icon = GALV_BPET::UNEQUIP[1] when :clear; icon = GALV_BPET::CLEAR[1];end draw_icon(icon, rect.x - 4, rect.y, true) draw_text(rect.x + 28,rect.y,rect.width,rect.height,command_name(index),0) end def update super end def select_last select(0) end def process_ok if current_item_enabled? play_custom_sound Input.update deactivate call_ok_handler else Sound.play_buzzer end end def play_custom_sound case current_symbol when :feed, :equip, :unequip Sound.play_ok when :clear se,vol,pit = GALV_BPET::CLEAR_SE RPG::SE.new(se,vol,pit).play end end end # Window_PetCommand < Window_Command #---------------------# #---| WINDOW_PETITEMS |----------------------------------------------------- #---------------------# class Window_PetItems < Window_ItemList def initialize(x, y, width, height) super(x, y, width, height) end def col_max; return 1; end def current_item_enabled? enable?(@data[index]) end def include?(item) return false if item.nil? return false if item.food_type < 0 return true if $game_system.menupet.nil? return true end def draw_item(index) contents.font.size = GALV_BPET::FONT_SIZE super end def enable?(item) return false if item.nil? return false if $game_system.menupet.nil? return false if $game_system.menupet.hated_food.include?(item.food_type) return true end def process_ok if current_item_enabled? play_custom_sound Input.update deactivate call_ok_handler else Sound.play_buzzer end end def play_custom_sound se,vol,pit = GALV_BPET::EAT_SE RPG::SE.new(se,vol,pit).play end end # Window_PetItems < Window_ItemList #----------------------# #---| WINDOW_PETACTORS |---------------------------------------------------- #----------------------# class Window_PetActors < Window_ItemList attr_accessor :unequip def initialize(x, y, width, height) super(x, y, width, height) refresh end def col_max; return 1; end def current_item_enabled? enable?(@data[index]) end def make_item_list @data = $game_party.members.select {|actor| include?(actor) } @data.push(nil) if include?(nil) end def include?(item) return false if item.nil? return true end def draw_item(index) item = @data[index] contents.font.size = GALV_BPET::FONT_SIZE if item rect = item_rect(index) rect.width -= 4 draw_item_name(item, rect.x, rect.y, enable?(item)) end end def draw_item_name(item, x, y, enabled = true, width = 172) return if !item icon = item.pet ? item.pet.icon_index : GALV_BPET::NO_EQUIP_ICON draw_icon(icon, x, y, enabled) change_color(normal_color, enabled) draw_text(x + 26, y, width, line_height, item.name) end def enable?(item) return true if item.nil? return false if item.pet && item.pet.locked return false if !item.can_pet return true end def process_ok if current_item_enabled? Sound.play_ok if !@unequip Input.update deactivate call_ok_handler else Sound.play_buzzer end end end # Window_PetActors < Window_ItemList #--------------------# #---| WINDOW_PETHELP |------------------------------------------------------ #--------------------# class Window_PetHelp < Window_Base def initialize(x,width) super(x, Graphics.height - fitting_height(2), width, fitting_height(2)) end def clear; @text = ""; end def update_desc(item) return clear if item.nil? if item.description != @text @text = item.description refresh end end def refresh contents.clear contents.font.size = GALV_BPET::FONT_SIZE draw_text_ex(4, 0, @text) end def draw_text_ex(x, y, text) text = convert_escape_characters(text) pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)} process_character(text.slice!(0, 1), text, pos) until text.empty? reset_font_settings end end # Window_PetHelp < Window_Base #----------------------# #---| WINDOW_PETSTATUS |---------------------------------------------------- #----------------------# class Window_PetStatus < Window_Base def initialize(x,y,width,height) super(x, y, width, height) end def refresh contents.clear draw_status end def pet; $game_system.menupet; end def line_height return Graphics.height > 460 ? 26 : 22 end def sy; return Graphics.height >= 460 ? 75 : 62; end def draw_status draw_name draw_pet_level(0, line_height * 1) draw_pet_exp(80, line_height * 1) draw_owner draw_pet_image draw_horz_line(line_height * 2) 8.times {|i| draw_pet_param(pet, 0, sy + line_height * i, i) } draw_skills draw_states end def draw_name icon = pet ? pet.icon_index : 0 txt = pet ? pet.name : "" draw_icon(icon, 0, 0) change_color(normal_color, true) draw_text(30, 0, contents.width, line_height, txt) end def draw_pet_level(x, y) change_color(system_color) draw_text(x, y, 32, line_height, Vocab::level_a) change_color(normal_color) return if pet.nil? draw_text(x + 32, y, 24, line_height, pet.level, 2) end def draw_pet_exp(x, y) change_color(system_color) draw_text(x, y, 50, line_height, GALV_BPET::EXP_NAME) change_color(normal_color) return if pet.nil? txt = pet.exp.to_s + "/" + GALV_BPET::EXP_PER_LEVEL.to_s draw_text(x + 20, y, 80, line_height, txt, 2) end def draw_owner return if pet.nil? return if pet.owner <= 0 x = contents.width - 70 owner = $game_actors[pet.owner] draw_character(owner.character_name, owner.character_index, x, 40) end def draw_pet_image return if pet.nil? bitmap = Cache.battler(pet.image,0) iw = bitmap.width / GALV_BPET::COLS ih = bitmap.height / GALV_BPET::ROWS x = contents.width - iw y = 0 - ih / 2 + 25 rect = Rect.new(0, 0, iw, ih) contents.blt(x, y, bitmap, rect, 255) end def draw_horz_line(y) line_y = y + line_height / 2 - 1 contents.fill_rect(0, line_y, contents_width, 2, line_color) end def line_color color = normal_color color.alpha = 48 color end def draw_pet_param(pet, x, y, param_id) change_color(system_color) draw_text(x, y, 110, line_height, Vocab::param(param_id)) change_color(normal_color) return if pet.nil? draw_text(x + 60, y, 80, line_height, pet.params[param_id], 2) end def draw_skills return if pet.nil? skill_list = pet.features.collect {|f| f.data_id if f.code == 43 } skill_list.compact.each_with_index { |skill,i| draw_skill(skill,i) } end def draw_skill(id,index) skill = $data_skills[id] if skill x = contents.width / 2 - 15 y = sy + line_height * index draw_skill_name(skill, x, y, actor_use?(skill), contents.width / 2) end end def actor_use?(skill) return true if pet.owner <= 0 $game_actors[pet.owner].added_skill_types.include?(skill.stype_id) end def draw_skill_name(item, x, y, enabled = true, width = 172) return unless item draw_icon(item.icon_index, x, y, enabled) change_color(normal_color, enabled) draw_text(x + 24, y - 3, width, line_height + 10, item.name) end def draw_states x = contents.width / 2 - 15 y = sy + line_height * 6 change_color(system_color) draw_text(x, y, 120, line_height, "Inflict") draw_text(x, y + line_height, 120, line_height, "Resist") change_color(normal_color) return if pet.nil? atk_icons = [] # inflict def_icons = [] # resist pet.features.each { |f| if f.code == 32 atk_icons << $data_states[f.data_id].icon_index elsif f.code == 14 def_icons << $data_states[f.data_id].icon_index end } # Draw Atk if !atk_icons.empty? atk_icons.each_with_index {|n, i| draw_icon(n, x + 80 + 24 * i, y) } end # Draw Def if !def_icons.empty? def_icons.each_with_index {|n, i| draw_icon(n, x + 80 + 24 * i, y + line_height) } end end end # Window_PetStatus < Window_Base #-------------------------------# #---| OTHER ANIMBATTLER SCRIPTS |------------------------------------------- #-------------------------------# if $imported[:ve_actor_battlers] && $imported[:ve_animated_battle] class Sprite_PetBattler < Sprite_Base def target_x x = @battler.sprite ? @battler.sprite.position[:x] : @battler.screen_x return x + @pet.x end def target_y y = @battler.sprite ? @battler.sprite.position[:y] : @battler.screen_y return y + @pet.y end def update_position if self.x < target_x self.x = target_x elsif self.x > target_x self.x -= [move_speed,1].max end self.y = target_y self.z = @battler.screen_z self.opacity = @battler.alive? ? 255 : 0 end end end # $imported[:ve_animated_battle]
nice :),,,
and what’s the software name to make a character battler holders(sprite battle holder),master???do you know???
I don’t know what you are asking
You can use Game Character Hub to make things easier.
i’m sorry master,,but i mean how to make a Character sets in rpg maker?? what do you know master??
because,i’ve visited “http://animatedbattlers.wordpress.com/rpgmakermaterial/charactersets/”,and then,,i’m curious how to make it,for example: image on link address above,,,then therefore,,i ask you,master,,what do know about to make it?
” i’m so sorry,,my english is bad for you master and i’m sorry if you don’t understand about my asking”,,
I think you’re asking how to make your own animated battlers? You’ll need to learn how to sprite using a graphics program. I don’t teach that here, sorry
hmmm i yeahh no problem master,,,,but,,,may i know about software to make animated battlers master?? what do you know about that software???
it’s not working? script animated line 619 Nomethoderror occured undefinied method ‘features for nil:NukClass
Unfortunately, this is not a script for those just learning rpgmaker.
this script is interesting but easy to downlopad.
Could you put it on Github or make it easilly downloadable by Rigth Clic > save link as ?
thanks
Sorry, I don’t have time to put my scripts other places :(