Kain Nobel
Member
Map : Change Enconters
Version: 3.5
By: Kain Nobel
Introduction
This script allows you further control over random encounters on your map. With it, you'll be able to instantly change the encounter list and encounter steps on any map from any short call script, and it will be active imediately. To revert back to old encounter step and list just set them to nil.
Features
Script
Instructions
Place below SDK (if using) and above Main. No SDK/MACL requirements for this one, should be compatible with most stuffs.
Author's Notes
Just cus I was bored of always fighting Ghosts I guess :/
Terms and Conditions
Free to use in all your work, please credit if you do its the nice thing to do
Version: 3.5
By: Kain Nobel
Introduction
This script allows you further control over random encounters on your map. With it, you'll be able to instantly change the encounter list and encounter steps on any map from any short call script, and it will be active imediately. To revert back to old encounter step and list just set them to nil.
Features
- Modify $game_map.encounter_list
- Modify $game_map.encounter_step
- Custom settings are saved in a hash for easy reference
- Set $game_map.encounter_list to nil to revert back to database settings
- Set $game_map.encounter_step to nil to revert back to database settings
Script
Code:
#===============================================================================
# ** Map : Change Encounters
#===============================================================================
#-------------------------------------------------------------------------------
# * SDK Log
#-------------------------------------------------------------------------------
if Object.const_defined?(:SDK)
SDK.log('Map.ChangeEncounters', 'Kain Nobel ©', 3.5, '2009.06.17')
end
#===============================================================================
# ** Game_Map::Encounter_List
#===============================================================================
class Game_Map::Encounters
#-----------------------------------------------------------------------------
# * Public Instance Variables
#-----------------------------------------------------------------------------
attr_accessor :list
attr_accessor :step
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize
@list = Array.new
@step = nil
end
end
#===============================================================================
# ** Game_Map
#===============================================================================
class Game_Map
#-----------------------------------------------------------------------------
# * Public Instance Variables
#-----------------------------------------------------------------------------
attr_reader :encounters
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :chgencounters_gmmap_setup, :setup
alias_method :chgencounters_gmmap_encounterlist, :encounter_list
alias_method :chgencounters_gmmap_encounterstep, :encounter_step
#-----------------------------------------------------------------------------
# * Setup
#-----------------------------------------------------------------------------
def setup(map_id)
@encounters ||= Hash.new
chgencounters_gmmap_setup(map_id)
@encounters[map_id] ||= Game_Map::Encounters.new
end
#-----------------------------------------------------------------------------
# * Reset Encounters
#-----------------------------------------------------------------------------
def reset_encounters
encounter_list = @map.encounter_list
encounter_step = @map.encounter_step
end
#-----------------------------------------------------------------------------
# * Encounter List
#-----------------------------------------------------------------------------
def encounter_list
old_list = chgencounters_gmmap_encounterlist
unless @encounters[map_id].list.is_a?(Array)
@encounters[map_id].list = old_list
end
@encounters[map_id].list
end
#-----------------------------------------------------------------------------
# * Encounter Step
#-----------------------------------------------------------------------------
def encounter_step
old_step = chgencounters_gmmap_encounterstep
unless @encounters[map_id].step.is_a?(Numeric)
unless @encounters[map_id].step == old_step
@encounters[map_id].step = old_step
$game_player.make_encounter_count
end
end
@encounters[map_id].step
end
#-----------------------------------------------------------------------------
# * Encounter List = (list)
#-----------------------------------------------------------------------------
def encounter_list=(list)
unless list.is_a?(Array)
err = "Wrong argument for changing $game_map.encounter_list\n\nThe argum"
err += "ent must be an :Array: object, not a :#{list.class}:"
raise ArgumentError.new(err)
end
@encounters[map_id].list = list
end
#-----------------------------------------------------------------------------
# * Encounter Step = (step)
#-----------------------------------------------------------------------------
def encounter_step=(step)
unless step.is_a?(Numeric) || step.is_a?(NilClass)
err = "Wrong argument for changing $game_map.encounter_step\n\nThe argum"
err += "ent must be a :Numeric: object, not a :#{step.class}:"
raise ArgumentError.new(err)
end
@encounters[map_id].step = step
$game_player.make_encounter_count
end
end
Instructions
Place below SDK (if using) and above Main. No SDK/MACL requirements for this one, should be compatible with most stuffs.
Author's Notes
Just cus I was bored of always fighting Ghosts I guess :/
Terms and Conditions
Free to use in all your work, please credit if you do its the nice thing to do