class Game_Event < Game_Character attr_writer :hp #-------------------------------------------------------------------------- # ● 对象初始化 #-------------------------------------------------------------------------- alias rb_initialize_160525 initialize def initialize(*arg) rb_initialize_160525(*arg) @hp = 0 end #-------------------------------------------------------------------------- # ● 取得名字 #-------------------------------------------------------------------------- def get_name return @event.name end def hp return @hp || 0 end #============================================================================== # ■ Game_Map #============================================================================== class Game_Map #-------------------------------------------------------------------------- # ● 设置事件 #-------------------------------------------------------------------------- alias rb_setup_events_160525 setup_events def setup_events rb_setup_events_160525 for i in @map.events.keys @events[i].hp = $1.to_i if @events[i].get_name =~ /<HP\s*=\s*(\d+)\s*>/ end end end
class Game_Event < Game_Character
attr_writer :hp
#--------------------------------------------------------------------------
# ● 对象初始化
#--------------------------------------------------------------------------
alias rb_initialize_160525 initialize
def initialize(*arg)
rb_initialize_160525(*arg)
@hp = 0
end
#--------------------------------------------------------------------------
# ● 取得名字
#--------------------------------------------------------------------------
def get_name
return @event.name
end
def hp
return @hp || 0
end
#==============================================================================
# ■ Game_Map
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ● 设置事件
#--------------------------------------------------------------------------
alias rb_setup_events_160525 setup_events
def setup_events
rb_setup_events_160525
for i in @map.events.keys
@events[i].hp = $1.to_i if @events[i].get_name =~ /<HP\s*=\s*(\d+)\s*>/
end
end
end
未测试。
用法:在事件编辑器左上角的事件名称里面写<HP=100>即可设定该事件的HP是100。
目前此功能不支持事件翻页,即一个事件的所有页的HP都是一样的,如果要让同一事件的不同事件页对应的HP不同请另行告知。
|