deadcell Trouvère Follet
Nombre de messages : 625 Age : 35 Niveau Rpg Maker : Excellent Niveau Jeux Préférés : Final Fantasy, Resident evil... Date d'inscription : 21/03/2007
| Sujet: Objet scan Sam 07 Juil 2007, 12:11 | |
| Ce script permet de créer un objet qui donne la possiblité de voir le nombre de HP des ennemis si l'on en est équipé - Auteur : Inconnu - Installation : Tout d'abord, vous devez créer l'item que j'ai appellé 'Anneau Analyse' (vous pouvez mettre autre chose). Il est évident qu'il faut que ce soit une arme ou un équipement de protection et non un objet comme une potion(dans mon cas c'est un accessoire). Comme caractéristique de l'item, vous mettez ce que vous voulez. Ensuite, allez dans l'éditeur de script et prenez le 'Scene_Battle 1' et regarder le code ci-dessous: - Code:
-
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 @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 Et remplacez-le par celui ci - Code:
-
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
found = false for i in 0...$game_party.actors.size if $data_armors[$game_party.actors[i].armor4_id] != nil armor = $data_armors[$game_party.actors[i].armor4_id].name end # Changer le nom "Anneau Analyse" par le nom que vous avez donnez à l'item if armor == "Anneau Analyse" and found == false @help_window.scan = true found = true elsif armor != "Anneau Analyse" and found == false @help_window.scan =false end end
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 @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 | |
|
deadcell Trouvère Follet
Nombre de messages : 625 Age : 35 Niveau Rpg Maker : Excellent Niveau Jeux Préférés : Final Fantasy, Resident evil... Date d'inscription : 21/03/2007
| Sujet: Re: Objet scan Sam 07 Juil 2007, 12:12 | |
| ps : à la ligne 48 et 51, changer le nom "Anneau Analyse" par le nom que vous avez donner à votre objet. Ensuite, allez dans le script 'Window_Help' et remplacer tout le code par celui-ci : - Code:
-
class Window_Help < Window_Base attr_accessor :scan #--------------------------- # Object initialization #--------------------------- def initialize super(0, 0, 640, 64) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font = Font.new("Arial") @scan = false end #--------------------------- # Text creation # text : Text to display. # align : Alignment (0: Left - 1: Center - 2: Right) #--------------------------- def set_text(text, align = 0) if text != @text or align != @align self.contents.clear self.contents.font.color = normal_color self.contents.draw_text(4, 0, self.width - 40, 32, text, align) @text = text @align = align @actor = nil end self.visible = true end #--------------------------- # Actor text creation # actor : Displays status of this actor #--------------------------- def set_actor(actor) if actor != @actor self.contents.clear draw_actor_name(actor, 4, 0) draw_actor_state(actor, 140, 0) draw_actor_hp(actor, 284, 0) draw_actor_sp(actor, 460, 0) @actor = actor @text = nil self.visible = true end end #--------------------------- # Enemy text creation # enemy : Displays status of this enemy #--------------------------- def set_enemy(enemy) text = enemy.name if @scan == true text+= " - HP: " + enemy.hp.to_s end state_text = make_battler_state_text(enemy, 112, false) if state_text != "" text += " - Status: " + state_text end set_text(text, 1) end end Quand l'un de vos persos sera équipé de l'objet en question, lors d'un combat, quand vous sélectionnerez un ennemi, son nom sera suivit du nombre de PV qu'il possède et ensuite, qui lui restera. | |
|