| Ancien membre du staff |
 |
 |
Inscrit le: 20 Juil 2008, 00:00 Messages: 1726 Niveau RPG Maker: correct Point(s) Fort(s): polyvalent Sexe: Masculin Points d'aide: 0/60
Créations :
- Création d'un sous menu
- Personnalisation des tailles d'icônes et de curseurs
- Affichages des altérations d'état via des icônes
Voir ses créations
|
Description :Ce script remplace l'affichage classique des altérations d'état par un affichage d' icônes. Ces icônes sont personnalisables à souhait. Plusieurs extensions du script sont mises à disposition. Caractéristiques :Auteur : Albavor Droits : libre d'utilisation, libre de modification, libre de diffusion Dépendance : Database Management par Åvygeil Le script :- Code: Tout sélectionner
#============================================================================== # ■ State_Icon #------------------------------------------------------------------------------ # Par Albavor # Ce script remplace l'affichage des altérations d'état par l'utilisation # d'icônes. #------------------------------------------------------------------------------ # Version 1.1 # Seules les 5 premières altérations d'état sont affichées dans la fenêtre de # statut en combat et en menu. #------------------------------------------------------------------------------ # Dépendance : Database_Management par Åvygeil #==============================================================================
Database.create_table("Etat") { |t| t.column :id, :integer t.column :icone, :string }
#============================================================================== # ■ Window_Base #============================================================================== class Window_Base < Window def make_battler_state_text(battler, width, need_normal) affichage = [] for i in battler.states if $data_states[i].rating >= 1 ligne = Database::Etat.find { |ligne| ligne.id == i } text = ligne.icone affichage.push(text) end end return affichage end def draw_actor_state(actor, x, y, width = 120) affichage = make_battler_state_text(actor, width, true) for i in 0...affichage.size text = affichage[i] text_x = x + i * 24 text_y = y image = RPG::Cache.icon(text) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(text_x, text_y, image, Rect.new(0, 0, 24, 24), opacity) end end end
Explications :La version de base ne permet l'affichage que de 5 altérations dans le menu et les combats. La priorité d'affichage est la même que celle des animations d'altération. Cette version est limitée dans le cas où plus de 5 altérations sont infligées, mais elle est toujours plus avancée que le système de base. Une extension viendra compléter ce défaut. Avant toute chose, lisez l'utilisation du Database Management. Chaque champ devra être rempli ainsi : id : numéro de l'altération icone : nom de l'icône à afficher pour cette altération Je rappelle que le template ne doit pas être modifié.Voilà, c'est aussi simple que ça. Les icônes en question doivent se trouver dans le dossier icon. Leur taille doit être de 24*24px. Quelques screens.   L'extension :Cette extension se place à la suite du script précédent. Elle génère une fenêtre spéciale qui affiche la totalité des altérations d'état en combat. - Code: Tout sélectionner
#============================================================================== # ■ State_Icon #------------------------------------------------------------------------------ # Par Albavor # Ce script remplace l'affichage des altérations d'état par l'utilisation # d'icônes. #------------------------------------------------------------------------------ # Version 1.1 extension # Seules les 5 premières altérations d'état sont affichées dans la fenêtre de # statut en combat et en menu. En combat, une commande supplémentaire permet # d'accéder à la liste complète des altérations. #------------------------------------------------------------------------------ # Dépendance : State_Icon Version 1.1 #==============================================================================
#============================================================================== # ■ Window_BattleState #============================================================================== # Fenêtre affichant la totalité des icônes des altérations d'état. #============================================================================== class Window_BattleState < Window_Base def initialize(x, y, width, height, actor) super(x, y, width, height) self.contents = Bitmap.new(width - 32, height - 32) @actor = actor refresh end def dispose super end def refresh self.contents.clear affichage = make_battler_state_text(@actor, width, true) for i in 0...affichage.size text = affichage[i] text_x = 4 + i % 5 * 24 text_y = i / 5 *24 image = RPG::Cache.icon(text) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(text_x, text_y, image, Rect.new(0, 0, 24, 24), opacity) end end end
#============================================================================== # ■ Window_PartyCommand #============================================================================== class Window_PartyCommand < Window_Selectable def initialize super(0, 0, 640, 64) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = 24 self.back_opacity = 160 @commands = ["Engager", "Fuir", "Etat"] @item_max = 3 @column_max = 3 draw_item(0, normal_color) draw_item(1, $game_temp.battle_can_escape ? normal_color : disabled_color) draw_item(2, normal_color) self.active = false self.visible = false self.index = 0 end def draw_item(index, color) self.contents.font.color = color rect = Rect.new(128 + index * 128 + 4, 0, 128 - 10, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) self.contents.draw_text(rect, @commands[index], 1) end def update_cursor_rect self.cursor_rect.set(128 + index * 128, 0, 128, 32) end end
#============================================================================== # ■ Scene_Battle #============================================================================== class Scene_Battle 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, 0) # トループを準備 @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, [s1, s2, s3, s4]) @actor_command_window.y = 160 @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, "Graphics/Transitions/" + $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 @etat_window != nil @etat_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?(Scene_Title) # 画面をフェードアウト Graphics.transition Graphics.freeze end # 戦闘テストからゲームオーバー画面以外に切り替え中の場合 if $BTEST and not $scene.is_a?(Scene_Gameover) $scene = nil end end def update # バトルイベント実行中の場合 if $game_system.battle_interpreter.running? # インタプリタを更新 $game_system.battle_interpreter.update # アクションを強制されているバトラーが存在しない場合 if $game_temp.forcing_battler == nil # バトルイベントの実行が終わった場合 unless $game_system.battle_interpreter.running? # 戦闘継続の場合、バトルイベントのセットアップを再実行 unless judge setup_battle_event end end # アフターバトルフェーズでなければ if @phase != 5 # ステータスウィンドウをリフレッシュ @status_window.refresh end end end # システム (タイマー)、画面を更新 $game_system.update $game_screen.update # タイマーが 0 になった場合 if $game_system.timer_working and $game_system.timer == 0 # バトル中断 $game_temp.battle_abort = true end # ウィンドウを更新 @help_window.update @party_command_window.update @actor_command_window.update @status_window.update @message_window.update # スプライトセットを更新 @spriteset.update # トランジション処理中の場合 if $game_temp.transition_processing # トランジション処理中フラグをクリア $game_temp.transition_processing = false # トランジション実行 if $game_temp.transition_name == "" Graphics.transition(20) else Graphics.transition(40, "Graphics/Transitions/" + $game_temp.transition_name) end end # メッセージウィンドウ表示中の場合 if $game_temp.message_window_showing return end # エフェクト表示中の場合 if @spriteset.effect? return end # ゲームオーバーの場合 if $game_temp.gameover # ゲームオーバー画面に切り替え $scene = Scene_Gameover.new return end # タイトル画面に戻す場合 if $game_temp.to_title # タイトル画面に切り替え $scene = Scene_Title.new return end # バトル中断の場合 if $game_temp.battle_abort # バトル開始前の BGM に戻す $game_system.bgm_play($game_temp.map_bgm) # バトル終了 battle_end(1) return end # ウェイト中の場合 if @wait_count > 0 # ウェイトカウントを減らす @wait_count -= 1 return end # アクションを強制されているバトラーが存在せず、 # かつバトルイベントが実行中の場合 if $game_temp.forcing_battler == nil and $game_system.battle_interpreter.running? return end # フェーズによって分岐 case @phase when 1 # プレバトルフェーズ update_phase1 when 2 # パーティコマンドフェーズ update_phase2 when 3 # アクターコマンドフェーズ update_phase3 when 4 # メインフェーズ update_phase4 when 5 # アフターバトルフェーズ update_phase5 when 21 # consultation des altérations d'état update_phase21 end end def update_phase2 # C ボタンが押された場合 if Input.trigger?(Input::C) # パーティコマンドウィンドウのカーソル位置で分岐 case @party_command_window.index when 0 # 戦う # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # アクターコマンドフェーズ開始 start_phase3 when 1 # 逃げる # 逃走可能ではない場合 if $game_temp.battle_can_escape == false # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # 逃走処理 update_phase2_escape when 2 $game_system.se_play($data_system.decision_se) start_phase21 end return end end def start_phase21 # フェーズ 3 に移行 @phase = 21 @party_command_window.active = false @party_command_window.visible = false # アクターを非選択状態に設定 @actor_index = 0 @active_battler = $game_party.actors[@actor_index] end def update_phase21 if @active_battler != nil @active_battler.blink = false end make_etat_window(@actor_index)
@active_battler = $game_party.actors[@actor_index] @active_battler.blink = true if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) if @etat_window != nil @etat_window.dispose @etat_window = nil end start_phase2 end if Input.trigger?(Input::R) $game_system.se_play($data_system.cursor_se) @actor_index += 1 @actor_index %= $game_party.actors.size make_etat_window(@actor_index) return end if Input.trigger?(Input::L) $game_system.se_play($data_system.cursor_se) @actor_index += $game_party.actors.size - 1 @actor_index %= $game_party.actors.size make_etat_window(@actor_index) return end end def make_etat_window(index) if @etat_window != nil @etat_window.dispose @etat_window = nil end actor = $game_party.actors[index] if actor.states.size != 0 item_max = actor.states.size row_max = (item_max + 4) / 5 height = 24 * row_max +32 etat_x = @actor_index * 160 etat_y = 320 - height @etat_window = Window_BattleState.new(etat_x, etat_y, 160, height, actor) end return end end
Quelques images :  
_________________
|
|