Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================#
- # ** ISS - Event Upgrade
- #==============================================================================#
- # ** Date Created : 04/28/2011
- # ** Date Modified : 07/31/2011
- # ** Created By : IceDragon
- # ** For Game : S.A.R.A
- # ** ID : 007
- # ** Version : 1.3
- # ** Requires : ISS000 - Core 1.1 (or above)
- #==============================================================================#
- $imported ||= {}
- $imported["ISS-EventUpgrade"] = true
- #==============================================================================#
- # ** ISS
- #==============================================================================#
- module ISS
- module EV_UPGRADE
- RESET_TEMP_ON_PAGE = false
- COPY_MAP = 39
- end
- end
- #==============================================================================#
- # ** ISS::REGEXP::ISS007
- #==============================================================================#
- module ISS
- module REGEXP
- module ISS007
- module EVENT
- TEMP = /<(TEMP_EVENT|TEMP EVENT|TEMPEVENT)>/i
- COPY1 = /<(?:COPY_EVENT|COPY EVENT|COPYEVENT):[ ]*(\d+)[ ]*,[ ]*(\d+)>/i
- COPY2 = /<(?:COPY_EVENT|COPY EVENT|COPYEVENT):[ ]*(\d+)>/i
- SCREEN_Z = /<(?:SCREEN_Z|SCREEN Z|SCREENZ):[ ]*(\d+)>/i
- WATER = /<(?:WATER_MOVE|WATER MOVE|WATERMOVE)>/i
- end
- end
- end
- end
- #==============================================================================#
- # ** Game_System
- #==============================================================================#
- class Game_System
- #--------------------------------------------------------------------------#
- # * Public Instance Variables
- #--------------------------------------------------------------------------#
- attr_accessor :reset_temp_on_page
- #--------------------------------------------------------------------------#
- # * alias-method :initialize
- #--------------------------------------------------------------------------#
- alias :iss007_gsys_initialize :initialize unless $@
- def initialize()
- iss007_gsys_initialize()
- @reset_temp_on_page = ::ISS::EV_UPGRADE::RESET_TEMP_ON_PAGE
- end
- end
- #==============================================================================#
- # ** Game_Map
- #==============================================================================#
- class Game_Map
- #--------------------------------------------------------------------------#
- # * new-method :get_event
- #--------------------------------------------------------------------------#
- def get_event( map_id, event_id )
- return get_map(map_id).events[event_id] if $imported["IEO-BugFixesUpgrades"]
- return load_data( sprintf( "Data/Map%03d.rvdata", map_id ) ).events[event_id]
- end
- end
- #==============================================================================#
- # ** Game_Event
- #==============================================================================#
- class Game_Event < Game_Character
- #--------------------------------------------------------------------------#
- # * Public Instance Variables
- #--------------------------------------------------------------------------#
- attr_accessor :temp_event
- #--------------------------------------------------------------------------#
- # * alias-method :initialize
- #--------------------------------------------------------------------------#
- alias :iss007_ge_initialize :initialize unless $@
- def initialize( map_id, event )
- @temp_event = false
- @reset_temp_on_page = $game_system.reset_temp_on_page
- iss007_ge_initialize( map_id, event )
- iss007_initcache()
- end
- #--------------------------------------------------------------------------#
- # * new-method :iss007_initcache
- #--------------------------------------------------------------------------#
- def iss007_initcache()
- @self_switches = {}
- @self_switches["A"] = false
- @self_switches["B"] = false
- @self_switches["C"] = false
- @self_switches["D"] = false
- end
- #--------------------------------------------------------------------------#
- # * new-method :set_self_switch
- #--------------------------------------------------------------------------#
- def set_self_switch( swi, bool )
- if @temp_event # // Temp Event Internal Self Switch
- @self_switches[ swi.upcase ] = bool
- else
- key = [ @map_id, @event.id, swi.upcase ]
- $game_self_switches[ key ] = bool
- end
- end
- #--------------------------------------------------------------------------#
- # * overwrite-method :conditions_met?
- #--------------------------------------------------------------------------#
- def conditions_met?( page )
- c = page.condition
- if c.switch1_valid # Switch 1
- return false if $game_switches[c.switch1_id] == false
- end
- if c.switch2_valid # Switch 2
- return false if $game_switches[c.switch2_id] == false
- end
- if c.variable_valid # Variable
- return false if $game_variables[c.variable_id] < c.variable_value
- end
- if @temp_event # // Temp Event Internal Self Switch
- return false unless @self_switches[c.self_switch_ch]
- else
- if c.self_switch_valid # Self switch
- key = [@map_id, @event.id, c.self_switch_ch]
- return false if $game_self_switches[key] != true
- end
- end
- if c.item_valid # Item
- item = $data_items[c.item_id]
- return false if $game_party.item_number(item) == 0
- end
- if c.actor_valid # Actor
- actor = $game_actors[c.actor_id]
- return false unless $game_party.members.include?(actor)
- end
- return true # Conditions met
- end
- #--------------------------------------------------------------------------#
- # * alias-method :setup
- #--------------------------------------------------------------------------#
- alias :iss007_ge_setup :setup unless $@
- def setup( new_page )
- iss007_ge_setup( new_page )
- iss007_eventcache()
- end
- #--------------------------------------------------------------------------#
- # * new-method :iss007_eventcache
- #--------------------------------------------------------------------------#
- def iss007_eventcache()
- @temp_event = false if @reset_temp_on_page
- @water_event= false
- return if @list == nil
- for i in 0..@list.size
- next if @list[i] == nil
- if @list[i].code == 108
- @list[i].parameters.to_s.split(/[\r\n]+/).each { |line|
- case line
- when ISS::REGEXP::ISS007::EVENT::WATER
- @water_event= true
- when ISS::REGEXP::ISS007::EVENT::TEMP
- @temp_event = true
- when ISS::REGEXP::ISS007::EVENT::COPY1
- @event = $game_map.get_event( $1.to_i, $2.to_i ).clone
- @event.id = @id
- return refresh()
- when ISS::REGEXP::ISS007::EVENT::COPY2
- @event = $game_map.get_event( ISS::EV_UPGRADE::COPY_MAP, $1.to_i ).clone
- @event.id = @id
- return refresh()
- end
- }
- end
- end
- end
- #--------------------------------------------------------------------------#
- # * overwrite-method :map_passable?
- #--------------------------------------------------------------------------#
- def map_passable?( x, y )
- return $game_map.ship_passable?( x, y ) if @water_event
- return super( x, y )
- end
- end
- #==============================================================================#
- # ** Game_Interpreter
- #==============================================================================#
- class Game_Interpreter
- #--------------------------------------------------------------------------#
- # * overwrite-method :command_123
- #--------------------------------------------------------------------------#
- def command_123()
- if @original_event_id > 0
- ev = get_character(@original_event_id)
- ev.set_self_switch( @params[0], @params[1] == 0 ) if ev.is_a?( Game_Event )
- end
- $game_map.need_refresh = true
- return true
- end
- end
- #=*==========================================================================*=#
- # ** END OF FILE
- #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment