真の玛娜君 发表于 2019-8-25 22:13
放入后,战斗or撤退界面会多一个战况选项
fbeds 发表于 2019-8-25 23:21
抱歉,因为我用了别的脚本,战斗or撤退的界面会直接跳过,而且在这个脚本下,敌人除了状态以外的HP、MP和 ...
#============================================================================== # ■エネミーの状態を表示 for RGSS3 Ver0.80-α # □作成者 kure #============================================================================== $kure_base_script = {} if $kure_base_script == nil $kure_base_script[:InfoBar] = 100 p "エネミーの情報表示" module KURE module InfoBar #初期設定(変更しない事)----------------------------------------------------- COLOR = [] #表示色(IDによって割り当てが決まっています。) #バーの背景色(ID0) COLOR[0] = Color.new(32 ,32, 64, 255) #HPバーの色(ID1,ID2) #COLOR[1] = Color.new(224 ,128, 64, 255) #COLOR[2] = Color.new(240 ,192, 64, 255) end end #============================================================================== # ■ RPG::Enemy(追加定義) #============================================================================== class RPG::Enemy < RPG::BaseItem #-------------------------------------------------------------------------- # ☆ バーの表示幅の定義(追加定義) #-------------------------------------------------------------------------- def infobar_width @note.match(/<情報表示幅\s?(\d+)\s?>/) return 100 unless $1 return $1.to_i end #-------------------------------------------------------------------------- # ☆ バーの表示幅の定義(追加定義) #-------------------------------------------------------------------------- def infobar_visible? return false if @note.include?("<情報非表示>") return true end end #============================================================================== # ■ Game_Enemy #============================================================================== class Game_Enemy < Game_Battler #-------------------------------------------------------------------------- # ☆ バーの表示幅の定義(追加定義) #-------------------------------------------------------------------------- def infobar_width return enemy.infobar_width end #-------------------------------------------------------------------------- # ☆ バーの表示幅の定義(追加定義) #-------------------------------------------------------------------------- def infobar_visible? return enemy.infobar_visible? end end #============================================================================== # ■ Spriteset_Battle #============================================================================== class Spriteset_Battle #-------------------------------------------------------------------------- # ● 敵キャラスプライトの作成(エイリアス再定義) #-------------------------------------------------------------------------- alias k_basescript_before_create_enemies create_enemies def create_enemies k_basescript_before_create_enemies @enemy_info_bar = $game_troop.members.reverse.collect do |enemy| Sprite_Infobar.new(@viewport1, enemy) end end #-------------------------------------------------------------------------- # ● 敵キャラスプライトの更新(エイリアス再定義) #-------------------------------------------------------------------------- alias k_basescript_before_update_enemies update_enemies def update_enemies k_basescript_before_update_enemies @enemy_info_bar.each {|sprite| sprite.update } end #-------------------------------------------------------------------------- # ● 敵キャラスプライトの解放(エイリアス再定義) #-------------------------------------------------------------------------- alias k_basescript_before_dispose_enemies dispose_enemies def dispose_enemies k_basescript_before_dispose_enemies @enemy_info_bar.each {|sprite| sprite.dispose } end end #============================================================================== # ■ Sprite_Infobar #============================================================================== class Sprite_Infobar < Sprite_Base #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :battler #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(viewport, battler = nil) super(viewport) @battler= battler @fill_w = nil @bitmap_data = Cache.battler(battler.battler_name, battler.battler_hue) @state = battler.states @icon_set = Cache.system("Iconset") end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super if @battler @use_sprite = @battler.use_sprite? if @use_sprite update_bitmap update_origin update_position end else self.bitmap = nil end end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- def dispose bitmap.dispose if bitmap super end #-------------------------------------------------------------------------- # ● 転送元ビットマップの更新 #-------------------------------------------------------------------------- def update_bitmap fill_w = @battler.infobar_width * (@battler.hp.to_f / @battler.mhp) state = battler.states if @fill_w != fill_w or @state != state @fill_w = fill_w @state = state width = @battler.infobar_width + 4 new_bitmap = Bitmap.new(width, 35) @state.each_with_index {|state, index| next if 24 * (index + 1) > new_bitmap.width rect = Rect.new(state.icon_index % 16 * 24, state.icon_index / 16 * 24, 24, 24) new_bitmap.blt(24 * index, 0, @icon_set, rect, 255) } # new_bitmap.fill_rect(0, 25, width, 10, color(0)) # new_bitmap.gradient_fill_rect(2, 27, fill_w, 6, color(1), color(2)) self.bitmap = new_bitmap init_visibility self.opacity = 0 unless @battler.infobar_visible? end end #-------------------------------------------------------------------------- # ● 可視状態の初期化 #-------------------------------------------------------------------------- def init_visibility @battler_visible = @battler.alive? self.opacity = 0 unless @battler_visible end #-------------------------------------------------------------------------- # ● 文字色取得 #-------------------------------------------------------------------------- def color(num) return KURE::InfoBar::COLOR[num] end #-------------------------------------------------------------------------- # ● 原点の更新 #-------------------------------------------------------------------------- def update_origin if bitmap self.ox = bitmap.width / 2 self.oy = bitmap.height end end #-------------------------------------------------------------------------- # ● 位置の更新 #-------------------------------------------------------------------------- def update_position self.x = @battler.screen_x self.y = @battler.screen_y - @bitmap_data.height self.z = @battler.screen_z + 10 end end
真の玛娜君 发表于 2019-8-25 23:44
这个脚本可以将敌人的状态显示在头顶上,不过我用的史莱姆测试的所以也可能是身体;这个脚本有自带显示敌人 ...
fbeds 发表于 2019-8-26 12:47
脚本提示108行出错,我开了个新工程放进去后还是提示出错……
#============================================================================== # ■エネミーの状態を表示 for RGSS3 Ver0.80-α # □作成者 kure #============================================================================== $kure_base_script = {} if $kure_base_script == nil $kure_base_script[:InfoBar] = 100 p "エネミーの情報表示" module KURE module InfoBar #初期設定(変更しない事)----------------------------------------------------- COLOR = [] #表示色(IDによって割り当てが決まっています。) #バーの背景色(ID0) COLOR[0] = Color.new(32 ,32, 64, 255) #HPバーの色(ID1,ID2) #COLOR[1] = Color.new(224 ,128, 64, 255) #COLOR[2] = Color.new(240 ,192, 64, 255) end end #============================================================================== # ■ RPG::Enemy(追加定義) #============================================================================== class RPG::Enemy < RPG::BaseItem #-------------------------------------------------------------------------- # ☆ バーの表示幅の定義(追加定義) #-------------------------------------------------------------------------- def infobar_width @note.match(/<情報表示幅\s?(\d+)\s?>/) return 100 unless $1 return $1.to_i end #-------------------------------------------------------------------------- # ☆ バーの表示幅の定義(追加定義) #-------------------------------------------------------------------------- def infobar_visible? return false if @note.include?("<情報非表示>") return true end end #============================================================================== # ■ Game_Enemy #============================================================================== class Game_Enemy < Game_Battler #-------------------------------------------------------------------------- # ☆ バーの表示幅の定義(追加定義) #-------------------------------------------------------------------------- def infobar_width return enemy.infobar_width end #-------------------------------------------------------------------------- # ☆ バーの表示幅の定義(追加定義) #-------------------------------------------------------------------------- def infobar_visible? return enemy.infobar_visible? end end #============================================================================== # ■ Spriteset_Battle #============================================================================== class Spriteset_Battle #-------------------------------------------------------------------------- # ● 敵キャラスプライトの作成(エイリアス再定義) #-------------------------------------------------------------------------- alias k_basescript_before_create_enemies create_enemies def create_enemies k_basescript_before_create_enemies @enemy_info_bar = $game_troop.members.reverse.collect do |enemy| Sprite_Infobar.new(@viewport1, enemy) end end #-------------------------------------------------------------------------- # ● 敵キャラスプライトの更新(エイリアス再定義) #-------------------------------------------------------------------------- alias k_basescript_before_update_enemies update_enemies def update_enemies k_basescript_before_update_enemies @enemy_info_bar.each {|sprite| sprite.update } end #-------------------------------------------------------------------------- # ● 敵キャラスプライトの解放(エイリアス再定義) #-------------------------------------------------------------------------- alias k_basescript_before_dispose_enemies dispose_enemies def dispose_enemies k_basescript_before_dispose_enemies @enemy_info_bar.each {|sprite| sprite.dispose } end end #============================================================================== # ■ Sprite_Infobar #============================================================================== class Sprite_Infobar < Sprite_Base #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :battler #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(viewport, battler = nil) super(viewport) @battler= battler @fill_w = nil @bitmap_data = Cache.battler(battler.battler_name, battler.battler_hue) @state = battler.states @icon_set = Cache.system("Iconset") end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super if @battler @use_sprite = @battler.use_sprite? if @use_sprite update_bitmap update_origin update_position end else self.bitmap = nil end end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- def dispose bitmap.dispose if bitmap super end #-------------------------------------------------------------------------- # ● 転送元ビットマップの更新 #-------------------------------------------------------------------------- def update_bitmap fill_w = @battler.infobar_width * (@battler.hp.to_f / @battler.mhp) state = battler.states if @fill_w != fill_w or @state != state @fill_w = fill_w @state = state width = @battler.infobar_width + 4 new_bitmap = Bitmap.new(width, 35) @state.each_with_index {|state, index| next if 24 * (index + 1) > new_bitmap.width rect = Rect.new(state.icon_index % 16 * 24, state.icon_index / 16 * 24, 24, 24) new_bitmap.blt(24 * index, 0, @icon_set, rect, 255) } # new_bitmap.fill_rect(0, 25, width, 10, color(0)) # new_bitmap.gradient_fill_rect(2, 27, fill_w, 6, color(1), color(2)) self.bitmap = new_bitmap init_visibility self.opacity = 0 unless @battler.infobar_visible? end end #-------------------------------------------------------------------------- # ● 可視状態の初期化 #-------------------------------------------------------------------------- def init_visibility @battler_visible = @battler.alive? self.opacity = 0 unless @battler_visible end #-------------------------------------------------------------------------- # ● 文字色取得 #-------------------------------------------------------------------------- def color(num) return KURE::InfoBar::COLOR[num] end #-------------------------------------------------------------------------- # ● 原点の更新 #-------------------------------------------------------------------------- def update_origin if bitmap self.ox = bitmap.width / 2 self.oy = bitmap.height end end #-------------------------------------------------------------------------- # ● 位置の更新 #-------------------------------------------------------------------------- def update_position self.x = @battler.screen_x self.y = @battler.screen_y - @bitmap_data.height self.z = @battler.screen_z + 10 end end
真の玛娜君 发表于 2019-8-26 12:53
这是论坛的锅,我用是没问题的,我给你重发一遍。
#=================================================== ...
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |