#==============================================================================
# Template Events
# Version 1.1
# by DeadElf79
#
# Version history:
# ⇒ 1.1
# → added settings module
# → added method for addons
# ⇒ 1.0
# → release
#==============================================================================
module De79TemplateEvents
REGEXP_TEMPLATE_MAP_NAME = /templates/i
end
#==============================================================================
# ** Game_Event
#==============================================================================
class Game_Event < Game_Character
def name
@event.name
end
def pages
@event.pages unless @event.nil?
end
def pages=(new_pages)
@event.pages = new_pages
end
end
#==============================================================================
# ** Game_Map
#==============================================================================
class Game_Map
def setup_events_only(map_id)
@map_id = map_id
@map = load_data(sprintf("Data/Map%03d.rvdata2", @map_id))
setup_events
end
end
#==============================================================================
# ** Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
attr_reader :template_map
def start
super
SceneManager.clear
$game_player.straighten
$game_map.refresh
$game_message.visible = false
load_elf
create_spriteset
create_all_windows
@menu_calling = false
end
def perform_transfer
pre_transfer
$game_player.perform_transfer
load_elf
post_transfer
end
def load_elf
load_all_templates
ask_every_event
ask_every_te_addon
end
def load_all_templates
@template_map = nil
@infos = load_data('data/MapInfos.rvdata2')
@infos.each do |map|
if map[1].name=~De79TemplateEvents::REGEXP_TEMPLATE_MAP_NAME
@template_map = Game_Map.new
@template_map.setup_events_only(map[0])
end
end
@template_map
end
def ask_every_event
return if @template_map.nil?
$game_map.events.values.each do |event|
@template_map.events.values.each do |temp_event|
if temp_event.name.downcase == event.name.downcase
event.pages = temp_event.pages
event.refresh
end
end
end
end
def ask_every_te_addon
end
end