ayuda:rgss:biblioteca:batallakotfire
no way to compare when less than two revisions
Diferencias
Muestra las diferencias entre dos versiones de la página.
— | ayuda:rgss:biblioteca:batallakotfire [2019/09/23 04:01] (actual) – creado - editor externo 127.0.0.1 | ||
---|---|---|---|
Línea 1: | Línea 1: | ||
+ | ====== Sistema de Batalla de Kotfire ====== | ||
+ | |||
+ | |||
+ | |||
+ | ===== Ficha Técnica ===== | ||
+ | * **Nombre original:** Kotfire Custom Battle System | ||
+ | * **Nombre del autor:** Kotfire | ||
+ | * **Utilidad: | ||
+ | * **Dependencia de otros Scripts:** No | ||
+ | * **Incompatibilidad: | ||
+ | |||
+ | ===== Instalación ===== | ||
+ | Crea un script encima de " | ||
+ | |||
+ | ==== Script principal ==== | ||
+ | <code ruby> | ||
+ | # | ||
+ | # Kotfire Custom Battle System | ||
+ | # | ||
+ | # Script por: Kotfire | ||
+ | # Versión 1.0 | ||
+ | # | ||
+ | # -Instrucciones- | ||
+ | # Pegar encima de main y de todos los add-on para este script | ||
+ | # Leer el archivo de texto adjunto donde están todas las instrucciones ampliadas | ||
+ | # Editar las opciones a tu gusto | ||
+ | # Disfrutar | ||
+ | # | ||
+ | # ■ Options | ||
+ | # | ||
+ | module Options | ||
+ | module Cbs | ||
+ | Animations = [" | ||
+ | " | ||
+ | | ||
+ | # Posiciones de las poses en la plantilla | ||
+ | Stand = 0 | ||
+ | Move_to = 1 | ||
+ | Move_back = 2 | ||
+ | Attack = 3 | ||
+ | Skill = 4 | ||
+ | Hit = 5 | ||
+ | Guard = 6 | ||
+ | Miss = 7 | ||
+ | Dead = 8 | ||
+ | Item = 9 | ||
+ | Victory = 10 | ||
+ | |||
+ | Default_frames = [84, 84] | ||
+ | Move_speed = 10 | ||
+ | |||
+ | Weapon = { 21 => [Attack, false] } | ||
+ | Skill_Anim = { 57 => [11, false] } | ||
+ | Actor_Frame = {} | ||
+ | Enemy_Frame = {} | ||
+ | Pose_Frames = { 0 => 3, 3 => 5, 4 => 5, 5 => 1, 6 => 1, 7 => 1, 8 => 1, | ||
+ | 9 => 4, 10 => 6, 11 => 6 } | ||
+ | Pose_Delay = {} | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # - ATENCIÓN - | ||
+ | # | ||
+ | # NO EDITES NADA A PARTIR DE AQUÍ SI NO TIENES CONOCIMIENTOS DE RGSS | ||
+ | # | ||
+ | |||
+ | # | ||
+ | # ■ Add-on Manager | ||
+ | # | ||
+ | # Basado en el SDK log system | ||
+ | # | ||
+ | module Add_on | ||
+ | # | ||
+ | @add_ons = [] | ||
+ | @state = {} | ||
+ | # | ||
+ | def self.insert(name) | ||
+ | @add_ons.push(name) | ||
+ | @state[name] = true | ||
+ | end | ||
+ | # | ||
+ | def self.enable(name) | ||
+ | @state[name] = true | ||
+ | end | ||
+ | # | ||
+ | def self.disable(name) | ||
+ | @state[name] = false | ||
+ | return | ||
+ | end | ||
+ | # | ||
+ | def self.state(name) | ||
+ | return @state[name] | ||
+ | end | ||
+ | # | ||
+ | def self.scripts | ||
+ | return @add_ons | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # ■ Game_Battle | ||
+ | # | ||
+ | class Game_Battle | ||
+ | # | ||
+ | attr_accessor | ||
+ | attr_accessor | ||
+ | attr_accessor | ||
+ | attr_accessor | ||
+ | attr_accessor | ||
+ | # | ||
+ | def initialize | ||
+ | @animated_battlers = true | ||
+ | @animated_enemies = true | ||
+ | @move_battlers = true | ||
+ | @move_enemies = true | ||
+ | @mirror = false | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # ■ Scene_Title | ||
+ | # | ||
+ | |||
+ | class Scene_Title | ||
+ | # | ||
+ | alias kot_cbs_scenetitle_commandnewgame command_new_game | ||
+ | def command_new_game | ||
+ | $game_battle = Game_Battle.new | ||
+ | kot_cbs_scenetitle_commandnewgame | ||
+ | end | ||
+ | # | ||
+ | alias kot_cbs_scenetitle_battletest battle_test | ||
+ | def battle_test | ||
+ | $game_battle = Game_Battle.new | ||
+ | kot_cbs_scenetitle_battletest | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # ■ Scene_Load | ||
+ | # | ||
+ | class Scene_Load < Scene_File | ||
+ | # | ||
+ | alias kot_cbs_sceneload_readsavedata read_save_data | ||
+ | def read_save_data(file) | ||
+ | kot_cbs_sceneload_readsavedata(file) | ||
+ | $game_battle = Marshal.load(file) | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # ■ Scene_Save | ||
+ | # | ||
+ | class Scene_Save < Scene_File | ||
+ | # | ||
+ | alias kot_cbs_scenesave_writesavedata write_save_data | ||
+ | def write_save_data(file) | ||
+ | kot_cbs_scenesave_writesavedata(file) | ||
+ | Marshal.dump($game_battle, | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # ■ Spriteset_Battle | ||
+ | # | ||
+ | class Spriteset_Battle | ||
+ | # | ||
+ | attr_reader | ||
+ | attr_reader | ||
+ | # | ||
+ | def initialize | ||
+ | @viewport1 = Viewport.new(0, | ||
+ | @viewport2 = Viewport.new(0, | ||
+ | @viewport3 = Viewport.new(0, | ||
+ | @viewport4 = Viewport.new(0, | ||
+ | @viewport2.z = 101 | ||
+ | @viewport3.z = 200 | ||
+ | @viewport4.z = 5000 | ||
+ | @battleback_sprite = Sprite.new(@viewport1) | ||
+ | @enemy_sprites = [] | ||
+ | for enemy in $game_troop.enemies.reverse | ||
+ | @enemy_sprites.push(Sprite_Battler.new(@viewport2, | ||
+ | end | ||
+ | @actor_sprites = [] | ||
+ | @actor_sprites.push(Sprite_Battler.new(@viewport1)) | ||
+ | @actor_sprites.push(Sprite_Battler.new(@viewport1)) | ||
+ | @actor_sprites.push(Sprite_Battler.new(@viewport1)) | ||
+ | @actor_sprites.push(Sprite_Battler.new(@viewport1)) | ||
+ | @weather = RPG:: | ||
+ | @picture_sprites = [] | ||
+ | for i in 51..100 | ||
+ | @picture_sprites.push(Sprite_Picture.new(@viewport3, | ||
+ | $game_screen.pictures[i])) | ||
+ | end | ||
+ | @timer_sprite = Sprite_Timer.new | ||
+ | update | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # ■ Game_Battler | ||
+ | # | ||
+ | class Game_Battler | ||
+ | # | ||
+ | attr_accessor | ||
+ | attr_accessor | ||
+ | attr_accessor | ||
+ | attr_accessor | ||
+ | attr_accessor | ||
+ | attr_accessor | ||
+ | attr_accessor | ||
+ | attr_accessor | ||
+ | attr_accessor | ||
+ | attr_accessor | ||
+ | attr_accessor | ||
+ | attr_accessor | ||
+ | attr_accessor | ||
+ | attr_accessor | ||
+ | attr_accessor | ||
+ | attr_reader | ||
+ | attr_reader | ||
+ | attr_reader | ||
+ | attr_reader | ||
+ | # | ||
+ | alias kot_cbs_gamebattler_initialize initialize | ||
+ | def initialize | ||
+ | @sprite_delay = 8 | ||
+ | @sprite_index = -1 | ||
+ | @sprite_frames = 4 | ||
+ | @frame_width = Options:: | ||
+ | @frame_height = Options:: | ||
+ | @real_dead = false | ||
+ | @pose = Options:: | ||
+ | @sprite_frames = Options:: | ||
+ | @repeat = true | ||
+ | @target_x = 0 | ||
+ | @target_y = 0 | ||
+ | @start_x = 0 | ||
+ | @start_y = 0 | ||
+ | @x = nil | ||
+ | @y = nil | ||
+ | @moving = false | ||
+ | @move_speed = Options:: | ||
+ | @animate = false | ||
+ | @anim_wait = 0 | ||
+ | @victory = false | ||
+ | kot_cbs_gamebattler_initialize | ||
+ | end | ||
+ | # | ||
+ | def set_pose(number, | ||
+ | @pose = number | ||
+ | @repeat = loop | ||
+ | @sprite_frames = 4 | ||
+ | frames = Options:: | ||
+ | @sprite_frames = frames if frames != nil | ||
+ | @sprite_delay = delay | ||
+ | delay_pose = Options:: | ||
+ | @sprite_delay = delay_pose if delay_pose != nil | ||
+ | end | ||
+ | # | ||
+ | def move_to(target_x, | ||
+ | if self.is_a? | ||
+ | return unless $game_battle.move_battlers | ||
+ | elsif self.is_a? | ||
+ | return unless $game_battle.move_enemies | ||
+ | end | ||
+ | return if target_x == @x && target_y == @y | ||
+ | @target_x = target_x | ||
+ | @target_y = target_y | ||
+ | @move_speed = speed | ||
+ | @moving = true | ||
+ | end | ||
+ | # | ||
+ | def anim(pose, repeat = false, wait = nil) | ||
+ | return if @animate | ||
+ | @sprite_index = -1 | ||
+ | set_pose(pose, | ||
+ | wait = @sprite_frames if Options:: | ||
+ | wait = [@sprite_frames * Options:: | ||
+ | @anim_wait = wait | ||
+ | @animate = true | ||
+ | @victory = true if pose == Options:: | ||
+ | end | ||
+ | # | ||
+ | def set_frame(id) | ||
+ | if self.is_a? | ||
+ | @frame_width = Options:: | ||
+ | @frame_height = Options:: | ||
+ | elsif self.is_a? | ||
+ | @frame_width = Options:: | ||
+ | @frame_height = Options:: | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | def reset | ||
+ | set_pose(Options:: | ||
+ | @victory = false | ||
+ | @target_x = 0 | ||
+ | @target_y = 0 | ||
+ | @start_x = 0 | ||
+ | @start_y = 0 | ||
+ | @x = nil | ||
+ | @y = nil | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # ■ Game_Actor | ||
+ | # | ||
+ | class Game_Actor < Game_Battler | ||
+ | # | ||
+ | def screen_x | ||
+ | if $game_battle.mirror | ||
+ | @start_x = 40 + ($game_party.actors.size * 20) - self.index * 40 if self.index != nil | ||
+ | @start_x += (self.frame_width - 64) / 2 | ||
+ | else | ||
+ | @start_x = 530 - ($game_party.actors.size * 20) + self.index * 40 if self.index != nil | ||
+ | @start_x -= (self.frame_width - 64) / 2 | ||
+ | end | ||
+ | return @start_x | ||
+ | end | ||
+ | # | ||
+ | def screen_y | ||
+ | @start_y = 210 - ($game_party.actors.size * 17.5) + self.index * 20 if self.index != nil | ||
+ | @start_y -= (self.frame_height - 64) | ||
+ | return @start_y | ||
+ | end | ||
+ | # | ||
+ | def screen_z | ||
+ | return self.index if self.index != nil | ||
+ | end | ||
+ | end | ||
+ | |||
+ | # | ||
+ | # ■ Game_Enemy | ||
+ | # | ||
+ | class Game_Enemy < Game_Battler | ||
+ | # | ||
+ | def screen_x | ||
+ | if $game_battle.mirror | ||
+ | @start_x = 640 - $data_troops[@troop_id].members[@member_index].x | ||
+ | else | ||
+ | @start_x = $data_troops[@troop_id].members[@member_index].x | ||
+ | end | ||
+ | return @start_x | ||
+ | end | ||
+ | # | ||
+ | def screen_y | ||
+ | @start_y = $data_troops[@troop_id].members[@member_index].y | ||
+ | return @start_y | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # ■ Sprite_Battler | ||
+ | # | ||
+ | |||
+ | class Sprite_Battler < RPG::Sprite | ||
+ | # | ||
+ | attr_accessor : | ||
+ | # | ||
+ | def initialize(viewport, | ||
+ | super(viewport) | ||
+ | @battler = battler | ||
+ | @battler_visible = false | ||
+ | @start = false | ||
+ | end | ||
+ | # | ||
+ | def dispose | ||
+ | if self.bitmap != nil | ||
+ | self.bitmap.dispose | ||
+ | end | ||
+ | super | ||
+ | end | ||
+ | # | ||
+ | def update | ||
+ | super | ||
+ | if @battler == nil | ||
+ | self.bitmap = nil | ||
+ | loop_animation(nil) | ||
+ | return | ||
+ | end | ||
+ | | ||
+ | unless @start | ||
+ | @battler.set_frame(@battler.id) | ||
+ | @battler.reset | ||
+ | self.mirror = 1 if $game_battle.mirror | ||
+ | @start = true | ||
+ | end | ||
+ | | ||
+ | if Graphics.frame_count % @battler.sprite_delay == 0 | ||
+ | @battler.sprite_index += 1 unless @battler.sprite_index >= @battler.sprite_frames - 1 | ||
+ | @battler.sprite_index = 0 if @battler.sprite_index >= @battler.sprite_frames - 1 && @battler.repeat | ||
+ | if @battler.is_a? | ||
+ | @battler.sprite_index = 0 unless $game_battle.animated_battlers | ||
+ | elsif @battler.is_a? | ||
+ | @battler.sprite_index = 0 unless $game_battle.animated_enemies | ||
+ | end | ||
+ | x = @battler.frame_width * @battler.sprite_index | ||
+ | y = @battler.frame_height * @battler.pose | ||
+ | self.bitmap = nil | ||
+ | self.bitmap = RPG:: | ||
+ | self.src_rect.set(x, | ||
+ | end | ||
+ | | ||
+ | if @battler.animate | ||
+ | if @battler.anim_wait <= 0 | ||
+ | @battler.animate = false | ||
+ | @battler.set_pose(Options:: | ||
+ | return | ||
+ | end | ||
+ | if Graphics.frame_count % @battler.sprite_delay == 0 | ||
+ | @battler.anim_wait -= 1 | ||
+ | end | ||
+ | end | ||
+ | | ||
+ | if @battler.moving | ||
+ | if @battler.is_a? | ||
+ | if @battler.target_x == @battler.start_x | ||
+ | @battler.set_pose(Options:: | ||
+ | elsif @battler.target_x != @battler.start_x | ||
+ | @battler.set_pose(Options:: | ||
+ | end | ||
+ | end | ||
+ | if @battler.is_a? | ||
+ | if @battler.target_x == @battler.start_x | ||
+ | @battler.set_pose(Options:: | ||
+ | elsif @battler.target_x != @battler.start_x | ||
+ | @battler.set_pose(Options:: | ||
+ | end | ||
+ | end | ||
+ | if @battler.x < @battler.target_x | ||
+ | @battler.x += @battler.move_speed | ||
+ | @battler.x = @battler.target_x if @battler.x > @battler.target_x | ||
+ | else | ||
+ | @battler.x -= @battler.move_speed | ||
+ | @battler.x = @battler.target_x if @battler.x < @battler.target_x | ||
+ | end | ||
+ | if @battler.y < @battler.target_y | ||
+ | @battler.y += @battler.move_speed | ||
+ | @battler.y = @battler.target_y if @battler.y > @battler.target_y | ||
+ | else | ||
+ | @battler.y -= @battler.move_speed | ||
+ | @battler.y = @battler.target_y if @battler.y < @battler.target_y | ||
+ | end | ||
+ | @battler.moving = false if @battler.x == @battler.target_x && | ||
+ | @battler.y == @battler.target_y | ||
+ | else | ||
+ | @battler.set_pose(Options:: | ||
+ | @battler.pose == Options:: | ||
+ | if @battler.x == nil && @battler.y == nil | ||
+ | @battler.x = @battler.target_x = @battler.screen_x | ||
+ | @battler.y = @battler.target_y = @battler.screen_y | ||
+ | end | ||
+ | end | ||
+ | if @battler.damage == nil and | ||
+ | | ||
+ | @state_animation_id = @battler.state_animation_id | ||
+ | loop_animation($data_animations[@state_animation_id]) | ||
+ | end | ||
+ | if @battler.is_a? | ||
+ | if $game_temp.battle_main_phase | ||
+ | self.opacity += 3 if self.opacity < 255 | ||
+ | else | ||
+ | self.opacity -= 3 if self.opacity > 207 | ||
+ | end | ||
+ | end | ||
+ | if @battler.blink | ||
+ | blink_on | ||
+ | else | ||
+ | blink_off | ||
+ | end | ||
+ | if @battler.dead? | ||
+ | @battler.set_pose(Options:: | ||
+ | else | ||
+ | @battler.real_dead = false | ||
+ | end | ||
+ | unless @battler_visible | ||
+ | if not @battler.hidden and not @battler.dead? | ||
+ | | ||
+ | appear | ||
+ | @battler_visible = true | ||
+ | end | ||
+ | else | ||
+ | if @battler.hidden | ||
+ | $game_system.se_play($data_system.escape_se) | ||
+ | escape | ||
+ | @battler_visible = false | ||
+ | end | ||
+ | if @battler.white_flash | ||
+ | whiten | ||
+ | @battler.white_flash = false | ||
+ | end | ||
+ | if @battler.animation_id != 0 | ||
+ | animation = $data_animations[@battler.animation_id] | ||
+ | animation(animation, | ||
+ | @battler.animation_id = 0 | ||
+ | end | ||
+ | if @battler.damage_pop | ||
+ | damage(@battler.damage, | ||
+ | @battler.damage = nil | ||
+ | @battler.critical = false | ||
+ | @battler.damage_pop = false | ||
+ | end | ||
+ | if @battler.damage == nil and @battler.dead? | ||
+ | if @battler.is_a? | ||
+ | $game_system.se_play($data_system.enemy_collapse_se) unless @battler.real_dead | ||
+ | else | ||
+ | $game_system.se_play($data_system.actor_collapse_se) unless @battler.real_dead | ||
+ | end | ||
+ | @battler.set_pose(Options:: | ||
+ | @battler.real_dead = true | ||
+ | end | ||
+ | end | ||
+ | self.x = @battler.x | ||
+ | self.y = @battler.y | ||
+ | self.z = @battler.y + @battler.frame_height | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # ■ Arrow_Enemy | ||
+ | # | ||
+ | class Arrow_Enemy < Arrow_Base | ||
+ | # | ||
+ | # - Uso del Personaje que el cursor ha señalado | ||
+ | # | ||
+ | def enemy | ||
+ | return $game_troop.enemies[@index] | ||
+ | end | ||
+ | # | ||
+ | # - Renovacion del Frame | ||
+ | # | ||
+ | def update | ||
+ | super | ||
+ | # Estara en el aire, si el enemigo no es señalado | ||
+ | $game_troop.enemies.size.times do | ||
+ | break if self.enemy.exist? | ||
+ | @index += 1 | ||
+ | @index %= $game_troop.enemies.size | ||
+ | end | ||
+ | # Cursor derecho | ||
+ | if Input.repeat? | ||
+ | $game_system.se_play($data_system.cursor_se) | ||
+ | $game_troop.enemies.size.times do | ||
+ | @index += 1 | ||
+ | @index %= $game_troop.enemies.size | ||
+ | break if self.enemy.exist? | ||
+ | end | ||
+ | end | ||
+ | # Cursor izquierdo | ||
+ | if Input.repeat? | ||
+ | $game_system.se_play($data_system.cursor_se) | ||
+ | $game_troop.enemies.size.times do | ||
+ | @index += $game_troop.enemies.size - 1 | ||
+ | @index %= $game_troop.enemies.size | ||
+ | break if self.enemy.exist? | ||
+ | end | ||
+ | end | ||
+ | # Opciones de coordenadas del sprite | ||
+ | if self.enemy != nil | ||
+ | self.x = self.enemy.x + self.enemy.frame_width / 2 | ||
+ | self.y = self.enemy.y + self.enemy.frame_height / 2 | ||
+ | end | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # ■ Arrow_Actor | ||
+ | # | ||
+ | |||
+ | class Arrow_Actor < Arrow_Base | ||
+ | # | ||
+ | # - Uso del Personaje que el cursor ha señalado | ||
+ | # | ||
+ | def actor | ||
+ | return $game_party.actors[@index] | ||
+ | end | ||
+ | # | ||
+ | # - Renovacion del Frame | ||
+ | # | ||
+ | def update | ||
+ | super | ||
+ | # Cursor derecho | ||
+ | if Input.repeat? | ||
+ | $game_system.se_play($data_system.cursor_se) | ||
+ | @index += 1 | ||
+ | @index %= $game_party.actors.size | ||
+ | end | ||
+ | # Cursor izquierdo | ||
+ | if Input.repeat? | ||
+ | $game_system.se_play($data_system.cursor_se) | ||
+ | @index += $game_party.actors.size - 1 | ||
+ | @index %= $game_party.actors.size | ||
+ | end | ||
+ | # Opciones de coordenadas del sprite | ||
+ | if self.actor != nil | ||
+ | self.x = self.actor.x + self.actor.frame_width / 2 | ||
+ | self.y = self.actor.y + self.actor.frame_height / 2 | ||
+ | end | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # ■ Scene_Battle | ||
+ | # | ||
+ | class Scene_Battle | ||
+ | # | ||
+ | #alias kot_cbs_scenebattle_main main | ||
+ | def main | ||
+ | $game_temp.in_battle = true | ||
+ | $game_temp.battle_turn = 0 | ||
+ | $game_temp.battle_event_flags.clear | ||
+ | $game_temp.battle_abort = false | ||
+ | $game_temp.battle_main_phase = false | ||
+ | $game_temp.battleback_name = $game_map.battleback_name | ||
+ | $game_temp.forcing_battler = nil | ||
+ | $game_system.battle_interpreter.setup(nil, | ||
+ | @troop_id = $game_temp.battle_troop_id | ||
+ | $game_troop.setup(@troop_id) | ||
+ | s1 = $data_system.words.attack | ||
+ | s2 = $data_system.words.skill | ||
+ | s3 = $data_system.words.guard | ||
+ | s4 = $data_system.words.item | ||
+ | @actor_command_window = Window_Command.new(160, | ||
+ | @actor_command_window.y = 160 | ||
+ | @actor_command_window.z = 999 | ||
+ | @actor_command_window.back_opacity = 160 | ||
+ | @actor_command_window.active = false | ||
+ | @actor_command_window.visible = false | ||
+ | @party_command_window = Window_PartyCommand.new | ||
+ | @help_window = Window_Help.new | ||
+ | @help_window.back_opacity = 160 | ||
+ | @help_window.visible = false | ||
+ | @status_window = Window_BattleStatus.new | ||
+ | @message_window = Window_Message.new | ||
+ | @spriteset = Spriteset_Battle.new | ||
+ | @wait_count = 0 | ||
+ | if $data_system.battle_transition == "" | ||
+ | Graphics.transition(20) | ||
+ | else | ||
+ | Graphics.transition(40, | ||
+ | $data_system.battle_transition) | ||
+ | end | ||
+ | start_phase1 | ||
+ | loop do | ||
+ | Graphics.update | ||
+ | Input.update | ||
+ | update | ||
+ | if $scene != self | ||
+ | break | ||
+ | end | ||
+ | end | ||
+ | $game_map.refresh | ||
+ | Graphics.freeze | ||
+ | @actor_command_window.dispose | ||
+ | @party_command_window.dispose | ||
+ | @help_window.dispose | ||
+ | @status_window.dispose | ||
+ | @message_window.dispose | ||
+ | if @skill_window != nil | ||
+ | @skill_window.dispose | ||
+ | end | ||
+ | if @item_window != nil | ||
+ | @item_window.dispose | ||
+ | end | ||
+ | if @result_window != nil | ||
+ | @result_window.dispose | ||
+ | end | ||
+ | @spriteset.dispose | ||
+ | if $scene.is_a? | ||
+ | Graphics.transition | ||
+ | Graphics.freeze | ||
+ | end | ||
+ | if $BTEST and not $scene.is_a? | ||
+ | $scene = nil | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | def update_phase4 | ||
+ | case @phase4_step | ||
+ | when 1 | ||
+ | update_phase4_step1 | ||
+ | when 2 | ||
+ | update_phase4_step2 | ||
+ | when 3 | ||
+ | update_phase4_step3 | ||
+ | when 4 | ||
+ | update_phase4_step4 | ||
+ | when 5 | ||
+ | update_phase4_step5 | ||
+ | when 6 | ||
+ | update_phase4_step6 | ||
+ | when 7 | ||
+ | update_phase4_step7 | ||
+ | when 8 | ||
+ | update_phase4_step8 | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | def update_phase4_step2 | ||
+ | # If not a forcing action | ||
+ | unless @active_battler.current_action.forcing | ||
+ | # If restriction is [normal attack enemy] or [normal attack ally] | ||
+ | if @active_battler.restriction == 2 or @active_battler.restriction == 3 | ||
+ | # Set attack as an action | ||
+ | @active_battler.current_action.kind = 0 | ||
+ | @active_battler.current_action.basic = 0 | ||
+ | end | ||
+ | # If restriction is [cannot perform action] | ||
+ | if @active_battler.restriction == 4 | ||
+ | # Clear battler being forced into action | ||
+ | $game_temp.forcing_battler = nil | ||
+ | # Shift to step 1 | ||
+ | @phase4_step = 1 | ||
+ | return | ||
+ | end | ||
+ | end | ||
+ | # Clear target battlers | ||
+ | @target_battlers = [] | ||
+ | case @active_battler.current_action.kind | ||
+ | when 0 | ||
+ | if @active_battler.current_action.basic == 0 | ||
+ | if @active_battler.is_a? | ||
+ | weapon_id = @active_battler.weapon_id | ||
+ | if weapon_id != 0 && Options:: | ||
+ | | ||
+ | make_basic_action_result | ||
+ | else | ||
+ | @phase4_step = 7 | ||
+ | return | ||
+ | end | ||
+ | else | ||
+ | @phase4_step = 7 | ||
+ | return | ||
+ | end | ||
+ | else | ||
+ | make_basic_action_result | ||
+ | end | ||
+ | when 1 | ||
+ | skill_id = @active_battler.current_action.skill_id | ||
+ | if Options:: | ||
+ | | ||
+ | @phase4_step = 7 | ||
+ | return | ||
+ | else | ||
+ | make_skill_action_result | ||
+ | end | ||
+ | when 2 | ||
+ | make_item_action_result | ||
+ | end | ||
+ | # Shift to step 3 | ||
+ | if @phase4_step == 2 | ||
+ | @phase4_step = 3 | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | def update_phase4_step3 | ||
+ | # Animation for action performer (if ID is 0, then white flash) | ||
+ | if @animation1_id == 0 | ||
+ | @active_battler.white_flash = true | ||
+ | else | ||
+ | @active_battler.animation_id = @animation1_id | ||
+ | @active_battler.animation_hit = true | ||
+ | end | ||
+ | case @active_battler.current_action.kind | ||
+ | when 0 | ||
+ | if @active_battler.current_action.basic == 0 | ||
+ | weapon_id = @active_battler.weapon_id | ||
+ | if Options:: | ||
+ | @active_battler.anim(Options:: | ||
+ | else | ||
+ | @active_battler.anim(Options:: | ||
+ | end | ||
+ | elsif @active_battler.current_action.basic == 1 | ||
+ | @active_battler.anim(Options:: | ||
+ | end | ||
+ | when 1 | ||
+ | skill_id = @active_battler.current_action.skill_id | ||
+ | if Options:: | ||
+ | @active_battler.anim(Options:: | ||
+ | else | ||
+ | @active_battler.anim(Options:: | ||
+ | end | ||
+ | when 2 | ||
+ | @active_battler.anim(Options:: | ||
+ | end | ||
+ | @wait_count = @active_battler.anim_wait | ||
+ | # Shift to step 4 | ||
+ | @phase4_step = 4 | ||
+ | end | ||
+ | # | ||
+ | def update_phase4_step4 | ||
+ | # Animation for target | ||
+ | for target in @target_battlers | ||
+ | target.animation_id = @animation2_id | ||
+ | target.animation_hit = (target.damage != " | ||
+ | | ||
+ | if target.damage.is_a? | ||
+ | if target.guarding? | ||
+ | target.anim(Options:: | ||
+ | else | ||
+ | target.anim(Options:: | ||
+ | end | ||
+ | else | ||
+ | if target.damage.is_a? | ||
+ | target.anim(Options:: | ||
+ | end | ||
+ | end | ||
+ | | ||
+ | end | ||
+ | @wait_count = 8 | ||
+ | # Shift to step 5 | ||
+ | @phase4_step = 5 | ||
+ | end | ||
+ | # | ||
+ | def update_phase4_step6 | ||
+ | # Clear battler being forced into action | ||
+ | $game_temp.forcing_battler = nil | ||
+ | # If common event ID is valid | ||
+ | if @common_event_id > 0 | ||
+ | # Set up event | ||
+ | common_event = $data_common_events[@common_event_id] | ||
+ | $game_system.battle_interpreter.setup(common_event.list, | ||
+ | end | ||
+ | # Shift to step 1 | ||
+ | if (@active_battler.current_action.kind == 0 && | ||
+ | @active_battler.current_action.basic == 0) or | ||
+ | @active_battler.current_action.kind == 1 | ||
+ | @phase4_step = 8 | ||
+ | else | ||
+ | @phase4_step = 1 | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # * Frame Update (main phase step 7 : move to) | ||
+ | # | ||
+ | def update_phase4_step7 | ||
+ | if @active_battler.is_a? | ||
+ | target = $game_troop.smooth_target_enemy(@active_battler.current_action.target_index) | ||
+ | x = target.x + ($game_battle.mirror ? -(target.frame_width / 1.5): (target.frame_width / 1.5)) | ||
+ | y = target.y - (@active_battler.frame_height - target.frame_height) | ||
+ | @active_battler.move_to(x, | ||
+ | else | ||
+ | target = $game_party.smooth_target_actor(@active_battler.current_action.target_index) | ||
+ | x = target.x + ($game_battle.mirror ? (target.frame_width / 1.5): -(target.frame_width / 1.5)) | ||
+ | y = target.y - (@active_battler.frame_height - target.frame_height) | ||
+ | @active_battler.move_to(x, | ||
+ | end | ||
+ | | ||
+ | if @active_battler.x == @active_battler.target_x && | ||
+ | @active_battler.y == @active_battler.target_y | ||
+ | if @active_battler.current_action.basic == 0 | ||
+ | make_basic_action_result | ||
+ | else | ||
+ | make_skill_action_result | ||
+ | end | ||
+ | @phase4_step = 3 | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # * Frame Update (main phase step 8 : move back) | ||
+ | # | ||
+ | def update_phase4_step8 | ||
+ | @active_battler.move_to(@active_battler.start_x, | ||
+ | |||
+ | if @active_battler.x == @active_battler.target_x && | ||
+ | @active_battler.y == @active_battler.target_y | ||
+ | @phase4_step = 1 | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # * Start After Battle Phase | ||
+ | # | ||
+ | alias kot_cbs_scenebattle_start_phase5 start_phase5 | ||
+ | def start_phase5 | ||
+ | for actor in $game_party.actors | ||
+ | actor.anim(Options:: | ||
+ | end | ||
+ | kot_cbs_scenebattle_start_phase5 | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # ■ Sprite (Damage) | ||
+ | # | ||
+ | module RPG | ||
+ | class Sprite < ::Sprite | ||
+ | # | ||
+ | def damage(value, | ||
+ | dispose_damage | ||
+ | if value.is_a? | ||
+ | damage_string = value.abs.to_s | ||
+ | else | ||
+ | damage_string = value.to_s | ||
+ | end | ||
+ | bitmap = Bitmap.new(160, | ||
+ | bitmap.font.name = "Arial Black" | ||
+ | bitmap.font.size = 32 | ||
+ | bitmap.font.color.set(0, | ||
+ | bitmap.draw_text(-1, | ||
+ | bitmap.draw_text(+1, | ||
+ | bitmap.draw_text(-1, | ||
+ | bitmap.draw_text(+1, | ||
+ | if value.is_a? | ||
+ | bitmap.font.color.set(176, | ||
+ | else | ||
+ | bitmap.font.color.set(255, | ||
+ | end | ||
+ | bitmap.draw_text(0, | ||
+ | if critical | ||
+ | bitmap.font.size = 20 | ||
+ | bitmap.font.color.set(0, | ||
+ | bitmap.draw_text(-1, | ||
+ | bitmap.draw_text(+1, | ||
+ | bitmap.draw_text(-1, | ||
+ | bitmap.draw_text(+1, | ||
+ | bitmap.font.color.set(255, | ||
+ | bitmap.draw_text(0, | ||
+ | end | ||
+ | @_damage_sprite = :: | ||
+ | @_damage_sprite.bitmap = bitmap | ||
+ | @_damage_sprite.ox = 80 | ||
+ | @_damage_sprite.oy = 20 | ||
+ | @_damage_sprite.x = self.x + Options:: | ||
+ | @_damage_sprite.y = self.y - self.oy / 2 | ||
+ | @_damage_sprite.z = 3000 | ||
+ | @_damage_duration = 40 | ||
+ | end | ||
+ | end | ||
+ | end | ||
+ | </ | ||
+ | |||
+ | ==== Comando individuales ==== | ||
+ | **Este script solo es comaptible con éste sistema de batalla** | ||
+ | Colocar encima de " | ||
+ | <code ruby> | ||
+ | # | ||
+ | # Commandos Individuales | ||
+ | # | ||
+ | # Script por: Kotfire | ||
+ | # Versión 2.0 | ||
+ | # Versión especial para mi script de combate: " | ||
+ | # | ||
+ | # Instrucciones | ||
+ | # - Copiar en un script encima de main | ||
+ | # - Elegir el modo(por id o por clase) | ||
+ | # - Cambiar los comandos para cada personaje | ||
+ | # - Disfrutar | ||
+ | # | ||
+ | # ■ Add-on Manager | ||
+ | # | ||
+ | Add_on.insert(" | ||
+ | |||
+ | if Add_on.state(" | ||
+ | # | ||
+ | # ■ Options | ||
+ | # | ||
+ | module Options | ||
+ | module Actor_Commands | ||
+ | MODE = 0 # 0 : Id / 1 : Clase | ||
+ | end | ||
+ | end | ||
+ | |||
+ | # | ||
+ | # Scene_Battle | ||
+ | # | ||
+ | class Scene_Battle | ||
+ | alias kot_commands phase3_setup_command_window | ||
+ | def phase3_setup_command_window | ||
+ | case Options:: | ||
+ | when 0 # Id del personaje en la base de datos | ||
+ | actor = $game_party.actors[@actor_index].id | ||
+ | when 1 # Id de la clase del personaje | ||
+ | actor = $game_party.actors[@actor_index].class_id | ||
+ | end | ||
+ | # Para cada personaje o clase sus propios comandos | ||
+ | case actor | ||
+ | when 1 | ||
+ | commands = [" | ||
+ | when 2 | ||
+ | commands = [" | ||
+ | when 3 | ||
+ | commands = [" | ||
+ | when 4 | ||
+ | commands = [" | ||
+ | #when 3 | ||
+ | #commands = [Comando1, Comando2, Comando3, Comando4] | ||
+ | #ect.. | ||
+ | end | ||
+ | @actor_command_window.change(commands) | ||
+ | kot_commands | ||
+ | end | ||
+ | end | ||
+ | |||
+ | # | ||
+ | # Window_Command | ||
+ | # | ||
+ | class Window_Command < Window_Selectable | ||
+ | def change(commands = @original) | ||
+ | @original = @commands unless @original | ||
+ | @commands = commands ? commands : @original | ||
+ | refresh | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | end | ||
+ | </ | ||
+ | |||
+ | ==== Fondo de batalla animado ==== | ||
+ | **Éste script solo es compatible con éste sistema de batala.** | ||
+ | Colocar encima de " | ||
+ | <code ruby> | ||
+ | # | ||
+ | # Fondo de Batalla Animado | ||
+ | # | ||
+ | # Script por: Kotfire | ||
+ | # Versión 1.0 | ||
+ | # Versión especial para mi script de combate: " | ||
+ | # | ||
+ | # -Instrucciones- | ||
+ | # Pegar encima de main y disfrutar | ||
+ | # Editar la opción Template, true si el fondo animado es una sola imagen y | ||
+ | # false si son varias. En el segundo caso las imagenes tendrán que llamarse | ||
+ | # Nombredelfondo-1, | ||
+ | # Ejemplo: Pradera-1, Pradera-2, Pradera-3 ... | ||
+ | # | ||
+ | # ■ Add-on Manager | ||
+ | # | ||
+ | Add_on.insert(" | ||
+ | |||
+ | if Add_on.state(" | ||
+ | # | ||
+ | # ■ Options | ||
+ | # | ||
+ | module Options | ||
+ | module Animated_Back | ||
+ | Template = true | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # ■ Game_Battle | ||
+ | # | ||
+ | class Game_Battle | ||
+ | # | ||
+ | attr_accessor : | ||
+ | attr_accessor : | ||
+ | attr_accessor : | ||
+ | # | ||
+ | alias kot_animatedbattleback_gamebattle_initialize initialize | ||
+ | def initialize | ||
+ | @back_delay = 5 | ||
+ | @back_frames = 8 | ||
+ | @back_animated = true | ||
+ | kot_animatedbattleback_gamebattle_initialize | ||
+ | end | ||
+ | end | ||
+ | |||
+ | # | ||
+ | # ■ Spriteset_Battle | ||
+ | # | ||
+ | class Spriteset_Battle | ||
+ | # | ||
+ | alias kot_animatedbattleback_spritesetbattle_initialize initialize | ||
+ | def initialize | ||
+ | @back_index = 0 | ||
+ | @back_delay = $game_battle.back_delay | ||
+ | @back_frames = $game_battle.back_frames | ||
+ | @animated = $game_battle.back_animated | ||
+ | kot_animatedbattleback_spritesetbattle_initialize | ||
+ | end | ||
+ | # | ||
+ | def update_backsprite | ||
+ | return unless @animated | ||
+ | return unless Graphics.frame_count % @back_delay == 0 | ||
+ | @back_index += 1 | ||
+ | if @back_index > @back_frames | ||
+ | @back_index = 0 | ||
+ | update_backsprite | ||
+ | end | ||
+ | if Options:: | ||
+ | x = 640 * (@back_index - 1) | ||
+ | else | ||
+ | x = 0 | ||
+ | @battleback_sprite.bitmap = RPG:: | ||
+ | end | ||
+ | width = @battleback_sprite.bitmap.width / @back_frames | ||
+ | height = @battleback_sprite.bitmap.height | ||
+ | @battleback_sprite.src_rect.set(x, | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # ■ Scene_Battle (1) | ||
+ | # | ||
+ | |||
+ | class Scene_Battle | ||
+ | # | ||
+ | alias kot_animatedbattleback_scenebattle_update update | ||
+ | def update | ||
+ | @spriteset.update_backsprite | ||
+ | kot_animatedbattleback_scenebattle_update | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | end | ||
+ | </ | ||
+ | |||
+ | ==== Posición de batalla ==== | ||
+ | **Este script sólo es compatible con éste sistema de batalla** | ||
+ | Colocar encima de " | ||
+ | <code ruby> | ||
+ | # | ||
+ | # Posición De Batalla | ||
+ | # | ||
+ | # Script por: Kotfire | ||
+ | # Versión 1 | ||
+ | # Versión especial para mi script de combate: " | ||
+ | # | ||
+ | # -Instrucciones- | ||
+ | # Pegar encima de main y disfrutar | ||
+ | # | ||
+ | # ■ Add-on Manager | ||
+ | # | ||
+ | Add_on.insert(" | ||
+ | |||
+ | if Add_on.state(" | ||
+ | # | ||
+ | # ** Game_Actor | ||
+ | # | ||
+ | |||
+ | class Game_Actor < Game_Battler | ||
+ | # | ||
+ | # * Public Instance Variables | ||
+ | # | ||
+ | attr_accessor : | ||
+ | # | ||
+ | # * Setup | ||
+ | # | ||
+ | # | ||
+ | alias setup_kot setup | ||
+ | def setup(actor_id) | ||
+ | actor = $data_actors[actor_id] | ||
+ | @class_id = actor.class_id | ||
+ | @position = $data_classes[@class_id].position | ||
+ | setup_kot(actor_id) | ||
+ | end | ||
+ | # | ||
+ | def screen_x | ||
+ | if $game_battle.mirror | ||
+ | @start_x = 40 + ((-10 * @position) + ($game_party.actors.size * 20)) - self.index * 40 if self.index != nil | ||
+ | @start_x += (self.frame_width - 64) / 2 | ||
+ | else | ||
+ | @start_x = 530 - ((-10 * @position) + ($game_party.actors.size * 20)) + self.index * 40 if self.index != nil | ||
+ | @start_x -= (self.frame_width - 64) / 2 | ||
+ | end | ||
+ | return @start_x | ||
+ | end | ||
+ | end | ||
+ | |||
+ | # | ||
+ | # ** Game_Party | ||
+ | # | ||
+ | |||
+ | class Game_Party | ||
+ | | ||
+ | # | ||
+ | # * Random Selection of Target Actor | ||
+ | # hp0 : limited to actors with 0 HP | ||
+ | # | ||
+ | def random_target_actor(hp0 = false) | ||
+ | # Initialize roulette | ||
+ | roulette = [] | ||
+ | # Loop | ||
+ | for actor in @actors | ||
+ | # If it fits the conditions | ||
+ | if (not hp0 and actor.exist? | ||
+ | # Get actor class [position] | ||
+ | position = actor.position | ||
+ | # Front guard: n = 4; Mid guard: n = 3; Rear guard: n = 2 | ||
+ | n = 4 - position | ||
+ | # Add actor to roulette n times | ||
+ | n.times do | ||
+ | roulette.push(actor) | ||
+ | end | ||
+ | end | ||
+ | end | ||
+ | # If roulette size is 0 | ||
+ | if roulette.size == 0 | ||
+ | return nil | ||
+ | end | ||
+ | # Spin the roulette, choose an actor | ||
+ | return roulette[rand(roulette.size)] | ||
+ | end | ||
+ | end | ||
+ | |||
+ | # | ||
+ | # ** Window_MenuStatus | ||
+ | # | ||
+ | # This window displays party member status on the menu screen. | ||
+ | # | ||
+ | |||
+ | class Window_MenuStatus < Window_Selectable | ||
+ | # | ||
+ | # * Object Initialization | ||
+ | # | ||
+ | def initialize | ||
+ | super(0, 0, 480, 480) | ||
+ | self.contents = Bitmap.new(width - 32, height - 32) | ||
+ | self.contents.font.name = $fontface | ||
+ | self.contents.font.size = $fontsize | ||
+ | refresh | ||
+ | self.active = false | ||
+ | self.index = -1 | ||
+ | end | ||
+ | # | ||
+ | # * Refresh | ||
+ | # | ||
+ | def refresh | ||
+ | self.contents.clear | ||
+ | @item_max = $game_party.actors.size | ||
+ | for i in 0...$game_party.actors.size | ||
+ | actor = $game_party.actors[i] | ||
+ | position = actor.position | ||
+ | x = 64 + 24 * position | ||
+ | y = i * 116 | ||
+ | draw_actor_graphic(actor, | ||
+ | draw_actor_name(actor, | ||
+ | draw_actor_class(actor, | ||
+ | draw_actor_hp(actor, | ||
+ | draw_actor_sp(actor, | ||
+ | draw_actor_level(actor, | ||
+ | draw_actor_exp(actor, | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # * Cursor Rectangle Update | ||
+ | # | ||
+ | def update_cursor_rect | ||
+ | if @index < 0 | ||
+ | self.cursor_rect.empty | ||
+ | else | ||
+ | self.cursor_rect.set(0, | ||
+ | end | ||
+ | end | ||
+ | end | ||
+ | |||
+ | # | ||
+ | # ** Window_Steps | ||
+ | # | ||
+ | # This window displays step count on the menu screen. | ||
+ | # | ||
+ | |||
+ | class Window_Steps < Window_Base | ||
+ | # | ||
+ | # * Object Initialization | ||
+ | # | ||
+ | def initialize | ||
+ | super(0, 0, 160, 64) | ||
+ | self.contents = Bitmap.new(width - 32, height - 32) | ||
+ | self.contents.font.name = $fontface | ||
+ | self.contents.font.size = $fontsize | ||
+ | refresh | ||
+ | end | ||
+ | # | ||
+ | # * Refresh | ||
+ | # | ||
+ | def refresh | ||
+ | self.contents.clear | ||
+ | self.contents.font.color = system_color | ||
+ | self.contents.draw_text(4, | ||
+ | self.contents.font.color = normal_color | ||
+ | self.contents.draw_text(4, | ||
+ | end | ||
+ | end | ||
+ | |||
+ | # | ||
+ | # ** Scene_Save | ||
+ | # | ||
+ | |||
+ | class Scene_Save < Scene_File | ||
+ | # | ||
+ | # * Decision Processing | ||
+ | # | ||
+ | def on_decision(filename) | ||
+ | # Play save SE | ||
+ | $game_system.se_play($data_system.save_se) | ||
+ | # Write save data | ||
+ | file = File.open(filename, | ||
+ | write_save_data(file) | ||
+ | file.close | ||
+ | # If called from event | ||
+ | if $game_temp.save_calling | ||
+ | # Clear save call flag | ||
+ | $game_temp.save_calling = false | ||
+ | # Switch to map screen | ||
+ | $scene = Scene_Map.new | ||
+ | return | ||
+ | end | ||
+ | # Switch to menu screen | ||
+ | $scene = Scene_Menu.new(5) | ||
+ | end | ||
+ | # | ||
+ | # * Cancel Processing | ||
+ | # | ||
+ | def on_cancel | ||
+ | # Play cancel SE | ||
+ | $game_system.se_play($data_system.cancel_se) | ||
+ | # If called from event | ||
+ | if $game_temp.save_calling | ||
+ | # Clear save call flag | ||
+ | $game_temp.save_calling = false | ||
+ | # Switch to map screen | ||
+ | $scene = Scene_Map.new | ||
+ | return | ||
+ | end | ||
+ | # Switch to menu screen | ||
+ | $scene = Scene_Menu.new(5) | ||
+ | end | ||
+ | end | ||
+ | |||
+ | # | ||
+ | # ** Scene_End | ||
+ | # | ||
+ | |||
+ | class Scene_End | ||
+ | |||
+ | # | ||
+ | # * Frame Update | ||
+ | # | ||
+ | def update | ||
+ | # Update command window | ||
+ | @command_window.update | ||
+ | # If B button was pressed | ||
+ | if Input.trigger? | ||
+ | # Play cancel SE | ||
+ | $game_system.se_play($data_system.cancel_se) | ||
+ | # Switch to menu screen | ||
+ | $scene = Scene_Menu.new(6) | ||
+ | return | ||
+ | end | ||
+ | # If C button was pressed | ||
+ | if Input.trigger? | ||
+ | # Branch by command window cursor position | ||
+ | case @command_window.index | ||
+ | when 0 # to title | ||
+ | command_to_title | ||
+ | when 1 # shutdown | ||
+ | command_shutdown | ||
+ | when 2 # quit | ||
+ | command_cancel | ||
+ | end | ||
+ | return | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # * Process When Choosing [Cancel] Command | ||
+ | # | ||
+ | def command_cancel | ||
+ | # Play decision SE | ||
+ | $game_system.se_play($data_system.decision_se) | ||
+ | # Switch to menu screen | ||
+ | $scene = Scene_Menu.new(6) | ||
+ | end | ||
+ | end | ||
+ | |||
+ | # | ||
+ | # ** Scene_Menu | ||
+ | # | ||
+ | # This class performs menu screen processing. | ||
+ | # | ||
+ | |||
+ | class Scene_Menu | ||
+ | # | ||
+ | # * Object Initialization | ||
+ | # | ||
+ | # | ||
+ | def initialize(menu_index = 0) | ||
+ | @menu_index = menu_index | ||
+ | end | ||
+ | # | ||
+ | # * Main Processing | ||
+ | # | ||
+ | def main | ||
+ | # Make command window | ||
+ | s1 = $data_system.words.item | ||
+ | s2 = $data_system.words.skill | ||
+ | s3 = $data_system.words.equip | ||
+ | s4 = " | ||
+ | s5 = " | ||
+ | s6 = " | ||
+ | s7 = " | ||
+ | @command_window = Window_Command.new(160, | ||
+ | @command_window.index = @menu_index | ||
+ | # If number of party members is 0 | ||
+ | if $game_party.actors.size == 0 | ||
+ | # Disable items, skills, equipment, and status | ||
+ | @command_window.disable_item(0) | ||
+ | @command_window.disable_item(1) | ||
+ | @command_window.disable_item(2) | ||
+ | @command_window.disable_item(3) | ||
+ | @command_window.disable_item(4) | ||
+ | end | ||
+ | # If save is forbidden | ||
+ | if $game_system.save_disabled | ||
+ | # Disable save | ||
+ | @command_window.disable_item(5) | ||
+ | end | ||
+ | # Make play time window | ||
+ | @playtime_window = Window_PlayTime.new | ||
+ | @playtime_window.x = 0 | ||
+ | @playtime_window.y = 256 | ||
+ | # Make steps window | ||
+ | @steps_window = Window_Steps.new | ||
+ | @steps_window.x = 0 | ||
+ | @steps_window.y = 352 | ||
+ | # Make gold window | ||
+ | @gold_window = Window_Gold.new | ||
+ | @gold_window.x = 0 | ||
+ | @gold_window.y = 416 | ||
+ | # Make status window | ||
+ | @status_window = Window_MenuStatus.new | ||
+ | @status_window.x = 160 | ||
+ | @status_window.y = 0 | ||
+ | # Execute transition | ||
+ | Graphics.transition | ||
+ | # Main loop | ||
+ | loop do | ||
+ | # Update game screen | ||
+ | Graphics.update | ||
+ | # Update input information | ||
+ | Input.update | ||
+ | # Frame update | ||
+ | update | ||
+ | # Abort loop if screen is changed | ||
+ | if $scene != self | ||
+ | break | ||
+ | end | ||
+ | end | ||
+ | # Prepare for transition | ||
+ | Graphics.freeze | ||
+ | # Dispose of windows | ||
+ | @command_window.dispose | ||
+ | @playtime_window.dispose | ||
+ | @steps_window.dispose | ||
+ | @gold_window.dispose | ||
+ | @status_window.dispose | ||
+ | end | ||
+ | # | ||
+ | # * Frame Update | ||
+ | # | ||
+ | def update | ||
+ | # Update windows | ||
+ | @command_window.update | ||
+ | @playtime_window.update | ||
+ | @steps_window.update | ||
+ | @gold_window.update | ||
+ | @status_window.update | ||
+ | # If command window is active: call update_command | ||
+ | if @command_window.active | ||
+ | update_command | ||
+ | return | ||
+ | end | ||
+ | # If status window is active: call update_status | ||
+ | if @status_window.active | ||
+ | update_status | ||
+ | return | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # * Frame Update (when command window is active) | ||
+ | # | ||
+ | def update_command | ||
+ | # If B button was pressed | ||
+ | if Input.trigger? | ||
+ | # Play cancel SE | ||
+ | $game_system.se_play($data_system.cancel_se) | ||
+ | # Switch to map screen | ||
+ | $scene = Scene_Map.new | ||
+ | return | ||
+ | end | ||
+ | # If C button was pressed | ||
+ | if Input.trigger? | ||
+ | # If command other than save or end game, and party members = 0 | ||
+ | if $game_party.actors.size == 0 and @command_window.index < 4 | ||
+ | # Play buzzer SE | ||
+ | $game_system.se_play($data_system.buzzer_se) | ||
+ | return | ||
+ | end | ||
+ | # Branch by command window cursor position | ||
+ | case @command_window.index | ||
+ | when 0 # item | ||
+ | # Play decision SE | ||
+ | $game_system.se_play($data_system.decision_se) | ||
+ | # Switch to item screen | ||
+ | $scene = Scene_Item.new | ||
+ | when 1 # skill | ||
+ | # Play decision SE | ||
+ | $game_system.se_play($data_system.decision_se) | ||
+ | # Make status window active | ||
+ | @command_window.active = false | ||
+ | @status_window.active = true | ||
+ | @status_window.index = 0 | ||
+ | when 2 # equipment | ||
+ | # Play decision SE | ||
+ | $game_system.se_play($data_system.decision_se) | ||
+ | # Make status window active | ||
+ | @command_window.active = false | ||
+ | @status_window.active = true | ||
+ | @status_window.index = 0 | ||
+ | when 3 # status | ||
+ | # Play decision SE | ||
+ | $game_system.se_play($data_system.decision_se) | ||
+ | # Make status window active | ||
+ | @command_window.active = false | ||
+ | @status_window.active = true | ||
+ | @status_window.index = 0 | ||
+ | when 4 | ||
+ | # Play decision SE | ||
+ | $game_system.se_play($data_system.decision_se) | ||
+ | # Make status window active | ||
+ | @command_window.active = false | ||
+ | @status_window.active = true | ||
+ | @status_window.index = 0 | ||
+ | when 5 # save | ||
+ | # If saving is forbidden | ||
+ | if $game_system.save_disabled | ||
+ | # Play buzzer SE | ||
+ | $game_system.se_play($data_system.buzzer_se) | ||
+ | return | ||
+ | end | ||
+ | # Play decision SE | ||
+ | $game_system.se_play($data_system.decision_se) | ||
+ | # Switch to save screen | ||
+ | $scene = Scene_Save.new | ||
+ | when 6 # end game | ||
+ | # Play decision SE | ||
+ | $game_system.se_play($data_system.decision_se) | ||
+ | # Switch to end game screen | ||
+ | $scene = Scene_End.new | ||
+ | end | ||
+ | return | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # * Frame Update (when status window is active) | ||
+ | # | ||
+ | def update_status | ||
+ | # If B button was pressed | ||
+ | if Input.trigger? | ||
+ | # Play cancel SE | ||
+ | $game_system.se_play($data_system.cancel_se) | ||
+ | # Make command window active | ||
+ | @command_window.active = true | ||
+ | @status_window.active = false | ||
+ | @status_window.index = -1 | ||
+ | return | ||
+ | end | ||
+ | # If C button was pressed | ||
+ | if Input.trigger? | ||
+ | # Branch by command window cursor position | ||
+ | case @command_window.index | ||
+ | when 1 # skill | ||
+ | # If this actor' | ||
+ | if $game_party.actors[@status_window.index].restriction >= 2 | ||
+ | # Play buzzer SE | ||
+ | $game_system.se_play($data_system.buzzer_se) | ||
+ | return | ||
+ | end | ||
+ | # Play decision SE | ||
+ | $game_system.se_play($data_system.decision_se) | ||
+ | # Switch to skill screen | ||
+ | $scene = Scene_Skill.new(@status_window.index) | ||
+ | when 2 # equipment | ||
+ | # Play decision SE | ||
+ | $game_system.se_play($data_system.decision_se) | ||
+ | # Switch to equipment screen | ||
+ | $scene = Scene_Equip.new(@status_window.index) | ||
+ | when 3 # status | ||
+ | # Play decision SE | ||
+ | $game_system.se_play($data_system.decision_se) | ||
+ | # Switch to status screen | ||
+ | $scene = Scene_Status.new(@status_window.index) | ||
+ | when 4 | ||
+ | # Play decision SE | ||
+ | $game_system.se_play($data_system.decision_se) | ||
+ | unless $game_party.actors[@status_window.index].position >= 2 | ||
+ | $game_party.actors[@status_window.index].position += 1 | ||
+ | else | ||
+ | $game_party.actors[@status_window.index].position = 0 | ||
+ | end | ||
+ | @status_window.refresh | ||
+ | end | ||
+ | return | ||
+ | end | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | end | ||
+ | </ | ||
+ | |||
+ | ===== Recursos necesarios ===== | ||
+ | Para éste sistema de batalla hace falta unos battlers especiales, con una " | ||
ayuda/rgss/biblioteca/batallakotfire.txt · Última modificación: 2019/09/23 04:01 por 127.0.0.1