02-13-2025, 08:49 PM
(This post was last modified: 02-17-2025, 07:45 PM by DerVVulfman.)
The Steal and Peep Script
A Revision of Steal Script by makeamidget & Khatharr
Version: Revisionist Version 1.2
A Revision of Steal Script by makeamidget & Khatharr
Version: Revisionist Version 1.2
Introduction
This script allows the developer to define a skill that allows an actor to steal an item from an enemy target. Further, this script allows the developer to define a skill that permits an actor to scan and reveal an enemy's basic stats within a pop-up screen.
With this script, the items are custom ones that can only be attained by stealing them in combat. The developer may assign a single common (or easy to steal) item and a rare (hard to steal) item. These items aren't defined in the enemy database, so they are not part of the end-of-battle treasure drop system.
Compared to the original, this version is a structural rewrite, containing the basics of the original system, but performing rewrites in a manner to make it more compliant with other scripts. Methods that involved rewrites have been altered to become aliased. New methods and tests have been added and most of the hard-coded vocabulary is now in the configuration page.
Features
- Allows one common and/or one rare item to be stolen per enemy
- Allows the ability to scan/analyze/peep on an enemy to see its stats
- (NEW) Allow for more than one steal and/or peep skill to exist
- (NEW) Allows both steal and peep skills to apply damage
- (NEW) Allows customization of the custom skill/peep damage pop
- (NEW) All text used in windows and damage pops may be configured
- (NEW) Different text shows in the steal window if a damage steal skill used
- (NEW) Able to turn off the after-damage steal window
- (NEW) Able to define armor that can increase/decrease system's stat checks
- Compatible with MultiSlots! by DerVVulfman
- Compatible with Multi-Slot Equipment Script by Guillaume777
- Compatible with MultiSlots! by DerVVulfman
Screenshots
Three presented
![[Image: BAUYNkp.png]](https://i.imgur.com/BAUYNkp.png)
A damage pop you can customize, shown here with a Georgia font, Boldfaced, and Italicized
![[Image: j2JJPjg.png]](https://i.imgur.com/j2JJPjg.png)
A Steal window pop-up screen. It 'can' be turned off now.
![[Image: Y4MZmJ5.png]](https://i.imgur.com/Y4MZmJ5.png)
The Peep window. Indeed, you can now make a peep or steal skill apply damage too.
Demo
None
Script
Introduction Header Page (important)
Code:
#==============================================================================
# ** The Steal and Peep Script
# A Revision of Steal Script by makeamidget & Khatharr
#------------------------------------------------------------------------------
# Revisionist Version 1.2
# Edit by DerVVulfman
# 02-16-2026 (MM-DD-YYYY)
# RGSS / RPGMaker XP
#==============================================================================
# > INTRODUCTION AND HEADER PAGE <
# > IF YOU DON'T READ THIS, SHADDUP! <
#==============================================================================
#
#
# INTRODUCTION:
# =============
# This script allows the developer to define a skill that allows an actor to
# steal an item from an enemy target. Further, this script allows the deve-
# loper to define a skill that permits an actor to scan and reveal an enemy's
# basic stats within a pop-up screen.
#
# With this script, the items are custom ones that can only be attained by
# stealing them in combat. The developer may assign a single common (or easy
# to steal) item and a rare (hard to steal) item. These items aren't defined
# in the enemy database, so they are not part of the end-of-battle treasure
# drop system.
#
# Compared to the original, this version is a structural rewrite, containing
# the basics of the original system, but performing rewrites in a manner to
# make it more compliant with other scripts. Methods that involved rewrites
# have been altered to become aliased. New methods and tests have been added
# and most of the hard-coded vocabularly is now in the configuration page.
#
#
#
# FEATURES:
# =========
# * Allows one common and/or one rare item to be stolen per enemy
# * Allows the ability to scan/analyze/peep on an enemy to see its stats
# * (NEW) Allow for more than one steal and/or peep skill to exist
# * (NEW) Allows both steal and peep skills to apply damage
# * (NEW) Allows customization of the custom skill/peep damage pop
# * (NEW) All text used in windows and damage pops may be configured
# * (NEW) Different text shows in the steal window if a damage steal skill used
# * (NEW) Able to turn off the after-damage steal window
# * (NEW) Able to define armor that can increase/decrease system's stat checks
# - Compatible with MultiSlots! by DerVVulfman
# - Compatible with Multi-Slot Equipment Script by Guillaume777
#
#
#
# FORMULAS:
# =========
# Because steal and peep skills may be tied to skills that apply damage, the
# chance to steal and/or peep are still hardwired and not something that may
# be edited within the Skills Database.
#
# The basic chance to steal an item from an enemy:
# 100 - (8 * self.agi / attacker.dex + self.eva)
# The chance of a stolen item being rare (same as a critical hit):
# 4 * attacker.dex / self.agi
# The chance to peep:
# 100 - (100 * [self.mdef - user.agi,0].max) / self.mdef - user.agi))
#
# In general, an actor/attacker wants a high dexterity to steal, and a high
# agility to snag a rare item or peep on en enemy's stats.
#
# And in general, an enemy wants a high agility and evasion rate to avoid
# having items stolen and a high mdef score to avoid being peeped.
#
# Because of the new ARMORS system, additional bonues or penalties may be
# added to the actor's dexterity and/or agility scores before calculated.
#
#
#
# IMPORTANT:
# ==========
# For the display of the peep window and the secondary stolen item window
# that appears after an attack, the steal and/or peep skill must include a
# target animation. This target animation may be something along the lines
# of "097-EM Question" or "004-Hit". Without a target animation,these two
# windows will NOT appear.
#
# HOWEVER... one can define an empty target animation (no sound effects or
# animation graphic file applied). This can trick the system to trigger the
# peep and steal windows to appear.
#
#
# And now... words from the original authors:
#
#
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# Well, here we are. We made a script. It does stuff. If you HAVE to,
# well.... I suppose we can let you use it. Just don't go thinkin' that we're
# generous or something, 'cuz.... Well, things could get messy....
#
# Anyway, if you screw this thing up, don't come cryin' to us, because for the
# most part, we haven't got a clue how the hell it works. We just wrote what
# the aliens told us to, so figure it out.
#
# In the meantime, I'd like to give a shout-out to Zoe Saldana, because I want
# to make babies with her, and also to Amy Lee, for the same reason.
#
# (Urggghhh... Choices....)
#
# I'd also be remiss if I didn't recognize the fine work of Solomon,
# when he said,
#
# Your two breasts are like two
# fawns,
# like twin fawns of a gazelle
# that browse among the lilies.
# (Song of Songs 4:5)
#
# Because I plan to use that line to get either Zoe or Amy to be
# my l-l-l-ladaaaay.
# Thanx you. Bye-bye.
#
# -Khat
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# In case you don't know us, we're both pretty new... and well... we decided
# to give this RGSS thing a whirl.. see what all the fuss was about and all
# that and for the most part we are largely unimpressed.. why anyone would
# want to do something like this is beyond us... i shall now try to think of
# a reason why... *thinking*... nope i'm just drawing a blank... and what
# Khatharr doesn't know is that Amy Lee has already been claimed by your's
# truly... as has Maggie Gyllenhaal.. she is an inspiration to us all..
#
# and for those who aren't inspired by her.. they.. uh.. should be... anyway...
# uh enjoy this and stuff.. it's great and cool... or something. i don't know.
# i'm tired...
#
# Enjoy.. or not.. it's you're choice really...
#
# -Midge-
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Back off my kool-aid, yo! -K
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# Some of the flavourful comments by both Khatarr and makeamidget have been
# added to the engine code for kicks. Otherwise, its pretty standard fare.
#
#==============================================================================
#
# COMPATABILITY:
# ==============
#
# Designed for RPGMaker XP.
#
#
#==============================================================================
#
# TERMS and CONDITIONS:
# =====================
#
# Free for use, even in commercial scripts. However, I require due credit for
# myself, Khatharr, makeamidget & Ace_V who asked for the damage-based options.
#
#
#==============================================================================
Configuration Page
Code:
#==============================================================================
# ** The Steal and Peep Script
# A Revision of Steal Script by makeamidget & Khatharr
#------------------------------------------------------------------------------
# Revisionist Version 1.2
# Edit by DerVVulfman
# 02-16-2026 (MM-DD-YYYY)
# RGSS / RPGMaker XP
#==============================================================================
# > CONFIGURATION PAGE <
#==============================================================================
#==============================================================================
# ** MM_Steal
#------------------------------------------------------------------------------
# This is a module that defines values and methods unique for the in-combat
# theft and enemy scanning skill system.
#==============================================================================
module MM_Steal
#--------------------------------------------------------------------------
COMMON, RARE, ARMOR = {}, {}, {} # Do Not Touch
#--------------------------------------------------------------------------
# GENERAL VALUES
# ==============
# These values define the basic values used to define steal and peep skills,
# and how the system behaves when encountered.
#--------------------------------------------------------------------------
#
# Steal system values
STEAL_ID = [81,83] # IDs of skills that also perform steal
STEAL_WINDOW = true # If the secondary Steal Window is shown
STEAL_DURATION = 65 # Duration of the Steal Window on screen
# Peep system values
PEEP_ID = [82,84] # IDs of skills that also perform peep
PEEP_IMMUNE = [3,5,31] # IDs of enemies that cannot be peeped
# DAMAGE POP APPEARANCE
# =====================
# These values define the appearance of the secondary damage pop that has
# been added to display peep and steal action results.
#--------------------------------------------------------------------------
#
# Basic appearance values
POP_FONT_NAME = "Arial Black" # Font used for the damage pop
POP_FONT_SIZE = 32 # Size of the damage pop font
POP_FONT_BOLD = false # Whether the pop is boldfaced
POP_FONT_ITALIC = false # Whether the pop is italicized
# Enemy steal-related colors
ENEMY_POP_COLOR = [255,255,255] # White text for enemy pop
ENEMY_POP_BORDER = [100,100,250] # Blue border for enemy pop
# Actor steal-related colors
ACTOR_POP_COLOR = [255,255,255] # White text for actor pop
ACTOR_POP_BORDER = [100,250,100] # Green border for enemy pop
# VOCABULARY
# ==========
# These values define the text that appears throughout the system. It is
# defined here for both language options and personal tastes.
#--------------------------------------------------------------------------
#
# Steal related damage pops
STEAL_EMPTY_TEXT = "No item to steal!" # Text if no items to steal
STEAL_POP_FAIL = "You Missed! Chump!" # Text on a failed theft
STEAL_RARE_FAIL = "Being stingy!" # Text on a failed rare theft
# Peep related damage pops
PEEP_IMMUNE_TEXT = "No Data Available" # Window Text if enemy immune
PEEP_POP = "Peeper!" # Text on a successful peep
PEEP_IMMUNE_POP = "Immune" # Text on an immune peep
PEEP_POP_FAIL = "Failed to Peep" # Text on a failed peep
#--------------------------------------------------------------------------
#
# After-attack Steal Window : (If no damage)
STEAL_ACTION_COMMON = " stole a " # The basic non-tamage text
STEAL_REACTION_COMMON = " from " # when stealing a common item
STEAL_ACTION_RARE = " wrestled a " # The basic non-tamage text
STEAL_REACTION_RARE = " away from " # when stealing a rare item
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# After-attack Steal Window : (If damage applied)
STEAL_ACTION_DMG_COMMON = " mugged " # Text shown when attacking and
STEAL_REACTION_DMG_COMMON = " for a " # stealing a common item
STEAL_ACTION_DMG_RARE = " assaulted " # Text shown when attacking and
STEAL_REACTION_DMG_RARE = " for a " # stealing a rare item
#--------------------------------------------------------------------------
# After-attack Peep Window (headings for each item shown)
PEEP_NAME = "Name" # The enemy's name
PEEP_EXP = "Exp" # The header to the exp points
PEEP_STATES = "Current Status" # The header for its states
PEEP_COMMON = "Common Steal" # The header for common items
PEEP_RARE = "Rare Steal" # The header for rare items
PEEP_NORM = "Normal" # Shown if no status effects
PEEP_NONE = "None" # Shown when no item to steal
#
#--------------------------------------------------------------------------
# NOTE: The Steal Window that appears after the initial attack displays
# the message in two different formats: no-damage and damage.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# IF no damage:
# FORMAT: (attacker) "STEAL_ACTION" (item) "STEAL REACTION" (victim) "."
# APPLIED: (Aluxes) ' stole a ' (Knife) ' from ' (Troll).
# RESULT: Aluxes stole a Knife from Troll.
#
# IF damage applied:
# FORMAT: (attacker) "STEAL_ACTION" (target) "STEAL REACTION" (item) "."
# APPLIED: (Aluxes) ' mugged a ' (Troll) ' for a ' (Potion).
# RESULT: Aluxes mugged a Troll for a Potion.
#--------------------------------------------------------------------------
# TARGET ITEMS
# ============
# These hash arrays allows one to define a custom 'common' item and a custom
# 'rare' item that can be stolen from an enemy. No more than one common and
# one rare item is possible per enemy, and they are not included within the
# after-battle treasure drops.
#
# The chance to steal rare items (if exist) uses the same calculations as
# the default "Critical Hit" formula.
#
# SYNTAX: COMMON[enemy_id] = [type*, item_id]
# * whereby type is (0)item, (1)weapon, or (2) armor
#--------------------------------------------------------------------------
#
COMMON[1] = [0,1] # Assume Ghost: Item(0) is Potion(1)
COMMON[31] = [0,3] # Assume Diabolos: Item(0) is Full Potion(3)
RARE[1] = [0,2] # Assume Ghost: Item(0) is High Potion(2)
RARE[31] = [1,4] # Assume Diabolos: Weapon(1) is Mythril Sword(4)
# SKILL ARMOR
# ===========
# These hash arrays allows you to give a bonus or penalty to worn armor that
# specifically affects a steal or peep effect.
#
# SYNTAX: ARMOR[armor_id] = [steal)bonus, peep_bonus]
#--------------------------------------------------------------------------
#
ARMOR[5] = [ 0,-10] # The default helmets are 5-8
ARMOR[6] = [ 0,-10] # I made it a -10 to their agility check
ARMOR[7] = [ 0,-10] # when trying to 'peep' on an enemy. There
ARMOR[8] = [ 0, -5] # is a -5 for Mythril... just because
# Custom items I added in my database (for testing)
ARMOR[33] = [10, 0] # Thief Gloves: Gives +10 to wearer's dex for steals
ARMOR[34] = [ 0, 5] # Peep Shades: Gives +5 to wearer's agi for peeps
end
Main Engine Page
Code:
#==============================================================================
# ** The Steal and Peep Script
# A Revision of Steal Script by makeamidget & Khatharr
#------------------------------------------------------------------------------
# Revisionist Version 1.2
# Edit by DerVVulfman
# 02-16-2026 (MM-DD-YYYY)
# RGSS / RPGMaker XP
#==============================================================================
# > ENGINE <
# > TOUCH IT AND DIE <
#==============================================================================
#
#------------------------------------------------------------------------------
# And now... words from the original authors:
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# -- OFFICIAL NON-MONKEYING SECTION --
# The crap in this section should not really be messed with unless you know
# what you're doing. I commented some of it, but large chucks of it I did not.
# So there.
#
# Anyhoo, below this comment lies the black, cold heart of the code. You can
# play around with it, but if you screw up something DOWN THERE, well....
#
# I for one will not be providing support for this beast unless a bug is found.
# So save us all a load of heart-ache and back-up your project before doing ANY
# script work, okay? We're all tired of seeing:
#
# "I put a script and now RPG Maker don't start!"
#
# Back up your work!!!! That's what winrar is for!!!! Aieeeeeeeeeeeeeee!!!!!
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# I can't think of any reason why any of this would need to be modified.. so
# just save everyone the trouble of you creating problems that might need some
# help to fix.. and don't mess with it thank you, and yea! back up your work..
#
# ...or else...!
#
#==============================================================================
#==============================================================================
# ** MM_Steal
#------------------------------------------------------------------------------
# This is a module that defines values and methods unique for the in-combat
# theft and enemy scanning skill system.
#==============================================================================
module MM_Steal
# Permit methods defined below to be accessible outside this module
module_function
#--------------------------------------------------------------------------
# * Get name of stolen item
# type : type of item (Item/Weapon/Armor)
# id : ID of item
#--------------------------------------------------------------------------
def steal_item_name(type, id)
#
# Branch on type of item
case type
when 1 ; $data_weapons[id].name # Method returns a weapon's name
when 2 ; $data_armors[id].name # Method returns an armor's name
else ; $data_items[id].name # Method returns an item's name
end
#
end
#--------------------------------------------------------------------------
# * Get name of stolen item's icon
# type : type of item (Item/Weapon/Armor)
# id : ID of item
#--------------------------------------------------------------------------
def steal_item_icon_name(type, id)
#
# Branch on type of item
case type
when 1 ; $data_weapons[id].icon_name # Method returns a weapon icon name
when 2 ; $data_armors[id].icon_name # Method returns an armor icon name
else ; $data_items[id].icon_name # Method returns an item icon name
end
#
end
#--------------------------------------------------------------------------
# * Get bitmap of stolen item's icon
# item_type : item type (Item/Weapon/Armor)
# item_id : item ID
#--------------------------------------------------------------------------
def steal_item_icon_bitmap(item_type, item_id)
#
# Branch on type to get bitmap of item specified
case item_type
when 1 ; bitmap = RPG::Cache.icon($data_weapons[item_id].icon_name)
when 2 ; bitmap = RPG::Cache.icon($data_armors[item_id].icon_name)
else ; bitmap = RPG::Cache.icon($data_items[item_id].icon_name)
end
#
# Exit method with bitmap
return bitmap
#
end
#--------------------------------------------------------------------------
# * Get stat bonus for equipped gear
# user : user/attacker actor
# peep : if the peep bonus is retrieved (steal by default)
#--------------------------------------------------------------------------
def steal_gear(user, peep=false)
#
# Clear/reset bonus value for calculation
bonus = 0
#
# Define which steal/peep parameter
param = 0
param = 1 if peep == true
#
# Define armors for testing (includes MultiSlots)
armors = steal_gear_armor_default(user)
armors = steal_gear_armor_mslots(user) if Object.const_defined?(:MSlots)
armors = steal_gear_armor_g7slot(user) if Object.const_defined?(:G7_MS_MOD)
#
# Cycle through all armors
for id in armors
# Add all cumulative bonus points for an actor
bonus += MM_Steal::ARMOR[id][param] if MM_Steal::ARMOR.has_key?(id)
end
#
# Exit method with cumulative points
return bonus
#
end
#--------------------------------------------------------------------------
# * Get armor for stat bonus test
# user : user/attacker actor
#--------------------------------------------------------------------------
def steal_gear_armor_default(user)
armors = [user.armor1_id, user.armor2_id, user.armor3_id, user.armor4_id]
end
#--------------------------------------------------------------------------
# * Get armor for stat bonus test when using MultiSlots
# user : user/attacker actor
#--------------------------------------------------------------------------
def steal_gear_armor_mslots(user)
user.armor_id
end
#--------------------------------------------------------------------------
# * Get armor for stat bonus test when using Guillaume777's Multi-Slot
# user : user/attacker actor
#--------------------------------------------------------------------------
def steal_gear_armor_g7slot(user)
user.armor_ids
end
end
#==============================================================================
# ** RPG::Sprite
#------------------------------------------------------------------------------
# This is a class within the RPGXP module itself that loads each of RPGXP's
# graphic formats, creates a Bitmap object, and retains it.
#==============================================================================
class RPG::Sprite < ::Sprite
#--------------------------------------------------------------------------
# * Alias Listings (with F12 anti-Stack protection)
#--------------------------------------------------------------------------
if @steelpeeper_rpgsprite_f12.nil?
#
@steelpeeper_rpgsprite_f12 = true
alias rpg_sprite_stealpeeper_initialize initialize
alias rpg_sprite_stealpeeper_dispose dispose
alias rpg_sprite_stealpeeper_effect? effect?
alias rpg_sprite_stealpeeper_update update
#
end
#--------------------------------------------------------------------------
# * Object Initialization
# viewport : viewport
#--------------------------------------------------------------------------
def initialize(viewport = nil)
#
# Perform the original method and its superclass call
rpg_sprite_stealpeeper_initialize(viewport)
#
# Create/Set the duration to 0
@_steal_damage_duration = 0
#
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
#
# Clear the steal damage pop
dispose_steal_damage
#
# Perform the original method and its super
rpg_sprite_stealpeeper_dispose
#
end
#--------------------------------------------------------------------------
# * Get if effect is functioning
#--------------------------------------------------------------------------
def effect?
#
# Return with value from the original method or steal damage duration
rpg_sprite_stealpeeper_effect? or @_steal_damage_duration > 0
#
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
#
# Perform the original Method
rpg_sprite_stealpeeper_update
#
# Update the steal pop
update_steal_duration
#
end
#--------------------------------------------------------------------------
# * Steal Damage Pop
# value : hp damage value
# icon : stolen item icon
# battler : battler
#--------------------------------------------------------------------------
def steal_damage(value, icon=nil, battler=nil)
#
# Obtain pop configuration values
pop_font_name = MM_Steal::POP_FONT_NAME
pop_font_size = MM_Steal::POP_FONT_SIZE
pop_font_bold = MM_Steal::POP_FONT_BOLD
pop_font_italic = MM_Steal::POP_FONT_ITALIC
txt_pop_e_r = MM_Steal::ENEMY_POP_COLOR[0]
txt_pop_e_g = MM_Steal::ENEMY_POP_COLOR[1]
txt_pop_e_b = MM_Steal::ENEMY_POP_COLOR[2]
bdr_pop_e_r = MM_Steal::ENEMY_POP_BORDER[0]
bdr_pop_e_g = MM_Steal::ENEMY_POP_BORDER[1]
bdr_pop_e_b = MM_Steal::ENEMY_POP_BORDER[2]
txt_pop_a_r = MM_Steal::ACTOR_POP_COLOR[0]
txt_pop_a_g = MM_Steal::ACTOR_POP_COLOR[1]
txt_pop_a_b = MM_Steal::ACTOR_POP_COLOR[2]
bdr_pop_a_r = MM_Steal::ACTOR_POP_BORDER[0]
bdr_pop_a_g = MM_Steal::ACTOR_POP_BORDER[1]
bdr_pop_a_b = MM_Steal::ACTOR_POP_BORDER[2]
#
# Clear and reset if needed
dispose_steal_damage
#
# Obtain text from value
damage_string = value.to_s
#
# Set the bitmap (area, font, size, bold and italics)
bitmap = Bitmap.new(180, 48)
bitmap.font.name = pop_font_name
bitmap.font.size = pop_font_size
bitmap.font.bold = pop_font_bold
bitmap.font.italic = pop_font_italic
#
# Define outline color, normal or based on actor/enemy battler supplied
bitmap.font.color.set(0,0,0)
unless battler.nil?
if battler.is_a?(Game_Enemy)
bitmap.font.color.set(bdr_pop_e_r, bdr_pop_e_g, bdr_pop_e_b)
else
bitmap.font.color.set(bdr_pop_a_r, bdr_pop_a_g, bdr_pop_a_b)
end
end
#
# Set coordinates for damage string
x1 = 0 # Damage string - no icon
x2 = -1 # Damage string (left edge outline x)
x3 = 1 # Damage string (right edge outline x)
wd = 180 # Width of text - no icon in use
#
unless icon.nil?
#
# Acquire graphic for stolen item icon
iconbmp = RPG::Cache.icon(icon)
#
# Calculate width of text and icon placement size cut in half
size = [((bitmap.text_size(damage_string).width / 2) + 12), 90].min
#
# Additional calculations
icon_x = 90-size # X Coord of icon relative to center
x1 = 24 + icon_x # Damage string - accounting for icon
x2 = 24 + icon_x - 1 # Damage string (left edge outline x)
x3 = 24 + icon_x + 1 # Damage string (right edge outline x)
wd = 180 - 24 - (icon_x * 2) # Width of text accounting for icon
#
# Blit the icon into the bitmap
bitmap.blt(90 - size, 4, iconbmp, Rect.new(0,0,24,24))
#
end
#
# Draw Text for rendered outline
bitmap.draw_text(x2, -1, wd, 36, damage_string, 1) # Altered coords
bitmap.draw_text(x3, -1, wd, 36, damage_string, 1) # for outlined text
bitmap.draw_text(x2, 1, wd, 36, damage_string, 1) # with icon added
bitmap.draw_text(x3, 1, wd, 36, damage_string, 1)
#
# Define outline color, normal or based on actor/enemy battler supplied
bitmap.font.color.set(255,255,255)
unless battler.nil?
if battler.is_a?(Game_Enemy)
bitmap.font.color.set(txt_pop_e_r, txt_pop_e_g, txt_pop_e_b)
else
bitmap.font.color.set(txt_pop_a_r, txt_pop_a_g, txt_pop_a_b)
end
end
#
# Draw the Damage Pop
bitmap.draw_text(x1, 0, wd, 36, damage_string, 1)
#
# Create the Steal Damage Sprite in the viewport
@_steal_damage_sprite = ::Sprite.new(self.viewport)
@_steal_damage_sprite.bitmap = bitmap
@_steal_damage_sprite.ox = 90
@_steal_damage_sprite.oy = 20
@_steal_damage_sprite.x = self.x
@_steal_damage_sprite.y = self.y - self.oy / 2
@_steal_damage_sprite.y += 32
@_steal_damage_sprite.z = 3000
@_steal_damage_duration = 40
#
end
#--------------------------------------------------------------------------
# * Dispose Steal Damage Pop
#--------------------------------------------------------------------------
def dispose_steal_damage
#
# Exit if already disposed
return if @_steal_damage_sprite.nil?
#
# Clear out all values including pop duration
@_steal_damage_sprite.bitmap.dispose
@_steal_damage_sprite.dispose
@_steal_damage_sprite = nil
@_steal_damage_duration = 0
#
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update_steal_duration
#
# Exit method unless there is a duration
return unless @_steal_damage_duration > 0
#
# Reduce duration by 1
@_steal_damage_duration -= 1
#
# Branch and adjust coordinates by duration lapse
case @_steal_damage_duration
when 38..39 ; @_steal_damage_sprite.y -= 4
when 36..37 ; @_steal_damage_sprite.y -= 2
when 34..35 ; @_steal_damage_sprite.y += 2
when 28..33 ; @_steal_damage_sprite.y += 4
end
#
# Set opacity based on duration
@_steal_damage_sprite.opacity = 256 - (12 - @_steal_damage_duration) * 32
#
# Exit method unless duration had ended
return unless @_steal_damage_duration == 0
#
# Set the pop, and clear/reset the steal damage sprite
$scene.pop_done = true
dispose_steal_damage
#
# Bring up the peep window and clear values for valid enemy peep target
if ($peep != nil) and (self.battler.is_a?(Game_Enemy))
@super_mario_rpg = Window_Peep.new($peep, $peep_miss)
$peep = nil
end
#
end
end
#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
# This class deals with battlers. It's used as a superclass for the Game_Actor
# and Game_Enemy classes.
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :steal_icon # Save the icon of the stolen item
attr_accessor :steal_damage # steal or peep damage text
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias game_battler_stealpeeper_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
#
# Perform the original method
game_battler_stealpeeper_initialize
#
# Add value for the stolen items
@steal_icon = nil
@steal_damage = nil
#
end
end
#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
# This class handles enemies. It's used within the Game_Troop class
# ($game_troop).
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias game_enemy_stealpeeper_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
# troop_id : troop ID
# member_index : troop member index
#--------------------------------------------------------------------------
def initialize(troop_id, member_index)
#
# Perform the original method
game_enemy_stealpeeper_initialize(troop_id, member_index)
#
# Add values that determine if items are/aren't stolen & set peep immunity
@stolen = (steal_item_id == 0) # Mark common items held as not stolen
@stolen_rare = (steal_rare_id == 0) # Mark rare items held as not stolen
#
end
#--------------------------------------------------------------------------
# * Apply Skill Effects
# user : the one using skills (battler)
# skill : skill
#--------------------------------------------------------------------------
def skill_effect(user, skill)
#
# Execute custom steal or peep effects
skill_effect_stealpeep(user, skill)
#
# Exit with superclass method
return super(user, skill)
#
end
#--------------------------------------------------------------------------
# * Apply Steal and Peep Effects for Skill
# user : the one using skills (battler)
# skill : skill
#--------------------------------------------------------------------------
def skill_effect_stealpeep(user, skill)
#
# Reset both before proceeding
self.steal_icon = nil
self.steal_damage = nil
#
# Perform action if flagged a peep skill
if MM_Steal::PEEP_ID.include?(skill.id)
super_squirrel = peep_attempt(user) # Test the peep
if super_squirrel # On successful Peep
if MM_Steal::PEEP_IMMUNE.include?(self.id) # If immune
self.steal_damage = MM_Steal::PEEP_IMMUNE_POP # Apply Immune Pop
$peep_miss = true # Peep miss flag ON
else # - but if not immune
$peep_miss = false # Peep miss flag OFF
end
$peep = self # Set the peep target
end
end
#
# Perform action if flagged a steal skill
if MM_Steal::STEAL_ID.include?(skill.id)
tempything = steal_attempt(user) # Test the steal
unless tempything == 0 # On successful steal
$scene.steal_source = user.name # Set the thief name
$scene.steal_target = self.name # Set the target name
end
return # Exit method
end
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# P.S. - I know I'm generally the wierdo of the group, but I swear to you
# that "super_squirrel" is a makeamidget invention. I tend to stick to
# normal variable names, like "poop" and "butthole", etc. -K
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# It's true... maybe... actually i can't remember.. but it is in one of my
# sections.. so it's probobly true (If you're the wierdo then what does
# that make me?) -Midge-
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
end
#--------------------------------------------------------------------------
# * Get peep success by actor
#--------------------------------------------------------------------------
def peep_attempt(user)
#
# Update input information
Input.update
#
# Calculate user's agility including gear bonues
user_agi = user.agi + MM_Steal.steal_gear(user, true)
#
# Determine enemy's defense against attacker's agility
defense_max = [(self.mdef.to_f - user_agi.to_f), 0].max
defense_cur = (self.mdef.to_f + user_agi.to_f).to_i
#
# Perform if actor fails to peep against defending enemy
if rand(100) >= (100 - (100 * defense_max / defense_cur))
self.steal_damage = MM_Steal::PEEP_POP_FAIL
return false
end
#
# Apply peep pop text
self.steal_damage = MM_Steal::PEEP_POP
#
# Exit with actor peep success
return true
#
end
#--------------------------------------------------------------------------
# * Determine steal attempt success
# attacker : actor attacker
#--------------------------------------------------------------------------
def steal_attempt(attacker)
#
# Exit with pop if stealing impossible (no items left)
if steal_impossible?
@steal_damage = MM_Steal::STEAL_EMPTY_TEXT
return 0
end
#
# Calculate attacker's dexterity including gear bonues
attacker_dex = attacker.dex + MM_Steal.steal_gear(attacker)
#
# Calculate chance values for steal skill
steal_chance_calc = 100 - (8 * self.agi / attacker_dex + self.eva)
critical_hit_calc = 4 * attacker_dex / self.agi
critical_roll = rand(100)
#
# Determine if theft successful based on calculations or inability to evade
effective = false
effective = (rand(100) < attacker.hit) and (rand(100) < steal_chance_calc)
effective = true if self.cant_evade?
temporary = 0
#
# If stealing an item
if effective
#
# Perform rare item theft on a critical hit (and rare item not stolen)
if critical_roll < critical_hit_calc
temporary = steal(true, attacker) unless @stolen_rare
end
#
# Go after common item if rare stealing failed and common item exists
if !@stolen && temporary == 0
temporary = steal(false, attacker)
end
#
# Handle pops on failed theft
if temporary == 0
#
# General failure
@steal_damage = MM_Steal::STEAL_POP_FAIL
# Failed to steal rare item while it exists
if MM_Steal::RARE.has_key?(@enemy_id) && !@stolen_rare
@steal_damage = MM_Steal::STEAL_RARE_FAIL
end
#
end
#
# Exit method with successfully stolen item data, or 0 if failed
return temporary
end
#
# Set damage pop for failed attempts to steal
@steal_damage = MM_Steal::STEAL_POP_FAIL
return 0
#
end
#--------------------------------------------------------------------------
# * Steal item and set flags and pops
# rare :
# attacker :
#--------------------------------------------------------------------------
def steal(rare, attacker)
#
# Steal item based on rare or common flag
temp_array = (rare) ? steal_rare_id(true) : steal_item_id
#
# Exit if nothing stolen
return 0 if temp_array.nil?
#
# Split array and gain item defined
item_type = temp_array[0]
item_id = temp_array[1]
steal_item_type_gain(item_type, item_id)
#
# Pass flags into Battle System accessible scene values
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Ghetto pass! Woohah! This ghetto pass brought to you in part by Khatharr
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$scene.steal_rare = rare
$scene.steal_item_id = item_id
$scene.steal_item_type = item_type
#
# Steal item based on rare or common flag
if rare
@stolen_rare = true
else
@stolen = true
end
#
# Set damage pop text and icon based on item
dmg_text = MM_Steal.steal_item_name(item_type, item_id)
dmg_icon = MM_Steal.steal_item_icon_name(item_type, item_id)
#
# Apply rare suffix if needed
dmg_text += " (rare)" if rare
#
# Apply to both enemy and actor attacker
self.steal_damage = attacker.steal_damage = dmg_text
self.steal_icon = attacker.steal_icon = dmg_icon
#
# Exit with damage
return self.steal_damage
#
end
#--------------------------------------------------------------------------
# * Get if stealing is impossible
#--------------------------------------------------------------------------
def steal_impossible?
#
# Test if impossible to steal common item
test1 = false
test1 = true if !MM_Steal::COMMON.has_key?(@enemy_id)
test1 = true if MM_Steal::COMMON.has_key?(@enemy_id) && @stolen
#
# Test if impossible to steal rare item
test2 = false
test2 = true if !MM_Steal::RARE.has_key?(@enemy_id)
test2 = true if MM_Steal::RARE.has_key?(@enemy_id) && @stolen_rare
#
# return theft impossible if both true
return true if test1 && test2
# return theft possible
return false
#
end
#--------------------------------------------------------------------------
# * Get stolen item from enemy
#--------------------------------------------------------------------------
def steal_item_id
#
return nil if @stolen
#
id = @enemy_id
temp = nil
temp = MM_Steal::COMMON[id] if MM_Steal::COMMON.has_key?(id)
return temp
#
end
#--------------------------------------------------------------------------
# * Get rare item from enemy
# drop_rare :
#--------------------------------------------------------------------------
def steal_rare_id(drop_rare = false)
#
return steal_rare_option(drop_rare) if @stolen_rare
#
id = @enemy_id
temp = nil
temp = MM_Steal::RARE[id] if MM_Steal::RARE.has_key?(id)
return temp
#
end
#--------------------------------------------------------------------------
# * Get common item if rare item unavailable
# drop_rare :
#--------------------------------------------------------------------------
def steal_rare_option(drop_rare = false)
#
return steal_item_id if drop_rare
return nil
#
end
#--------------------------------------------------------------------------
# * Gain stolen item
# type : type of item (Item/Weapon/Armor)
# id : ID of item
#--------------------------------------------------------------------------
def steal_item_type_gain(type, id)
#
case type
when 1 ; $game_party.gain_weapon(id, 1)
when 2 ; $game_party.gain_armor(id, 1)
else ; $game_party.gain_item(id, 1)
end
#
end
end
#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
# This sprite is used to display the battler.It observes the Game_Character
# class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# * Alias Listings (with F12 anti-Stack protection)
#--------------------------------------------------------------------------
if @steelpeeper_sprite_battler_f12.nil?
@steelpeeper_sprite_battler_f12 = true
alias sprite_battler_stealpeeper_update update
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
#
# Determine if there is a damage pop at start
pop_steal_flag = @battler.damage_pop
#
# Obtain damage pop values including icon
if @battler.damage_pop
# Remove "Miss" if steal damage exists
if @battler.damage == "Miss" && @battler.steal_damage != nil
@battler.damage = ""
end
steal_damage = @battler.steal_damage
steal_icon = @battler.steal_icon
steal_battler = (steal_icon.nil?) ? nil : @battler
end
#
# Perform the original method
sprite_battler_stealpeeper_update
#
# If the pop was indeed valid
if pop_steal_flag
# Perform the updated damage pop and clear the values
steal_damage(steal_damage, steal_icon, steal_battler)
@battler.steal_damage = nil
@battler.steal_icon = nil
pop_steal_flag = false
end
#
end
end
#==============================================================================
# ** Window_Steal
#------------------------------------------------------------------------------
# This window class contains cursor movement and scroll functions.
#==============================================================================
class Window_Steal < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :done # done
#--------------------------------------------------------------------------
# * Object Initialization
# source : actor stealing the item
# damage : actor applying damage while stealing
# item_type : item type (Item/Weapon/Armor)
# item_id : item ID
# target : target of theft
# rare : (optional) if item is rare
#--------------------------------------------------------------------------
def initialize(source, damage, item_type, item_id, target, rare=false)
#
super(0, 96, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
#
@done = false
#
# Get strings
strings = []
strings = initialize_message(source, target, damage, rare=false)
string = strings[0]
string_b = strings[1]
#
# Redefine width to width of both strings, item name and icon
item_name = MM_Steal.steal_item_name(item_type, item_id)
full_text = string + string_b + item_name
self.width = self.contents.text_size(full_text).width + 64
#
# Reset bitmap contents area and horizontally center
self.contents = Bitmap.new(width - 32, height - 32)
self.x = 320 - (self.width / 2)
#
# Clear and set font color
self.contents.clear
self.contents.font.color = normal_color
#
# Draw the first string
self.contents.draw_text(4, 0, self.width - 40, 32, string)
#
# Blit the icon
icon_x = self.contents.text_size(string).width
bitmap = MM_Steal.steal_item_icon_bitmap(item_type, item_id)
self.contents.blt(icon_x, 4, bitmap, Rect.new(0, 0, 24, 24))
#
# Get x coordinate of next text (after the first string)
x = self.contents.text_size(string).width + 23
# Draw second string and the name of the item stolen
self.contents.draw_text(x, 0, self.width - 40, 32, item_name + string_b)
#
# Setup visibility and duration of pop
self.back_opacity = 160
self.visible = true
@counter = MM_Steal::STEAL_DURATION
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
#
# Update game screen
Graphics.update
# Update input information
Input.update
# Erase the counter if C button was pressed
@counter = 0 if Input.press?(Input::C)
#
# Set the done flag and exit the method when the counter runs out
if @counter == 0
@done = true
return
end
#
# Reduce the counter by 1
@counter -= 1
#
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
#
@done = nil
@counter = nil
self.contents.clear
super
#
end
#--------------------------------------------------------------------------
# * Object Initialization (when getting the message array)
# source : actor stealing the item
# target : target of theft
# damage : actor applying damage while stealing
# rare : (optional) if item is rare
#--------------------------------------------------------------------------
def initialize_message(source, target, damage, rare)
#
# Custom system phrases in the Config section
action_common = MM_Steal::STEAL_ACTION_COMMON
reaction_common = MM_Steal::STEAL_REACTION_COMMON
action_rare = MM_Steal::STEAL_ACTION_RARE
reaction_rare = MM_Steal::STEAL_REACTION_RARE
action_dmg_common = MM_Steal::STEAL_ACTION_DMG_COMMON
reaction_dmg_common = MM_Steal::STEAL_REACTION_DMG_COMMON
action_dmg_rare = MM_Steal::STEAL_ACTION_DMG_RARE
reaction_dmg_rare = MM_Steal::STEAL_REACTION_DMG_RARE
#
if damage
# Obtain two lines of text if mugged for a rare item
if rare
string = source + action_dmg_rare + target + reaction_dmg_rare
string_b = "."
# Or obtain two lines of text if mugged for a common item
else
string = source + action_dmg_common + target + reaction_dmg_common
string_b = "."
end
#
# Return an array with both strings
return [string, string_b]
#
end
#
# Obtain two lines of text when a rare item stolen
if rare
string = source + action_rare
string_b = reaction_rare + target + "."
# Or obtain two lines of text when a common item stolen
else
string = source + action_common
string_b = reaction_common + target + "."
end
#
# Return an array with both strings
return [string, string_b]
#
end
end
#==============================================================================
# ** Window_Peep
#------------------------------------------------------------------------------
# This window class contains cursor movement and scroll functions.
#==============================================================================
class Window_Peep < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# enemy : enemy battler
# immune : flag if enemy immune from being peeped/scanned
#--------------------------------------------------------------------------
def initialize(enemy, immune = false)
#
# Window dimensions
super(120, 32, 400, 262)
#
# Set window dimensions
self.contents = Bitmap.new(width - 32, height - 32)
self.z = 9990
self.opacity = 0
self.contents_opacity = 0
#
# Set enemy and refresh
@enemy = enemy
refresh(immune)
#
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
@sprite.dispose
self.contents.dispose
super
end
#--------------------------------------------------------------------------
# * Refresh
# immune : flag if enemy immune from being peeped/scanned
#--------------------------------------------------------------------------
def refresh(immune = false)
#
# Clear values at start
done = false # Assume sprite not sized
opacity = 0 # Reset opacity to 0
#
# Prepare text and sprite for display
refresh_text(immune) # Get enemy stats to show
refresh_sprite # Get enemy sprite to show
refresh_enemy_coords # Get sprite coord settings
#
# Execute a loop
loop do
#
Graphics.update # Frame update
Input.update # Update input method
if Input.trigger?(Input::C) # When C is pressed
dispose # Dispose the window
break # stop the loop
end
opacity = refresh_opacity_increase(opacity) # Increase the opacity
done = true if refresh_sprite_zoom? # Adjust sprite size
refresh_sprite_move if done # Move sprite if sprite sized
#
end
#
end
#--------------------------------------------------------------------------
# * Refresh text display
# immune : flag if enemy immune from being peeped/scanned
#--------------------------------------------------------------------------
def refresh_text(immune)
#
# Initial Editor Database words
hp_words = $data_system.words.hp + ": "
sp_words = $data_system.words.sp + ": "
gold_words = $data_system.words.gold + ": "
#
# Custom System words in the Config section
name_words = MM_Steal::PEEP_NAME + ": "
exp_words = MM_Steal::PEEP_EXP + ": "
states_words = MM_Steal::PEEP_STATES + ": "
common_words = MM_Steal::PEEP_COMMON + ": "
rare_words = MM_Steal::PEEP_RARE + ": "
#
# Get contents to display in window
name = name_words + @enemy.name
hp_txt = hp_words + @enemy.hp.to_s + " / " + @enemy.maxhp.to_s
sp_txt = sp_words + @enemy.sp.to_s + " / " + @enemy.maxsp.to_s
exp_txt = exp_words + @enemy.exp.to_s
gold_txt = gold_words + @enemy.gold.to_s
states = states_words + refresh_states
common = common_words + refresh_common
rare = rare_words + refresh_rare
immune_txt = MM_Steal::PEEP_IMMUNE_TEXT
#
# Show name (always)
self.contents.draw_text(10, -18, 400, 50, name)
#
# Display immunity text and exit if immune
if immune
# Text is centered vertically as well as horizontally
self.contents.draw_text(0, self.height / 2, 400-64, 60, immune_txt, 1)
return
end
#
# Display all pertinant data if not immune
self.contents.draw_text(10, 12, 400, 50, hp_txt)
self.contents.draw_text(10, 42, 400, 50, sp_txt)
self.contents.draw_text(10, 72, 400, 50, exp_txt)
self.contents.draw_text(10, 102, 400, 50, gold_txt)
self.contents.draw_text(10, 132, 400, 50, states)
self.contents.draw_text(10, 162, 400, 50, common)
self.contents.draw_text(10, 192, 400, 50, rare)
#
end
#--------------------------------------------------------------------------
# * Refresh common steal texts
#--------------------------------------------------------------------------
def refresh_common
#
# Exit method indicating no common item if none exist
text = MM_Steal::PEEP_NONE
return text if @enemy.steal_item_id.nil?
#
# Obtain common item and split into type and ID
temp_array = @enemy.steal_item_id
temp_array = [0,0] if temp_array.nil?
item_type = temp_array[0]
item_id = temp_array[1]
#
# Get item name
text = MM_Steal.steal_item_name(item_type, item_id)
#
# Exit with common item name
return text
#
end
#--------------------------------------------------------------------------
# * Refresh rare steal texts
#--------------------------------------------------------------------------
def refresh_rare
#
# Exit method indicating no rare item if none exist
text = MM_Steal::PEEP_NONE
return text if @enemy.steal_rare_id.nil?
#
# Obtain rare item and split into type and ID
temp_array = @enemy.steal_rare_id
temp_array = [0,0] if temp_array.nil?
item_type = temp_array[0]
item_id = temp_array[1]
#
# Get item name
text = MM_Steal.steal_item_name(item_type, item_id)
#
# Exit with rare item name
return text
#
end
#--------------------------------------------------------------------------
# * Refresh status effect texts
#--------------------------------------------------------------------------
def refresh_states
#
# Define text to return
text = ""
#
# Cycle through enemy status effects
for i in @enemy.states
next unless $data_states[i].rating >= 1 # Skip unless a valid state
if text == "" # If status ailment list is empty
text = $data_states[i].name # List begins with first state
else # Otherwise
text += "/" + $data_states[i].name # Add separator and next state
end
end
#
text = MM_Steal::PEEP_NORM if text == "" # Set normal state on empty list
text = "[" + text + "]" # Adding brackets when done
#
# Return the states
return text
#
end
#--------------------------------------------------------------------------
# * Refresh the sprite
#--------------------------------------------------------------------------
def refresh_sprite
#
# Obtain battler filename and hue
name = @enemy.battler_name
hue = @enemy.battler_hue
#
# Create the enemy sprite based on enemy name and hue
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.battler(name, hue)
#
# Set the screen coordinates for the sprite including z-depth
@sprite.x = (@enemy.screen_x - (@sprite.bitmap.width / 2))
@sprite.y = (@enemy.screen_y - @sprite.bitmap.height)
@sprite.z = 9999
#
end
#--------------------------------------------------------------------------
# * Refresh enemy coordinates
#--------------------------------------------------------------------------
def refresh_enemy_coords
#
# Obtain width/height from sprite
wd = @sprite.bitmap.width
ht = @sprite.bitmap.height
#
# Values allow for sprite zoom and repositioning
@old_center_x = wd / 2 # Center point of sprite width
@old_center_y = ht / 2 # Center point of sprite height
@final_x = (400 - (wd / 4)) # The final x-coordinate of the sprite
@scale = 1 # Zoom scale at start (allows adjusts)
#
end
#--------------------------------------------------------------------------
# * Refresh increased window opacity
# opacity : content opacity
#--------------------------------------------------------------------------
def refresh_opacity_increase(opacity)
#
# Exit with current setting unless opacity is solid
return opacity unless self.opacity < 255
#
self.opacity = opacity # Set the window opacity setting
self.contents_opacity = opacity # Set the contents opacity setting
opacity += 20 unless opacity >= 255 # Increase opacity until reaches 255
#
# Return current setting
return opacity
#
end
#--------------------------------------------------------------------------
# * Refresh if sprite zoom processed?
#--------------------------------------------------------------------------
def refresh_sprite_zoom?
#
# Determine current sprite width and height
width_shift = @sprite.bitmap.width * @scale >= 200
height_shift = @sprite.bitmap.height * @scale >= 150
#
# Perform gradual zoom and return false if sprite is not to scale
if (width_shift or height_shift)
#
@sprite.zoom_x = @scale # Set zoom by current scale
@sprite.zoom_y = @scale # Set zoom by current scale
@scale -= 0.01 # Decrease scale by gradual 0.01
width = @sprite.bitmap.width # Get sprite width (convenience)
height = @sprite.bitmap.height # Get sprite height (convenience)
@new_center_x = (width * @scale) / 2 # Get scaled sprite center X
@new_center_y = (height * @scale) / 2 # Get scaled sprite center Y
@x_move = @new_center_x - @old_center_x # Get x movement increment
@y_move = @new_center_y - @old_center_y # Get x movement increment
@old_center_x = @new_center_x # Reset the original x coordinate
@old_center_y = @new_center_y # Reset the original y coordinate
@sprite.x -= @x_move.to_i # Move the sprite by x increment
@sprite.y -= @y_move.to_i # Move the sprite by y increment
#
# Exit zoom not completed
return false
#
end
#
# Exit zoom completed
return true
#
end
#--------------------------------------------------------------------------
# * Refresh sprite move position
#--------------------------------------------------------------------------
def refresh_sprite_move
#
@xlen = @sprite.x - @final_x # Distance of sprite from final x coord
@ylen = @sprite.y - 40 # Distance of sprite from final y coord
@len = Math.hypot(@xlen, @ylen) # Calc the move length for the sprite
@len /= 5 # Decrease by 1/5th to speed it up
@line = [] # Create temp array
@line.push([@sprite.x, @sprite.y]) # Push the starting coordinates
#
# Cycle through move increments
for i in 1..@len
newx = @sprite.x - ((@xlen / @len) * i) # Calculate new X coordinate
newy = @sprite.y - ((@ylen / @len) * i) # Calculate new Y coordinate
newx = newx.to_i # Make X coordinate an integer
newy = newy.to_i # Make Y coordinate an integer
@line.push([newx, newy]) # Push updated coordinates
end
#
# Remove duplicates
@line.uniq!
#
# Cycle through calculated coordinates
for i in 0...@line.size
Graphics.update # Frame Update
givexy = @line[i] # Get coordinate set
@sprite.x = givexy[0] # Set Sprite's new x coordinate
@sprite.y = givexy[1] # Set Sprite's new x coordinate
end
#
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# These accessors are actually used by our ghetto-ass variable passing tech.
# (There's 2 of us, so it's a dual tech! Yay!) -K
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# i don't recall makin any ghetto passes... -Midge-
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Most of them are set from outside the scene by using the syntax
# "$scene.variable = ???".
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
attr_accessor :steal_source # Name of the actor stealing
attr_accessor :steal_target # Name of the enemy being robbed
attr_accessor :steal_rare # Is the item stolen a "rare" item?
attr_accessor :steal_item_type # The type of the item stolen.
attr_accessor :steal_item_id # The item_id of the item stolen.
attr_accessor :pop_done # Is the damage_pop routine done?
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias scene_battle_stealpeeper_main main
alias scene_battle_stealpeeper_update update
alias scene_battle_stealpeeper_update_phase4_step5 update_phase4_step5
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
#
# Initialize the new variables
main_mk_initialize
#
# Perform the original method
scene_battle_stealpeeper_main
#
# Dispose
main_mk_dispose
#
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
#
# Create the steal window if the steal pop is done
update_steal_pop_window
#
# Perform the original method if there is no steal window showing
return scene_battle_stealpeeper_update if @steal_window.nil?
#
# Update the steal window or dispose when done
update_steal_pop_update
#
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 5 : damage display)
#--------------------------------------------------------------------------
def update_phase4_step5
#
# Pop if the steal damage value exists
@active_battler.damage_pop = true unless @active_battler.steal_damage.nil?
#
# Perform the original method
scene_battle_stealpeeper_update_phase4_step5
#
end
#--------------------------------------------------------------------------
# * Main Processing (when adding startup/initialization values)
#--------------------------------------------------------------------------
def main_mk_initialize
#
# Initialize the new variables
@steal_source = nil
@steal_target = nil
@steal_item_type = 0
@steal_item_id = 0
@steal_rare = false
@pop_done = false
#
end
#--------------------------------------------------------------------------
# * Main Processing (when disposing values before exiting battle)
#--------------------------------------------------------------------------
def main_mk_dispose
#
# Dispose any steal window after main is done
unless @steal_window == nil
@steal_window.dispose
end
#
# I think I may have done these two lines purely for kicks.
@steal_message = nil
@pop_done = nil
#
end
#--------------------------------------------------------------------------
# * Frame Update (when the steal pop is done)
#--------------------------------------------------------------------------
def update_steal_pop_window
#
# If the damage pop is done
return unless @pop_done == true
#
# Clear the damage pop test
@pop_done = false
#
# Only display the window if enabled
return unless MM_Steal::STEAL_WINDOW
#
# Exit if the source content is invalid
return if @steal_source.nil?
#
# Determine if skill defined to apply damage
damage = (@skill.power > 0)
#
# Set local values for parameter convenience
source = @steal_source
type = @steal_item_type
id = @steal_item_id
target = @steal_target
rare = @steal_rare
#
# Process the steal window
@steal_window = Window_Steal.new(source, damage, type, id, target, rare)
#
# Reset variables to prevent window duplication
@steal_source = nil
@steal_item_type = nil
@steal_item_id = nil
@steal_target = nil
@steal_rare = false
#
end
#--------------------------------------------------------------------------
# * Frame Update (when the steal window is done)
#--------------------------------------------------------------------------
def update_steal_pop_update
#
# Dispose the window if showing
if @steal_window.done
@steal_window.dispose
@steal_window = nil
# Update otherwise
else
@steal_window.update
end
#
end
end
Instructions
Instructions are in the Instruction and configuration page. Otherwise, paste below Scene_Debug and above Main as usual. If used with either MultiSlots! (by DerVVulfman) or the Multi-Slot Equipment Script (by Guilaume777), place it below your chosen multiple-slot system as well.
FAQ
I was like "WHY ARE THE PEEP AND STEAL WINDOWS NOT SHOWING"??? I found that the skills needed a 'target' battle animation to trigger them. If you don't want a battle animation to show, you can just create an empty battle animation (no graphic, no audio) and use that. It doesn't care.
Compatibility
For RPGMaker XP.
Compatible with MultiSlots! by DerVVulfman
Compatible with Multi-Slot Equipment Script by Guilaume777
Author's Notes
ROFL. Some of the comments made by Khatharr and makeamidget were hilarious in the original script, so I kept a few of the back-and-forths within.
Terms and Conditions
Free for use, even in commercial scripts. However, I require due credit for myself, Khatharr, makeamidget and Ace_V who asked for the damage-based options.
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