Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # // 07/16/2011
- # // 07/16/2011
- # // Sub-Event Engine
- # <see: event_id>
- # Will copy event (event_id) from the SEE map and use it as the Subevent
- # <see: event_id, map_id>
- # Will copy event (event_id) from the map (map_id) and use it as the Subevent
- #==============================================================================#
- # ** ISS::SEE
- #==============================================================================#
- module ISS
- module SEE
- # // Sub Event Map
- SEE_MAP_ID = 11
- # // If the parent event is erased, should the subevent follow?
- ERASE_SUBEVENT = true
- end
- end
- #==============================================================================#
- # ** ISS::REGEXP::ISS014
- #==============================================================================#
- module ISS
- module REGEXP
- module ISS014
- module EVENT
- SEE2 = /<SEE:[ ]*(\d+),[ ](\d+)>/i
- SEE1 = /<SEE:[ ]*(\d+)>/i
- end
- end
- end
- end
- #==============================================================================#
- # ** Game_Interpreter
- #==============================================================================#
- class Game_Interpreter
- #--------------------------------------------------------------------------#
- # * Public Instance Variables
- #--------------------------------------------------------------------------#
- attr_accessor :parent_event
- #--------------------------------------------------------------------------#
- # * alias-method :get_character
- #--------------------------------------------------------------------------#
- alias :iss014_gi_get_character :get_character unless $@
- def get_character( *args, &block )
- ev = self.parent_event.nil?() ? $game_map.events[@event_id] : self.parent_event()
- return iss014_gi_get_character( ev.refocus_id ) unless ev.refocus_id.nil?() unless ev.nil?()
- iss014_gi_get_character( *args )
- end
- end
- #==============================================================================#
- # ** Game_Map
- #==============================================================================#
- class Game_Map
- #--------------------------------------------------------------------------#
- # * new-method :get_event
- #--------------------------------------------------------------------------#
- def get_event( map_id, event_id )
- if $imported["IEO-BugFixesUpgrades"]
- if IEO::UPGRADE::USE_MAP_CACHE
- if @map_cache[map_id].nil?()
- temp_map = load_data( sprintf( "Data/Map%03d.rvdata", map_id ) )
- @map_cache[map_id] = temp_map
- end
- return @map_cache[map_id].events[event_id]
- end
- end
- temp_map = load_data( sprintf( "Data/Map%03d.rvdata", map_id ) )
- return temp_map.events[event_id]
- end unless method_defined? :get_event
- end
- #==============================================================================#
- # ** Game_Event
- #==============================================================================#
- class Game_Event < Game_Character
- #--------------------------------------------------------------------------#
- # * Constants
- #--------------------------------------------------------------------------#
- ERASE_SUBEVENT = ISS::SEE::ERASE_SUBEVENT
- #--------------------------------------------------------------------------#
- # * Public Instance Variables
- #--------------------------------------------------------------------------#
- attr_accessor :sub_event
- attr_accessor :disable_subevent
- attr_accessor :refocus_id
- attr_accessor :is_subevent
- #--------------------------------------------------------------------------#
- # * new-method :is_a_subsevent?
- #--------------------------------------------------------------------------#
- def is_a_subsevent?()
- return self.is_subevent()
- end
- #--------------------------------------------------------------------------#
- # * alias-method :setup
- #--------------------------------------------------------------------------#
- alias :iss014_ge_setup :setup unless $@
- def setup( *args, &block )
- iss014_ge_setup( *args, &block )
- iss014_eventcache()
- @interpreter.parent_event = self if self.is_a_subsevent?() unless @interpreter.nil?()
- end
- #--------------------------------------------------------------------------#
- # * new-method :setup_sub_event
- #--------------------------------------------------------------------------#
- def setup_sub_event( ev_id, mp_id )
- ev = $game_map.get_event( mp_id, ev_id ).deep_clone
- ev.pages.each { |p| p.trigger = 4 } # // Forced to Parallel
- @sub_event = Game_Event.new( @map_id, ev )
- @sub_event.disable_subevent = true
- @sub_event.is_subevent = true
- end
- #--------------------------------------------------------------------------#
- # * new-method :iss014_eventcache
- #--------------------------------------------------------------------------#
- def iss014_eventcache()
- @sub_event = nil
- return if @list.nil?()
- for i in 0...@list.size
- if @list[i].code == 108
- @list[i].parameters.to_s.split(/[\r\n]+/).each { |line|
- case line
- when ISS::REGEXP::ISS014::EVENT::SEE2
- setup_sub_event( $1.to_i, $2.to_i )
- when ISS::REGEXP::ISS014::EVENT::SEE1
- setup_sub_event( $1.to_i, ISS::SEE::SEE_MAP_ID )
- end
- }
- end
- end
- end
- #--------------------------------------------------------------------------#
- # * alias-method :erase
- #--------------------------------------------------------------------------#
- alias :iss014_ge_erase :erase unless $@
- def erase( *args, &block )
- iss014_ge_erase( *args, &block )
- @sub_event.erase() unless @sub_event.nil?() unless self.disable_subevent() if ERASE_SUBEVENT
- end
- #--------------------------------------------------------------------------#
- # * alias-method :update
- #--------------------------------------------------------------------------#
- alias :iss014_ge_update :update unless $@
- def update( *args, &block )
- iss014_ge_update( *args, &block )
- @sub_event.update() unless self.sub_event().nil?() unless self.disable_subevent()
- end
- end
- #=*==========================================================================*=#
- # ** END OF FILE
- #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment