| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 3 |
| 经验 | |
| 最后登录 | 2023-10-1 |
| 在线时间 | 28 小时 |
- 梦石
- 0
- 星屑
- 289
- 在线时间
- 28 小时
- 注册时间
- 2020-4-6
- 回帖
- 6
|
楼主 |
发表于 2020-7-4 18:52:01
|
显示全部楼层
惊了,居然可以了,不过另一个脚本到处错了- #==============================================================================
- # Mother3 Add-ON (HP scrolling)
- # Author Ramiro
- # Version, 1.1
- #------------------------------------------------------------------------------
- # Performs a similar effect like Mother series.
- #==============================================================================
- $imported = {} if $imported.nil?
- $imported['Ramiro-M3-HPScroll'] = true
- #==============================================================================
- # |
- #==============================================================================
- class Game_BattlerBase
-
- # Sets the interval of gain/loose of 1 hp, must be an integer value.
- SCROLL_FRAME_INTERVAL = 7
- #Notes for multipliers:
- # Numbers bigger than 1 means than the time between intervals will be shorter.
- # Lower numbers than 1 means the opposite.
- # 1 means Same as normal hp discount.
- # Multiplier when guarding
- SCROLL_GUARD_MULTIPLIER = 1
- # Multiplier when hp = 0
- SCROLL_DEAD_MULTIPLIER = 1
- #multiplier when recovering HP
- SCROLL_RECOVERY_RATE = 0.5
-
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- attr_accessor :scroll_hp
-
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- alias ramiro_m3dmgscrll_initialize initialize
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def initialize
- ramiro_m3dmgscrll_initialize
- @scroll_hp = @hp
- end
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def real_hp_value
- actor? ? @scroll_hp : @hp
- end
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def refresh
- state_resist_set.each {|state_id| erase_state(state_id) }
- @hp = [[@hp, mhp].min, 0].max
- @mp = [[@mp, mmp].min, 0].max
- real_hp_value == 0 ? add_state(death_state_id) : remove_state(death_state_id)
- end
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def refresh_scroll
- alive = alive?
- real_hp_value == 0 ? add_state(death_state_id) : remove_state(death_state_id)
- perform_collapse_effect if dead? && alive
- end
- end
- class Game_Battler < Game_BattlerBase
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- alias ramiro_m3dmgscrll_die die
- alias ramiro_m3dmgscrll_revive revive
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def die
- @scroll_hp = 0
- ramiro_m3dmgscrll_die
- end
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def revive
- @scroll_hp = 1 if @scroll_hp == 0
- ramiro_m3dmgscrll_revive
- end
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def scroll_dead_multiplier
- SCROLL_DEAD_MULTIPLIER
- end
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def scroll_guard_multiplier
- SCROLL_GUARD_MULTIPLIER * self.grd
- end
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def scroll_recovery_interval
- r = SCROLL_FRAME_INTERVAL * SCROLL_RECOVERY_RATE
- r *= self.grd if guard?
- r.to_i
- end
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def scroll_interval
- return (SCROLL_FRAME_INTERVAL * scroll_guard_multiplier).to_i if guard?
- return (SCROLL_FRAME_INTERVAL * scroll_dead_multiplier).to_i if self.hp == 0
- SCROLL_FRAME_INTERVAL
- end
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def scroll_update
- if actor?
- update_actor_hp_scroll
- end
- end
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def update_actor_hp_scroll
- if @scroll_hp > @hp
- return if BattleManager.actor == self #CAUTION!
- # return if SceneManager.scene.subject && SceneManager.scene.subject == self
- if Graphics.frame_count % scroll_interval == 0
- @scroll_hp -= 1
- refresh_scroll
- end
- elsif @scroll_hp < @hp
- @scroll_hp += 1 if Graphics.frame_rate % scroll_recovery_interval == 0
- refresh_scroll
- end
- end
-
- end
- #==============================================================================
- # |
- #==============================================================================
- module BattleManager
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- class << self
- alias ramiro_m3dmgscrll_process_victory process_victory
- alias ramiro_m3dmgscrll_process_abort process_abort
- end
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def self.process_victory
- for actor in $game_party.members
- actor.hp = actor.scroll_hp if actor.scroll_hp > actor.hp
- end
- ramiro_m3dmgscrll_process_victory
- end
-
- def self.process_abort
- for actor in $game_party.members
- actor.hp = actor.scroll_hp if actor.scroll_hp > actor.hp
- end
- ramiro_m3dmgscrll_process_abort
- end
- end
- #==============================================================================
- # |
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- attr_accessor :subject
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- alias ramiro_m3dmgscrll_start start
- alias ramiro_m3dmgscrll_update_basic update_basic
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def start
- for actor in $game_party.members
- actor.scroll_hp = actor.hp
- end
- ramiro_m3dmgscrll_start
- end
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def update_basic
- ramiro_m3dmgscrll_update_basic
- for battler in $game_troop.members+$game_party.members
- return if $game_troop.interpreter.running? #CAUTION!
- battler.scroll_update
- end
- if BattleManager.actor && BattleManager.actor.dead?
- if $imported['Ramiro-Mother3Visual']
- for battler in $game_party.members
- next if BattleManager.actor.index <= battler.index
- battler.sprite_effect_type = :go_down
- end
- end
- cancel_all_windows
- next_command
- end
- end
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def cancel_all_windows
- @help_window.hide
- @help_window.contents.clear
- @item_window.hide
- @skill_window.hide
- @actor_window.hide
- @enemy_window.hide
- @item_window.unselect
- @actor_window.unselect
- @skill_window.unselect
- @enemy_window.unselect
- if $imported['Ramiro-RBS-TargetSelection']
- @selection_active = false
- end
- end
-
- end
- #==============================================================================
- # |
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def hp_scroll_rate
- return @scroll_hp.to_f / mhp
- end
- end
- #==============================================================================
- # |
- #==============================================================================
- class Window_Base < Window
-
- #--------------------------------------------------------------------------
- # * Draw Gauge
- # rate : Rate (full at 1.0)
- # color1 : Left side gradation
- # color2 : Right side gradation
- #--------------------------------------------------------------------------
- def draw_gauge(x, y, width, rate, color1, color2, background=true)
- fill_w = (width * rate).to_i
- gauge_y = y + line_height - 8
- contents.fill_rect(x, gauge_y, width, 6, gauge_back_color) if background
- contents.gradient_fill_rect(x, gauge_y, fill_w, 6, color1, color2)
- end
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def hp_scroll_base_color1(actor)
- actor.scroll_hp > actor.hp ? Color.new(255,0,0) : Color.new(0,255,0)
- end
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def hp_scroll_base_color2(actor)
- actor.scroll_hp > actor.hp ? Color.new(128,0,0) : Color.new(0,128,0)
- end
- end
- if $imported['Ramiro-Mother3Visual']
-
- #==============================================================================
- # |
- #==============================================================================
- class Window_BattleStatusPart < Window_Base
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- alias ramiro_m3dmgscrll_update update
- #--------------------------------------------------------------------------
- # * Draw HP
- #--------------------------------------------------------------------------
- def draw_actor_hp(actor, x, y, width = 124)
- rates = [actor.hp_scroll_rate, actor.hp_rate]
- draw_gauge(x, y, width, rates.max, hp_scroll_base_color1(actor), hp_scroll_base_color2(actor))
- draw_gauge(x, y, width, rates.min, hp_gauge_color1, hp_gauge_color2, false)
- change_color(system_color)
- draw_text(x, y, 30, line_height, Vocab::hp_a)
- draw_current_and_max_values(x, y, width, actor.scroll_hp, actor.mhp,
- hp_color(actor), normal_color)
- end
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def update
- ramiro_m3dmgscrll_update
- update_scroll_hp
- end
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def update_scroll_hp
- @saved_hp = 0 if !@saved_hp
- if actor.scroll_hp != @saved_hp
- @saved_hp = actor.scroll_hp
- contents.clear_rect(2, line_height, contents.width - 4, line_height)
- draw_actor_hp(actor, 2, line_height, contents.width - 4)
- refresh if @saved_hp == 0
- end
- end
- end
- else
- #==============================================================================
- # |
- #==============================================================================
- class Window_BattleStatus < Window_Selectable
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- alias ramiro_m3dmgscrll_update update
- #--------------------------------------------------------------------------
- # * Draw HP
- #--------------------------------------------------------------------------
- def draw_actor_hp(actor, x, y, width = 124)
- rates = [actor.hp_scroll_rate, actor.hp_rate]
- draw_gauge(x, y, width, rates.max, hp_scroll_base_color1(actor), hp_scroll_base_color2(actor))
- draw_gauge(x, y, width, rates.min, hp_gauge_color1, hp_gauge_color2, false)
- change_color(system_color)
- draw_text(x, y, 30, line_height, Vocab::hp_a)
- draw_current_and_max_values(x, y, width, actor.scroll_hp, actor.mhp,
- hp_color(actor), normal_color)
- end
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def update
- ramiro_m3dmgscrll_update
- update_scroll_hp
- end
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def update_scroll_hp
- @saved_hp = 0 if !@saved_hp
- if actor.scroll_hp != @saved_hp
- @saved_hp = actor.scroll_hp
- contents.clear_rect(2, line_height, contents.width - 4, line_height)
- draw_actor_hp(actor, 2, line_height, contents.width - 4)
- end
- end
-
- end
- end
- #==============================================================================
- # |
- #==============================================================================
- class Scene_Base
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- alias ramiro_m3dmgscrll_update update
- #--------------------------------------------------------------------------
- # *
- #--------------------------------------------------------------------------
- def update
- ramiro_m3dmgscrll_update
- return if self.is_a?(Scene_Battle)
- for actor in $game_party.members
- actor.scroll_hp = actor.hp
- end
- end
-
- end
复制代码
|
-
|