Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- Switchless Common Events
- by PK8
- Created: 5/6/2012
- Modified: -
- Ace Port By IceDragon (06/05/2012 to 06/05/2012)
- ──────────────────────────────────────────────────────────────────────────────
- ■ Table of Contents
- o Author's Notes - Line 15-17
- o Introduction - Line 19-25
- o Features - Line 27-30
- o Methods Aliased - Line 32-35
- o Changelog - Line 37-39
- ──────────────────────────────────────────────────────────────────────────────
- ■ Author's Notes
- This was a fairly quick script I wrote. It was an idea I had in my head
- for a little while.
- ──────────────────────────────────────────────────────────────────────────────
- ■ Introduction
- Remember how in RPG Maker 2000 and 2003, you didn't need to rely on switches
- in order for your common events to run on parallel process and autorun? Well,
- it's back. This script lets you set which common events are going to run in
- either parallel processing or automatically, without the use of conditional
- switches. You can even set up your own if conditional on how they should be
- activated.
- ──────────────────────────────────────────────────────────────────────────────
- ■ Features
- o Set which common events are going to use autorun or parallel process
- triggering without a conditional switch.
- o Create a custom conditional for your common event.
- ──────────────────────────────────────────────────────────────────────────────
- ■ Methods Aliased
- Scene_Title.command_new_game
- Game_Interpreter.setup_starting_event
- Game_CommonEvent.refresh
- ──────────────────────────────────────────────────────────────────────────────
- ■ Changelog
- v1 (5/6/2012) - Initial Release
- =end
- #==============================================================================
- # ** Configuration
- #==============================================================================
- module PK8
- class Switchless_CommonEvents
- #--------------------------------------------------------------------------
- # * Do not modify
- #--------------------------------------------------------------------------
- Autorun = {}
- Parallel = {}
- #--------------------------------------------------------------------------
- # * Decide which common events would autorun without a switch.
- # (Autorun or Parallel)[Common Event ID] = true # => Boolean
- # (Autorun or Parallel)[Common Event ID] = "Condition" # => Boolean
- # (Autorun or Parallel)[Common Event ID] = proc { Condition } # => Boolean
- #--------------------------------------------------------------------------
- #Autorun[0] = true
- #Parallel[1] = proc { $game_variables[18] > 24 and $game_switches[2] }
- #Autorun[1] = "[1,2,18].include?($game_map.map_id)"
- Parallel[1] = true
- #Autorun[2] = proc { Graphics.frame_count % 240 == 0 }
- #--------------------------------------------------------------------------
- # * Do not modify
- #--------------------------------------------------------------------------
- #for i in Autorun.keys
- # Autorun[i] = eval("proc {#{Autorun[i].to_s}}") unless Autorun[i].respond_to?(:call)
- #end
- for i in Parallel.keys
- Parallel[i] = eval("proc {#{Parallel[i].to_s}}") unless Parallel[i].respond_to?(:call)
- end
- end
- end
- =begin
- #==============================================================================#
- # ** Game_Map
- #==============================================================================#
- class Game_Map
- #--------------------------------------------------------------------------
- # * Alias Listings
- #--------------------------------------------------------------------------
- unless method_defined?(:pk8_switchlesscommonev_setup_autorun_common_event)
- alias :pk8_switchlesscommonev_setup_autorun_common_event :setup_autorun_common_event
- end
- #--------------------------------------------------------------------------
- # * Starting Event Setup
- #--------------------------------------------------------------------------
- def setup_autorun_common_event
- # Loop (common events)
- for common_event in $data_common_events.compact
- ppce_c = PK8::Switchless_CommonEvents::Autorun[common_event.id]
- # If Proc exists then check the condition else use default
- return common_event if instance_exec(&ppce_c) if ppce_c
- end
- pk8_switchlesscommonev_setup_autorun_common_event
- end
- end
- =end
- #==============================================================================#
- # ** Game_CommonEvent
- #==============================================================================#
- class Game_CommonEvent
- #--------------------------------------------------------------------------
- # * Alias Listings
- #--------------------------------------------------------------------------
- unless method_defined?(:pk8_switchlesscommonev_active?)
- alias :pk8_switchlesscommonev_active? :active?
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def active?
- ppce_c = PK8::Switchless_CommonEvents::Parallel[@event.id]
- # If Proc exists then check the condition else use default
- ppce_c ? instance_exec(&ppce_c) : pk8_switchlesscommonev_active?
- end
- end
- #==============================================================================#
- # ** DataManager
- #==============================================================================#
- class << DataManager
- #--------------------------------------------------------------------------
- # * Alias Listings
- #--------------------------------------------------------------------------
- unless method_defined?(:pk8_switchlesscommonev_load_normal_database)
- alias :pk8_switchlesscommonev_load_normal_database :load_normal_database
- end
- #--------------------------------------------------------------------------
- # * Load Database : Normal
- #--------------------------------------------------------------------------
- def load_normal_database
- pk8_switchlesscommonev_load_normal_database
- PK8::Switchless_CommonEvents::Autorun.keys.each do |i|
- cmev = $data_common_events[i] ; cmev.trigger = 1; cmev.switch_id = 0
- end
- PK8::Switchless_CommonEvents::Parallel.keys.each do |i|
- cmev = $data_common_events[i] ; cmev.trigger = 2; cmev.switch_id = 0
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment