amivaleo Posted September 13, 2008 Share Posted September 13, 2008 Custom Arrow DescrizioneModifica l'arrow, il cursore per selezionare il nemico o il pg in battaglia. Con questo script, il cursore si ridimensiona in base alla grandezza dell'immagine del nemico o del pg. Autoremakgyver, mikb89 e Ziel van Brand AllegatiL'immagine a sinistra rappresenta il cursore di default, quella a destra come lo vedrete con questo script:http://img393.imageshack.us/img393/8008/49023700pa6.pngLa grafica del cursore dipende dalla vostra windowskin. Istruzioni per l'usoAndate in Sprite_Battler e inserite queste 2 stringhe subito sotto alla riga "attr_accessor :battler": attr_accessor :width attr_accessor :height Andate in Spriteset_Battle e incollate la stringa: attr_accessor :enemy_sprites subito sotto alle due stringhe: attr_reader :viewport1 attr_reader :viewport2 ScriptSostituite ora il contenuto di Arrow_Base, Arrow_Enemy, Arrow_Actor e Scene_Battle 3 con i seguenti codici: Arrow_Base #============================================================================== # ¦ Arrow_Base #============================================================================== class Arrow_Base < Sprite #-------------------------------------------------------------------------- attr_reader :index attr_reader :help_window #-------------------------------------------------------------------------- def initialize(viewport, enemies) @enemy_sprites = enemies super(viewport) self.bitmap = RPG::Cache.windowskin($game_system.windowskin_name) self.ox = 0 self.oy = 0 self.z = 2500 @blink_count = 0 @index = 0 @help_window = nil update end #-------------------------------------------------------------------------- def index=(index) @index = index update end #-------------------------------------------------------------------------- def help_window=(help_window) @help_window = help_window if @help_window != nil update_help end end #-------------------------------------------------------------------------- def update @blink_count = (@blink_count + 1) % 16 if $position == 3 if @blink_count < 8 self.src_rect.set(128+16, 96, 16, 16) else self.src_rect.set(160+16, 96, 16, 16) end end if $position == 4 if @blink_count < 8 self.src_rect.set(128, 96, 16, 16) else self.src_rect.set(160, 96, 16, 16) end end if $position == 1 if @blink_count < 8 self.src_rect.set(128+16, 96+16, 16, 16) else self.src_rect.set(160+16, 96+16, 16, 16) end end if $position == 2 if @blink_count < 8 self.src_rect.set(128, 96+16, 16, 16) else self.src_rect.set(160, 96+16, 16, 16) end end if @help_window != nil update_help end end end Arrow_Enemy class Arrow_Enemy < Arrow_Base #-------------------------------------------------------------------------- def enemy return $game_troop.enemies[@index] end #-------------------------------------------------------------------------- def update super $game_troop.enemies.size.times do break if self.enemy.exist? @index += 1 @index %= $game_troop.enemies.size end if Input.repeat?(Input::RIGHT) $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 if Input.repeat?(Input::LEFT) $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 if self.enemy != nil if $position == 1 self.x = self.enemy.screen_x + @enemy_sprites[@index-1].width - 16 - (@enemy_sprites[@index-1].width)/2 self.y = self.enemy.screen_y end if $position == 2 self.x = self.enemy.screen_x - (@enemy_sprites[@index-1].width)/2 self.y = self.enemy.screen_y end if $position == 3 self.x = self.enemy.screen_x + @enemy_sprites[@index-1].width - 16 - (@enemy_sprites[@index-1].width)/2 self.y = self.enemy.screen_y - @enemy_sprites[@index-1].height - 16 end if $position == 4 self.x = self.enemy.screen_x - (@enemy_sprites[@index-1].width)/2 self.y = self.enemy.screen_y - @enemy_sprites[@index-1].height - 16 end end end #-------------------------------------------------------------------------- def update_help @help_window.set_enemy(self.enemy) end end Arrow_Actor #============================================================================== # ¦ Arrow_Actor #============================================================================== class Arrow_Actor < Arrow_Base #-------------------------------------------------------------------------- def actor return $game_party.actors[@index] end #-------------------------------------------------------------------------- alias update_sdva update def update update_sdva if Input.repeat?(Input::DOWN) or Input.repeat?(Input::LEFT) $game_system.se_play($data_system.cursor_se) @index += 1 @index %= $game_party.actors.size end if Input.repeat?(Input::UP) or Input.repeat?(Input::RIGHT) $game_system.se_play($data_system.cursor_se) @index += $game_party.actors.size - 1 @index %= $game_party.actors.size end if self.actor != nil if $position == 1 self.x = self.actor.screen_x self.y = self.actor.screen_y - 16 end if $position == 2 self.x = self.actor.screen_x - 16 self.y = self.actor.screen_y - 16 end if $position == 3 self.x = self.actor.screen_x self.y = self.actor.screen_y - 52 end if $position == 4 self.x = self.actor.screen_x - 16 self.y = self.actor.screen_y - 52 end end end #-------------------------------------------------------------------------- def update_help @help_window.set_actor(self.actor) end #-------------------------------------------------------------------------- end Scene_Battle 3 #============================================================================== # ¦ Scene_Battle 3 #============================================================================== class Scene_Battle def start_phase3 @phase = 3 @actor_index = -1 @active_battler = nil phase3_next_actor end #-------------------------------------------------------------------------- def phase3_next_actor begin if @active_battler != nil @active_battler.blink = false end if @actor_index == $game_party.actors.size-1 @status_window.update_cursor_rect(-2) start_phase4 return end @actor_index += 1 @active_battler = $game_party.actors[@actor_index] @active_battler.blink = true @status_window.update_cursor_rect(@actor_index) end until @active_battler.inputable? phase3_setup_command_window end #-------------------------------------------------------------------------- def phase3_prior_actor begin if @active_battler != nil @active_battler.blink = false end if @actor_index == 0 @status_window.update_cursor_rect(-2) start_phase2 return end @actor_index -= 1 @active_battler = $game_party.actors[@actor_index] @active_battler.blink = true @status_window.update_cursor_rect(@actor_index) end until @active_battler.inputable? phase3_setup_command_window end #-------------------------------------------------------------------------- def phase3_setup_command_window @party_command_window.active = false @party_command_window.visible = false @actor_command_window.active = true @actor_command_window.visible = true @actor_command_window.index = 0 end #-------------------------------------------------------------------------- def update_phase3 if @enemy_arrow_as != nil update_phase3_enemy_select elsif @actor_arrow_as != nil update_phase3_actor_select elsif @skill_window != nil update_phase3_skill_select elsif @item_window != nil update_phase3_item_select elsif @actor_command_window.active update_phase3_basic_command end end #-------------------------------------------------------------------------- def update_phase3_basic_command if Input.trigger?(Input::UP) $game_system.se_play($data_system.cursor_se) phase3_prior_actor return end if Input.trigger?(Input::B) $game_system.se_play($data_system.decision_se) @active_battler.current_action.kind = 0 @active_battler.current_action.basic = 1 phase3_next_actor end if Input.trigger?(Input::C) case @actor_command_window.index when 0 $game_system.se_play($data_system.decision_se) @active_battler.current_action.kind = 0 @active_battler.current_action.basic = 0 start_enemy_select when 1 $game_system.se_play($data_system.decision_se) @active_battler.current_action.kind = 1 start_skill_select when 2 $game_system.se_play($data_system.decision_se) @active_battler.current_action.kind = 2 start_item_select end return end end #-------------------------------------------------------------------------- def update_phase3_skill_select @skill_window.visible = true @skill_window.update @skill_window.scrollbar = true if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) end_skill_select return end if Input.trigger?(Input::C) @skill = @skill_window.skill if @skill == nil or not @active_battler.skill_can_use?(@skill.id) $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.decision_se) @active_battler.current_action.skill_id = @skill.id @skill_window.visible = false @skill_window.scrollbar = false if @skill.scope == 1 start_enemy_select elsif @skill.scope == 3 or @skill.scope == 5 start_actor_select else end_skill_select phase3_next_actor end return end end #-------------------------------------------------------------------------- def update_phase3_item_select @item_window.visible = true @item_window.update @item_window.scrollbar = true if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) end_item_select return end if Input.trigger?(Input::C) @item = @item_window.item if @item == nil or not $game_party.item_can_use?(@item.id) $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.decision_se) @active_battler.current_action.item_id = @item.id @item_window.visible = false @item_window.scrollbar = false if @item.scope == 1 start_enemy_select elsif @item.scope == 3 or @item.scope == 5 start_actor_select else end_item_select phase3_next_actor end return end end #-------------------------------------------------------------------------- def update_phase3_enemy_select $position = 1 @enemy_arrow_ad.update $position = 2 @enemy_arrow_as.update $position = 3 @enemy_arrow_bd.update $position = 4 @enemy_arrow_bs.update if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) end_enemy_select return end if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) @active_battler.current_action.target_index = @enemy_arrow_as.index end_enemy_select if @skill_window != nil end_skill_select end if @item_window != nil end_item_select end phase3_next_actor end end #-------------------------------------------------------------------------- def update_phase3_actor_select $position = 1 @actor_arrow_ad.update $position = 2 @actor_arrow_as.update $position = 3 @actor_arrow_bd.update $position = 4 @actor_arrow_bs.update if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) end_actor_select return end if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) @active_battler.current_action.target_index = @actor_arrow_as.index end_actor_select if @skill_window != nil end_skill_select end if @item_window != nil end_item_select end phase3_next_actor end end #-------------------------------------------------------------------------- def start_enemy_select $position = 1 @enemy_arrow_as = Arrow_Enemy.new(@spriteset.viewport1, @spriteset.enemy_sprites) $position = 2 @enemy_arrow_ad = Arrow_Enemy.new(@spriteset.viewport1, @spriteset.enemy_sprites) $position = 3 @enemy_arrow_bs = Arrow_Enemy.new(@spriteset.viewport1, @spriteset.enemy_sprites) $position = 4 @enemy_arrow_bd = Arrow_Enemy.new(@spriteset.viewport1, @spriteset.enemy_sprites) @enemy_arrow_as.help_window = @help_window @help.visible = true @actor_command_window.active = false @actor_command_window.visible = true end #-------------------------------------------------------------------------- def end_enemy_select @enemy_arrow_as.dispose @enemy_arrow_ad.dispose @enemy_arrow_bs.dispose @enemy_arrow_bd.dispose @enemy_arrow_as = nil @enemy_arrow_ad = nil @enemy_arrow_bs = nil @enemy_arrow_bd = nil if @actor_command_window.index == 0 @actor_command_window.active = true @actor_command_window.visible = true @help.visible = false @help_window.visible = false @label_window.visible = false end end #-------------------------------------------------------------------------- def start_actor_select $position = 1 @actor_arrow_as = Arrow_Actor.new(@spriteset.viewport2, @spriteset.enemy_sprites) $position = 2 @actor_arrow_ad = Arrow_Actor.new(@spriteset.viewport2, @spriteset.enemy_sprites) $position = 3 @actor_arrow_bs = Arrow_Actor.new(@spriteset.viewport2, @spriteset.enemy_sprites) $position = 4 @actor_arrow_bd = Arrow_Actor.new(@spriteset.viewport2, @spriteset.enemy_sprites) @actor_arrow_as.index = @actor_index @actor_arrow_ad.index = @actor_index @actor_arrow_bs.index = @actor_index @actor_arrow_bd.index = @actor_index @actor_arrow_as.help_window = @help_window @actor_command_window.active = false @actor_command_window.visible = true end #-------------------------------------------------------------------------- def end_actor_select @actor_arrow_as.dispose @actor_arrow_ad.dispose @actor_arrow_bs.dispose @actor_arrow_bd.dispose @actor_arrow_as = nil @actor_arrow_ad = nil @actor_arrow_bs = nil @actor_arrow_bd = nil end #-------------------------------------------------------------------------- def start_skill_select @skill_window = Window_Skill.new(@active_battler) @skill_window.help_window = @help_window @actor_command_window.active = false @actor_command_window.visible = true end #-------------------------------------------------------------------------- def end_skill_select @skill_window.dispose @skill_window = nil @help_window.visible = false @help.visible = false @actor_command_window.active = true @actor_command_window.visible = true end #-------------------------------------------------------------------------- def start_item_select @item_window = Window_Item.new(1) @item_window.help_window = @help_window @actor_command_window.active = false @actor_command_window.visible = true end #-------------------------------------------------------------------------- def end_item_select @item_window.dispose @item_window = nil @help_window.visible = false @help.visible = false @actor_command_window.active = true @actor_command_window.visible = true end end Se avete già apportato modifiche alla classe Scene_Battle 3, sostituite solo i blocchi di codice contenenti la parola chiave "arrow" che trovate nel realtivo script. Se avete modificato anche le classi Arrow_Base, Arrow_Enemy e Arrow_Actor, copiate i blocchi di codice caratterizzati da if ed elsif che trovate nei relativi script. Bug e Conflitti Noti:Lo script modifica le classi Sprite_Battler, Spriteset_Battle, Arrow_Base, Arrow_Enemy, Arrow_Actor e Scene_Battle 3. Potrebbe quindi non funzionare o creare errori se queste classi sono state già modificate da altri script. Altri DettagliBuona parte dei custom BS non riscrive o non altera in modo significativo le classi toccate da questo script. Le classi che vengono maggiormente modificate dai custom BS sono le Scene_Battle.Questo script non riscrive la Scene_Battle 3, si limita ad aggiungere stringhe e a riscrivere alcune stringhe di aggiornamento. Copiando solo queste stringhe negli script dei custom BS, lo script dovrebbe funzionare comunque.Io stesso uso questo script con un custom BS senza alcun problema. Link to comment Share on other sites More sharing options...
spriggan Posted September 13, 2008 Share Posted September 13, 2008 (edited) Bello, complimenti. ORa vedo se sul Ccoa regge.. dannata ragazza..Bs splendido e accattivante.. ma quanti impicci ><; Edited September 13, 2008 by spriggan http://img32.imageshack.us/img32/9568/catbloodlq25.gif"E' forse finita la guerra quando i tedeschi hanno bombardato Pearl Harbor?"http://img514.imageshack.us/img514/8265/bannerghe.pngNel mio gioco dico il ca77o che mi pare, il ca77o che mi pare, il ca77o che mi pare.Non comprendono ancora che l’italiano è fondamentalmente un volgare ed ignorante cazzone con il culto della personalità carismatica dominante ed autoritaria per mancanza della propria, e che nel nostro paese l’anti-intellettualismo è uno dei pochi valori in cui tutti si riconoscono. (Bucknasty) Link to comment Share on other sites More sharing options...
amivaleo Posted September 14, 2008 Author Share Posted September 14, 2008 chi "dannata ragazza"?comunque la scene battle 3 non è riscritta interamente. bisogna fare solo delle aggiunte e delle modifiche. penso che modificando le "cose giuste", lo script possa funzionare anche con tutti i bs.io stesso uso un bs diverso da quello standard e, per far funzionare lo script, ho dovuto modificare solo 2 stringhe oltre alla scene battle 3. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now