====== Centrar Battlers ====== ===== Ficha técnica ===== * **Nombre original:** Desconocido * **Nombre del autor:** Cogwheel * **Utilidad:** Permite centrar los Battlers en el sistema de batalla por defecto del RPG Maker y otros similares. * **Dependencia de otros scripts:** No. * **Incompatibilidades:** Script de batalla de MakirouAru y Script Limit Breaks de KGC. ===== Instalación ===== Crear un nuevo script sobre "Main" y pegar en él el siguiente código: # í“¬”wŒi‘S‘̉» Ver 1.01 # ”z•zŒ³EƒTƒ|[ƒgURL # http://members.jcom.home.ne.jp/cogwheel/ #============================================================================== # ¡ Game_Actor #------------------------------------------------------------------------------ # @ƒAƒNƒ^[‚ðˆµ‚¤ƒNƒ‰ƒX‚Å‚·B‚±‚̃Nƒ‰ƒX‚Í Game_Actors ƒNƒ‰ƒX ($game_actors) # ‚Ì“à•”‚ÅŽg—p‚³‚êAGame_Party ƒNƒ‰ƒX ($game_party) ‚©‚ç‚àŽQÆ‚³‚ê‚Ü‚·B #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # œ ƒoƒgƒ‹‰æ– X À•W‚̎擾 #-------------------------------------------------------------------------- def screen_x # ƒp[ƒeƒB“à‚Ì•À‚я‡‚©‚ç X À•W‚ðŒvŽZ‚µ‚Ä•Ô‚· if self.index != nil return self.index * 160 + (4 - $game_party.actors.size) * 80 + 80 else return 0 end end end #============================================================================== # ¡ Spriteset_Battle #------------------------------------------------------------------------------ # @ƒoƒgƒ‹‰æ–‚̃Xƒvƒ‰ƒCƒg‚ð‚Ü‚Æ‚ß‚½ƒNƒ‰ƒX‚Å‚·B‚±‚̃Nƒ‰ƒX‚Í Scene_Battle ƒNƒ‰ # ƒX‚Ì“à•”‚ÅŽg—p‚³‚ê‚Ü‚·B #============================================================================== class Spriteset_Battle #-------------------------------------------------------------------------- # œ ƒIƒuƒWƒFƒNƒg‰Šú‰» #-------------------------------------------------------------------------- def initialize # ƒrƒ…[ƒ|[ƒg‚ðì¬ @viewport1 = Viewport.new(0, 0, 640, 480) @viewport2 = Viewport.new(0, 0, 640, 480) @viewport3 = Viewport.new(0, 0, 640, 480) @viewport4 = Viewport.new(0, 0, 640, 480) @viewport2.z = 101 @viewport3.z = 200 @viewport4.z = 5000 # ƒoƒgƒ‹ƒoƒbƒNƒXƒvƒ‰ƒCƒg‚ðì¬ @battleback_sprite = Sprite.new(@viewport1) # ƒGƒlƒ~[ƒXƒvƒ‰ƒCƒg‚ðì¬ @enemy_sprites = [] for enemy in $game_troop.enemies.reverse @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy)) end # ƒAƒNƒ^[ƒXƒvƒ‰ƒCƒg‚ðì¬ @actor_sprites = [] @actor_sprites.push(Sprite_Battler.new(@viewport2)) @actor_sprites.push(Sprite_Battler.new(@viewport2)) @actor_sprites.push(Sprite_Battler.new(@viewport2)) @actor_sprites.push(Sprite_Battler.new(@viewport2)) # “VŒó‚ðì¬ @weather = RPG::Weather.new(@viewport1) # ƒsƒNƒ`ƒƒƒXƒvƒ‰ƒCƒg‚ðì¬ @picture_sprites = [] for i in 51..100 @picture_sprites.push(Sprite_Picture.new(@viewport3, $game_screen.pictures[i])) end # ƒ^ƒCƒ}[ƒXƒvƒ‰ƒCƒg‚ðì¬ @timer_sprite = Sprite_Timer.new # ƒtƒŒ[ƒ€XV update end #-------------------------------------------------------------------------- # œ ƒtƒŒ[ƒ€XV #-------------------------------------------------------------------------- def update # ƒAƒNƒ^[ƒXƒvƒ‰ƒCƒg‚Ì“à—e‚ðXV (ƒAƒNƒ^[‚Ì“ü‚ê‘Ö‚¦‚ɑΉž) @actor_sprites[0].battler = $game_party.actors[0] @actor_sprites[1].battler = $game_party.actors[1] @actor_sprites[2].battler = $game_party.actors[2] @actor_sprites[3].battler = $game_party.actors[3] # ƒoƒgƒ‹ƒoƒbƒN‚̃tƒ@ƒCƒ‹–¼‚ªŒ»Ý‚Ì‚à‚̂ƈႤê‡ if @battleback_name != $game_temp.battleback_name @battleback_name = $game_temp.battleback_name if @battleback_sprite.bitmap != nil @battleback_sprite.bitmap.dispose end @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name) @battleback_sprite.src_rect.set(0, 0, 640, 480) if @battleback_sprite.bitmap.height == 320 @battleback_sprite.zoom_x = 2.0 @battleback_sprite.zoom_y = 2.0 @battleback_sprite.x = 320 @battleback_sprite.y = 480 @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2 @battleback_sprite.oy = @battleback_sprite.bitmap.height else @battleback_sprite.x = 0 @battleback_sprite.y = 0 @battleback_sprite.ox = 0 @battleback_sprite.oy = 0 @battleback_sprite.zoom_x = 1 @battleback_sprite.zoom_y = 1 end end # ƒoƒgƒ‰[ƒXƒvƒ‰ƒCƒg‚ðXV for sprite in @enemy_sprites + @actor_sprites sprite.update end # “VŒóƒOƒ‰ƒtƒBƒbƒN‚ðXV @weather.type = $game_screen.weather_type @weather.max = $game_screen.weather_max @weather.update # ƒsƒNƒ`ƒƒƒXƒvƒ‰ƒCƒg‚ðXV for sprite in @picture_sprites sprite.update end # ƒ^ƒCƒ}[ƒXƒvƒ‰ƒCƒg‚ðXV @timer_sprite.update # ‰æ–‚̐F’²‚ƃVƒFƒCƒNˆ’u‚ðÝ’è @viewport1.tone = $game_screen.tone @viewport1.ox = $game_screen.shake # ‰æ–‚̃tƒ‰ƒbƒVƒ…F‚ðÝ’è @viewport4.color = $game_screen.flash_color # ƒrƒ…[ƒ|[ƒg‚ðXV @viewport1.update @viewport2.update @viewport4.update end end #============================================================================== # ¡ Window_BattleStatus #------------------------------------------------------------------------------ # @ƒoƒgƒ‹‰æ–‚Ńp[ƒeƒBƒƒ“ƒo[‚̃Xƒe[ƒ^ƒX‚ð•\Ž¦‚·‚éƒEƒBƒ“ƒhƒE‚Å‚·B #============================================================================== class Window_BattleStatus < Window_Base #-------------------------------------------------------------------------- # œ ƒIƒuƒWƒFƒNƒg‰Šú‰» #-------------------------------------------------------------------------- def initialize x = (4 - $game_party.actors.size) * 80 width = $game_party.actors.size * 160 super(x, 320, width, 160) self.contents = Bitmap.new(width - 32, height - 32) self.back_opacity = 160 @level_up_flags = [false, false, false, false] refresh end #-------------------------------------------------------------------------- # œ ƒtƒŒ[ƒ€XV #-------------------------------------------------------------------------- def update super if self.x != (4 - $game_party.actors.size) * 80 self.x = (4 - $game_party.actors.size) * 80 self.width = $game_party.actors.size * 160 self.contents = Bitmap.new(self.width - 32, self.height - 32) refresh end # ƒƒCƒ“ƒtƒF[ƒY‚Ì‚Æ‚«‚Í•s“§–¾“x‚ð‚â‚≺‚°‚é if $game_temp.battle_main_phase self.contents_opacity -= 4 if self.contents_opacity > 191 else self.contents_opacity += 4 if self.contents_opacity < 255 end end end #============================================================================== # ¡ Scene_Battle (•ªŠ„’è‹` 3) #------------------------------------------------------------------------------ # @ƒoƒgƒ‹‰æ–‚̏ˆ—‚ðs‚¤ƒNƒ‰ƒX‚Å‚·B #============================================================================== class Scene_Battle #-------------------------------------------------------------------------- # œ ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚̃ZƒbƒgƒAƒbƒv #-------------------------------------------------------------------------- def phase3_setup_command_window # ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚𖳌ø‰» @party_command_window.active = false @party_command_window.visible = false # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚ð—LŒø‰» @actor_command_window.active = true @actor_command_window.visible = true # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚̈’u‚ðÝ’è @actor_command_window.x = @actor_index * 160 + (4 - $game_party.actors.size) * 80 # ƒCƒ“ƒfƒbƒNƒX‚ð 0 ‚ɐݒè @actor_command_window.index = 0 end end #============================================================================== # ¡ Spriteƒ‚ƒWƒ…[ƒ‹ #------------------------------------------------------------------------------ # @ƒAƒjƒ[ƒVƒ‡ƒ“‚ÌŠÇ—‚ðs‚¤ƒ‚ƒWƒ…[ƒ‹‚Å‚·B #============================================================================== module RPG class Sprite < ::Sprite def animation_set_sprites(sprites, cell_data, position) for i in 0..15 sprite = sprites[i] pattern = cell_data[i, 0] if sprite == nil or pattern == nil or pattern == -1 sprite.visible = false if sprite != nil next end sprite.visible = true sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192) if position == 3 if self.viewport != nil sprite.x = self.viewport.rect.width / 2 if $game_temp.in_battle and self.battler.is_a?(Game_Actor) sprite.y = self.viewport.rect.height - 160 else sprite.y = self.viewport.rect.height - 320 end else sprite.x = 320 sprite.y = 240 end else sprite.x = self.x + self.viewport.rect.x - self.ox + self.src_rect.width / 2 sprite.y = self.y + self.viewport.rect.y - self.oy * self.zoom_y + self.src_rect.height * self.zoom_y / 2 sprite.y -= self.src_rect.height / 4 if position == 0 sprite.y += self.src_rect.height / 4 if position == 2 end sprite.x += cell_data[i, 1] sprite.y += cell_data[i, 2] sprite.z = 2000 sprite.ox = 96 sprite.oy = 96 sprite.zoom_x = cell_data[i, 3] / 100.0 sprite.zoom_y = cell_data[i, 3] / 100.0 sprite.angle = cell_data[i, 4] sprite.mirror = (cell_data[i, 5] == 1) sprite.opacity = cell_data[i, 6] * self.opacity / 255.0 sprite.blend_type = cell_data[i, 7] end end end end