+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker XP (RGSS) Engine (https://www.save-point.org/forum-116.html)
+---- Thread: The Wanderers: The Customizable Encounters System (/thread-9002.html)
The Wanderers: The Customizable Encounters System - DerVVulfman - 08-24-2024
The Wanderers
The Customizable Encounters System Version: 1.0
Introduction
For many, the idea of wandering encounters is a staple among RPG games, be it Final Fantasy, Suikoden, Dragon Quest or the like. And the creators of the RPGMaker engine recognized this. However, the enemies encountered per map with RPGMaker line of engines were fixed. Changes were not possible.
The Wanderers fixes this issue. It allows the game developer to define one or more encounter lists per map, and connect these encounters to the basic RPGMaker Variable system. If enemies get stronger after completing quests, a switch can turn on a new encounter list with stronger troops. And if the big bad evil guy in a castle was defeated, another switch can turn on another encounter list that is empty... to ensure no more monsters show up.
Features
Ability to set new encounters per map by way of configured settings:
Encounters can be changed by RPGMaker switches in each encounter set
Each encounter set can have its own set of troops and steps count
If a map has no configured encounter set, the default values are used
BONUS: Revised Game_Switches methods:
Updating game switches will automatically refresh the game map
Updating game switches will automatically refresh encounter rates
Script
The Wanderers
Code:
#==============================================================================
# The Wanderers:
# The Customizable Encounters System
# -------------------------------------------------------------------------
# version 1.0
# by DerVVulfman
# 08-24-2024 (MM-DD-YYYY)
# RGSS / RPGMaker XP
#==============================================================================
#
# INTRODUCTION:
# =============
#
# For many, the idea of wandering encounters is a staple among RPG games, be
# it Final Fantasy, Suikoden, Dragon Quest or the like. And the creators of
# the RPGMaker engine recognized this. However, the enemies encountered per
# map with RPGMaker line of engines were fixed. Changes were not possible.
#
# The Wanderers fixes this issue. It allows the game developer to define one
# or more encounter lists per map, and connect these encounters to the basic
# RPGMaker Variable system. If enemies get stronger after completing quests,
# a switch can turn on a new encounter list with stronger troops. And if the
# big bad evil guy in a castle was defeated, another switch can turn on ano-
# ther encounter list that is empty... to ensure no more monsters show up.
#
#------------------------------------------------------------------------------
#
# FEATURES:
# =========
#
# * Ability to set new encounters per map by way of configured settings:
# * Encounters can be changed by RPGMaker switches in each encounter set
# * Each encounter set can have its own set of troops and steps count
# * If a map has no configured encounter set, the default values are used
# * BONUS: Revised Game_Switches methods:
# * Updating game switches will automatically refresh the game map
# * Updating game switches will automatically refresh encounter rates
#
#
#------------------------------------------------------------------------------
#
# INSTRUCTIONS:
# =============
#
# Paste below Scene Debug and above main.
#
# Paste above KSteps2Doom by Kyonides-Arkanthes if it is in use. The encounter
# rate changes by KSteps2Doom will then function in tandem.
#
# Configure as desired.
#
#
#==============================================================================
#
# COMPATABILITY:
# ==============
#
# Designed for RPGMaker XP.
# Rewrites Game_Switch methods.
# Compatible with KSteps2Doom by Kyonides-Arkanthes.
#
#
#==============================================================================
#
# TERMS and CONDITIONS:
# =====================
#
# Free for use, even in commercial scripts. Due credit to all involved is
# the only requirement.
#
#
#==============================================================================
module Wanderers
#--------------------------------------------------------------------------
MAP = {} # Do Not Touch
#--------------------------------------------------------------------------
# SWITCH SORT FLAG
# ================
# This simple switch determines if the encounters defined further below are
# prioitized by the switch ID, or by the order entered. That is to say, if
# this switch is true, the encounter with the highest 'enabled' switch will
# be the one used. Otherwise, it will fall to the last encounter that has a
# switch enabled.
# -------------------------------------------------------------------------
#
SORT_BY_SW = false
# WANDERERS PER MAP
# =================
# This is the main section to configure, and this script shows how it may
# be used with three built-in examples. The first map configured shows how
# to define five encounter sets that are enabled/disabled by the RPGMaker
# switch system. The second shows that you only need to define encounters
# that override the default map settings when a switch is turned on. And
# the third shows another map configured to handle encounters multiple ways.
#
# Each map defined such as those below, are assigned an array that may hold
# one or more 'encounter set'. And each encounter set is itself an array.
# So yes, you will have arrays within arrays. Remember to separate each of
# the 'encounter set' arrays with commas.
#
# Each encounter list is an array that holds three different parameters: an
# RPGMaker Switch, the Steps per encounter, and an array of troop IDs.
# -------------------------------------------------------------------------
#
# Map ID Sw St Troop IDs
#======= === === =========
MAP[1] = [ [ 0, 10, [1,2] ], # No switch? Ghosts after 10 steps
[ 2, 50, [1,3,3,4] ], # Switch 2: Ghost & Basilisks per 50
[ 3, 2, [7,7,8] ], # Switch 3: Hellhounds per 2 steps
[ 4, 20, [] ], # Switch 4: No Encounters
[ 1, 20, [1,2,3] ] ] # Switch 1: Ghosts & Basilisk per 20
MAP[2] = [ [ 1, 15, [1,1,2] ] ] # Switch 1: Ghosts if switch 1 on
MAP[3] = [ [ 0, 25, [17,17,18]], # No switch? Zombies every 25 steps
[ 2, 20, [] ], # Switch 2: No Encounters
[ 1, 20, [17,18,33]] ] # Switch 1: Zombies and DRACULA?*
# Assumes killing drac turns on sw 2
end
#==============================================================================
# ** Game_Switches
#------------------------------------------------------------------------------
# This class handles switches. It's a wrapper for the built-in class "Array."
# Refer to "$game_switches" for the instance of this class.
#==============================================================================
class Game_Switches
#--------------------------------------------------------------------------
# * Get Switch
# switch_id : switch ID
#--------------------------------------------------------------------------
def [](switch_id)
#
@data[switch_id] || false # Return switch value, or return false
# # on any invalid switch_id supplied
end
#--------------------------------------------------------------------------
# * Set Switch
# switch_id : switch ID
# value : ON (true) / OFF (false)
#--------------------------------------------------------------------------
def []=(switch_id, value)
#
@data[switch_id] = value # Apply the updated switch value
on_change # Trigger on-change method
#
end
#--------------------------------------------------------------------------
# * Processing When Setting Switches
#--------------------------------------------------------------------------
def on_change
#
$game_map.need_refresh = true # Force the game map to refresh
$game_player.make_encounter_count # Update the Encounter Steps count
#
end
end
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# This class handles the map. It includes scrolling and passable determining
# functions. Refer to "$game_map" for the instance of this class.
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias game_map_wandering_encounter_list encounter_list
alias game_map_wandering_encounter_step encounter_step
#--------------------------------------------------------------------------
# * Get Encounter List
#--------------------------------------------------------------------------
def encounter_list
#
list = game_map_wandering_encounter_list # Original method
list = wandering_selection(list) # Get updated list
return list # Exit with troop list
#
end
#--------------------------------------------------------------------------
# * Get Encounter Steps
#--------------------------------------------------------------------------
def encounter_step
#
step = game_map_wandering_encounter_step # Original method
step = wandering_selection(step, true) # Get updated steps
return step # Exit with the steps
#
end
#--------------------------------------------------------------------------
# * Get Encounter List
#--------------------------------------------------------------------------
def wandering_selection(value, type=false)
#
return value unless Wanderers::MAP.has_key?(@map_id)# Exit if no update
#
new_val = nil # Clear returned value
new_list = Wanderers::MAP[@map_id] # Acquire config data
new_list.sort! if Wanderers::SORT_BY_SW # Sort by Switch ID
#
for a_list in new_list # Cycle through...
sw = a_list[0] # Get switch ID
if sw == 0 # If a 'no-switch' ID
new_val = (type) ? a_list[1] : a_list[2] # Get new value
else # If a 'switch' ID
if $game_switches[sw] # if an active switch
new_val = (type) ? a_list[1] : a_list[2] # Get new value
end
end
end
#
value = new_val unless new_val.nil? # Use valid new value
return value # Exit method with value
end
#
end
Instructions
Paste below Scene Debug and above main.
Paste above KSteps2Doom by Kyonides-Arkanthes if it is in use. The encounter rate changes by KSteps2Doom will then function in tandem.
Configure as desired.
Compatibility
Designed for RPGMaker XP.
Rewrites Game_Switch methods.
Compatible with KSteps2Doom by Kyonides-Arkanthes.
Terms and Conditions
Free for use, even in commercial scripts. Due credit to all involved is the only requirement.