03-12-2024, 08:40 PM
(This post was last modified: 03-12-2024, 11:02 PM by DerVVulfman.)
Saumon's Enemy Reveals
Version: 1.0
Version: 1.0
Introduction
This script makes it possible to define enemies within a troop as hidden until revealed during battle. This useful for battles where a boss enemy may be one to summon underlings to fight.
This script makes it possible to define enemies within a troop as hidden This assumes that all enemies are defined within the appropriate Troops page. But once done, it is a simple matter to update the TROOP array in the Saumon_Reveal configuration module.
Script
REVEAL!!!
Code:
#==============================================================================
# ** Saumon's Enemy Reveals
#------------------------------------------------------------------------------
# by DerVVulfman
# version 1.0
# 03-12-2024 (mm/dd/yyyy)
# RGSS / RPGMaker XP
#==============================================================================
#
# INTRODUCTION:
#
# This script makes it possible to define enemies within a troop as hidden
# until revealed during battle. This useful for battles where a boss enemy
# may be one to summon underlings to fight.
#
# This script makes it possible to define enemies within a troop as hidden
# This assumes that all enemies are defined within the appropriate Troops
# page. But once done, it is a simple matter to update the TROOP array in
# the Saumon_Reveal configuration module.
#
#
#------------------------------------------------------------------------------
#
# INSTALLATION:
#
# Place this script below Scene_Debug and above Main. Then configure the
# TROOPS hash array for any battles needed.
#
#
#------------------------------------------------------------------------------
#
# CONFIGURATION:
#
# This is relatively simple.
#
# TROOP[key] = [ collection of enemy/anim arrays ]
#
# Each TROOP entry has a key, this key is the ID of the Troop within the
# RMXP database. Each Troop entry is also assigned an array that has one
# or more enemy/animation arrays within.
#
# TROOP[12] = [ [0,49], [2,16] ]
#
# The above example TROOP entry will alter Troop #12, the battle with three
# Cockatrice. I t will hide the 1st and 3rd (assuming enemy index 0 and 2),
# and give each enemy its own animation when revealed. The first enemy
# will have a 'Darkness 2' animation (49) played while the third enemy will
# play the 'HP Recovery 2' animation when revealed.
#
# DO NOTE: An animation ID must be given. IF you do not wish an enemy to
# have an animation, supply '0' as the animation ID instead.
#
#
#------------------------------------------------------------------------------
#
# SCRIPT CALLS:
#
# There are really only two, and very easy to understand, And the script
# will already recognize which troop is currently in battle.
#
# NOTE: If used in battle with a Troop not defined, they will not work.
#
# * battle_reveal_id(member_index)
# ------------------------------
# This command will reveal a single enemy that has been hidden. It goes
# by the 'member_index' which assumes the first enemy defined within
# the troop is enemy #0. This assumes the order in which the enemies
# are shown and not the ID of the enemy within the Enemy Database.
#
# Ex: battle_reveal_id 1
# This reveals the 2nd enemy in the troop, not the first.
#
#
# * battle_reveal_all
# ------------------
# This command will reveal all currently hidden/concealed enemies defined
# for this troop. If any enemies were previous revealeda and then killed,
# they will not accidentally re-appear.
#
#
#------------------------------------------------------------------------------
#
# COMPATIBILITY:
#
# Fairly compatible for RPGMaker XP systems. It doesn't rewrite any methods
# in the system.
#
#------------------------------------------------------------------------------
#
# CREDITS AND THANKS:
#
# Thanks to Saumon of Save-Point.Org for the simple request.
#
#
#==============================================================================
#
# TERMS OF USE:
#
# Free for use, even in commercial games. Only due credit is required, for
# both myself and Saumon who put forth the request
#
#
#==============================================================================
module Saumon_Reveal
#--------------------------------------------------------------------------
TROOP = {} # Do not touch
#--------------------------------------------------------------------------
# TROOP BY ID LIST OF ENEMY/ANIMs
# =========== =========================
TROOP[1] = [ [0,16] ]
end
#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
# This class handles enemies. It's used within the Game_Troop class
# ($game_troop).
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :member_index # index of enemy within a given troop
end
#==============================================================================
# ** Game_Troop
#------------------------------------------------------------------------------
# This class deals with troops. Refer to "$game_troop" for the instance of
# this class.
#==============================================================================
class Game_Troop
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias game_troop_saumon_reveal_setup setup
#--------------------------------------------------------------------------
# * Setup
# troop_id : troop ID
#--------------------------------------------------------------------------
def setup(troop_id)
#
@troops_hidden_summon = []
#
# Perform the original method
game_troop_saumon_reveal_setup(troop_id)
#
# Exit unless for a defined troop
return unless Saumon_Reveal::TROOP.has_key?(troop_id)
#
# Acquire list of concealed enemies
list = Saumon_Reveal::TROOP[troop_id]
#
for id in list
@troops_hidden_summon.push(id[0])
end
#
# Cycle through enemies
for enemy in list
id = enemy[0]
next if @enemies[id].nil? # Skip if enemy invalid
@enemies[id].hidden = true # Make hidden
@enemies[id].hp = 0 # Erase HP to make untargetable
end
#
end
#--------------------------------------------------------------------------
# * Reveal all enemies within a troop
# troop_id : troop ID
#--------------------------------------------------------------------------
def reveal_all(troop_id)
#
# Exit unless for a defined troop
return unless Saumon_Reveal::TROOP.has_key?(troop_id)
#
# Acquire current troop data
troop = $data_troops[troop_id]
#
# Cycle through entire troop
for enemy_id in 0...troop.members.size
reveal_id(troop_id, enemy_id)
end
#
end
#--------------------------------------------------------------------------
# * Reveal an enemy within a troop by its id
# troop_id : troop ID
# enemy_id : enemy ID
#--------------------------------------------------------------------------
def reveal_id(troop_id, enemy_id)
#
# Exit unless for a defined troop
return unless Saumon_Reveal::TROOP.has_key?(troop_id)
#
# Exit unless enemy is in concealed list
return unless @troops_hidden_summon.include?(enemy_id)
#
# Define default ID push
temp_array = [0,0]
#
# Using configured list...
list = Saumon_Reveal::TROOP[troop_id]
#
# Cycle through the list
for arrays in list
# and define the proper enemy/animation array
temp_array = arrays if arrays[0] == enemy_id
end
#
troop = $data_troops[troop_id] # Get troop data
temp = Game_Enemy.new(troop_id, enemy_id) # Get enemy data from troop
@enemies[enemy_id].hp = temp.hp # Restore health from data
@enemies[enemy_id].hidden = false # Make visible
@troops_hidden_summon.delete(enemy_id) # Erase from list
$scene.reveal_ids.push(temp_array)
end
end
#==============================================================================
# ** Interpreter
#------------------------------------------------------------------------------
# This interpreter runs event commands. This class is used within the
# Game_System class and the Game_Event class.
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# * Reveal all summonnable or concealed enemies
#--------------------------------------------------------------------------
def battle_reveal_all
#
id = $game_temp.battle_troop_id
$game_troop.reveal_all(id)
#
end
#--------------------------------------------------------------------------
# * Reveal summonnable or concealed enemy by ID
# enemy_id : enemy ID
#--------------------------------------------------------------------------
def battle_reveal_id(enemy_id)
#
id = $game_temp.battle_troop_id
$game_troop.reveal_id(id, enemy_id)
#
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :reveal_ids # enemy id/animation combinations
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias scene_battle_saumon_reveal_main main
alias scene_battle_saumon_reveal_setup_battle_event setup_battle_event
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
#
# Create the id/animation combo array
@reveal_ids = []
#
# Perform the original method
scene_battle_saumon_reveal_main
#
end
#--------------------------------------------------------------------------
# * Battle Event Setup
#--------------------------------------------------------------------------
def setup_battle_event
#
# Perform the original method
scene_battle_saumon_reveal_setup_battle_event
#
# Cycle through the id/animation combo array
for id in @reveal_ids
#
# Acquire individual enemy and animations
enemy_id = id[0]
enemy_anim = id[1]
#
# Cycle through current troops
for enemy in $game_troop.enemies
# Skip if stored enemy ID not a match
next unless enemy.member_index == enemy_id
# Apply stored animation to enemy and pop the animation
enemy.animation_id = enemy_anim
enemy.damage_pop = true
end
#
end
#
# Erase the array for the next round/turn
@reveal_ids = []
#
end
end
Instructions
Plenty, and within the script.
Compatibility
Fairly compatible for RPGMaker XP systems. It doesn't rewrite any methods in the system.
Credits and Thanks
Thanks to Saumon of Save-Point.Org for the simple request.
Terms and Conditions
Free for use, even in commercial games. Only due credit is required, for both myself and Saumon who put forth the request
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
Above are clickable links