Save-Point

Full Version: Save-Point
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Board Message
Sorry, you do not have permission to access this resource.
Save-Point - Editing Steal Script by makeamidget & Khatharr to allow stealing weapons & armor

Save-Point

Full Version: Editing Steal Script by makeamidget & Khatharr to allow stealing weapons & armor
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Preface:
Hi! I was reviewing an old character's steal and scan ability, and noticed that the script I used from 2005 only allowed the stealing of items. It is the Steal Script by makeamidget & Khatharr

Since I returned to working on the project, I included one scripted, undefeatable boss that had a very powerful piece of armor as its drop (set to 0%) with the intention that the armor could be stolen, but had to be done before the boss eventually defeats you and you lose your chance for the rest of the game. I've also implemented other instances where powerful weapons and armor pieces can only be stolen.

Unfortunately, when it came time to add those pieces them to the script, I discovered that the portion of the code was written this way:

Code:
def steal_item_id
   unless @stolen
     case @enemy_id
     when 1   #<---- Enemy ID#
       return 37  #<---- Item ID#

So, only items (not armor and weapons) could be added.

Additionally, part of the Steal Script involves Scanning (or "Peeping" in this version) which shows stats. That part works well, but I was hoping to also implement some damage to the Peeping mechanic, as I want to make another character with a skill like "Mind Invade" which deals damage and also shows the enemy's stats. As it is, the Peeping/Scanning mechanic doesn't deal damage, regardless of how I format the skill's stats in the RPG Maker editor.


My Requests
1. Is there a way to allow the stealing of weapons and armor
2. And also a second Peep skill that deals damage? ("Mind Invade")
3. In the same vein as request #2, also a Mug variant for stealing?

The Codes

The script is divided into two sections. (Please note I removed the names of the enemies and items in the comments. I also removed some of the original script writer's random comments about Zoe Saldana as it is just spam. I did, however, keep the other comments pertaining to the script itself. Finally, I also put "ACE COMMENT" for the entries that are intended for the boss and his rare armor). I also haven't touched the items/monsters list since 2005, and eventually I'll have to set aside some time to populating the list. On the other hand, the less items, the easier to read the script for this post. Blushing + Cheery

Part 1

Code:
#================================================
# Steal Script by makeamidget & Khatharr
#================================================
#  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.
#--------------------------------------------------------------------------
# First, set all these constants to your liking.
# They each come with an explanation.
#--------------------------------------------------------------------------
#This is what displays in the Peep window when the enemy is immune
PEEP_IMMUNE_DISPLAY = "-No Data Available..."
#This is the string that pops when an enemy is immune to peeping.
PEEP_IMMUNE_STRING = "Immune"
#This is the string that pops when an enemy is peeped successfully.
AFTER_PEEP_STRING = "Oooh!"
#This is the string that pops when a peep attempt fails.
PEEP_FAIL_STRING = "Failed to Peep"
#This is the string that pops when a steal attempt fails.
STEAL_FAIL_STRING = "You Missed!"
#This is the string that pops when you try to steal from an enemy with no item.
NO_ITEM_TO_STEAL_STRING = "No item to steal!"
#This is the string that pops when an enemy has a rare, but not a common item and you fail an attempt to steal.
FAILED_RARE_STEAL_STRING = "It won't give it up!"
#This should be changed to the database ID# of your "steal" skill.
STEAL_SKILL_ID_NUM = 193
#This should be changed to the database ID# of your "peep" skill.
PEEP_SKILL_ID_NUM = 192
PEEP_SKILL_ID_NUM = 284 ## ACE COMMENT: This is the second skill that I want to be also able to deal damage
#This number controls how long (in frames) the steal window will display before auto-closing.
STEAL_WINDOW_DURATION = 65
#This is the main color used when an item name pops on a target.
ENEMY_POP_R = 255
ENEMY_POP_G = 150
ENEMY_POP_B = 150
#This is the main color used when an item name pops on the thief.
ACTOR_POP_R = 150
ACTOR_POP_G = 255
ACTOR_POP_B = 150
#This is the border color used when an item name pops on a target.
ENEMY_BPOP_R = 100
ENEMY_BPOP_G = 100
ENEMY_BPOP_B = 250
#This is the border color used when an item name pops on the thief.
ACTOR_BPOP_R = 1
ACTOR_BPOP_G = 10
ACTOR_BPOP_B = 1
#----------------------------------------------------------------------------
class Game_Enemy < Game_Battler
attr_accessor :peep_immune
#--------------------------------------------------------------------------
# This method returns the id# of the enemy's "common" item ID# or 0 if there isn't one.
# It can basically be configured however you want.  For now it is a "case" statement.
# To associate an item with an enemy, you may simply un-comment and use the sample code
# That's already in place below.
# Just make it so that:
#               case (enemy-id# from database)
#                 return (item-id# from the database)
#  You can add as many of those as you like.  The section that reads:
#                else
#                  return 0
#  Will make it so that any enemy not specified returns a 0 (no item to steal).
#  This also can be changed as you wish.  The "return 0" at the end handles what to return
#  if this enemy was already stolen from.  It too can be changed, if you like.
#--------------------------------------------------------------------------
def steal_item_id
   unless @stolen
     case @enemy_id
     when 1   #<---- Enemy ID# NAME
       return 37  #<---- Item ID# NAME
       #
       when 2   #<----  enemy name
       return 37  #<---- item name
       #
       when 8   #<----  enemy name
       return 36  #<---- item name
       #
       when 9   #<---- enemy name
       return 38  #<----  item name
      #
      when 11   #<---- enemy name
       return 39  #<---- item name
      #
       when 31 #<----boss name
         return 3 #<----item name
      # 
      when 50   #<----boss name
       return 21  #<---- Thunder Stone
      #
      when 60 #<----enemy name
         return 14 #<----Barrier Stone
      #  
      when 61 #<----enemy name
         return 15 #<----Resistance Stone
      #  
      when 62 #<----enemy name
         return 16 #<----Blink Stone
      #  
      when 79 #<----ACE COMMENT: this is the boss that has the rare armor
        return 7 #<----common item name
      #  
     else
       return 0  #<---- Unspecified enemy.
     end
   end
   return 0  #<---- Already stolen.
end
#--------------------------------------------------------------------------
# This is the exact same thing as above, but for the enemy's "rare" item.
# Stealing a "common" item is about as hard as hitting with a normal attack,
# but stealing a "rare" item is about as hard as getting a critical hit.
# Any enemy can have both a rare and a common item, or one or the other,
# or neither.  Remember that 0 means "no item".
#--------------------------------------------------------------------------
def steal_rare_id(drop_rare = false)
   if @stolen_rare
     if drop_rare
       return steal_item_id
     else
       return 0
     end
   else
     case @enemy_id
     when 1   #<---- Enemy ID#
       return 2  #<---- Item ID#
       #
       when 2   #<---- enemy name
       return 4  #<---- item name
      #
       when 31 #<---- boss name
       return 7 #<---- item name
      #
       when 3   #<---- enemy name
       return 5  #<---- item name
      #
       when 4   #<---- enemy name
       return 13  #<---- item name
      #
       when 5   #<---- enemy name
       return 13  #<---- item name
      #
       when 8   #<---- enemy name
       return 61  #<---- Holy Cross
      #
       when 9   #<---- enemy name
       return 9  #<---- item name
      #
       when 11   #<---- enemy name
       return 15  #<---- item name
      #
      when 12   #<---- enemy name
       return 47  #<---- item name
      #
      when 16   #<---- boss name
       return 49  #<---- item name
      #
      when 18   #<---- boss name
       return 42  #<---- item name
      #
      when 19   #<---- boss name
       return 50  #<---- item name
      #
      when 34   #<---- enemy name
       return 1  #<---- item name
      #
      when 35   #<---- enemy name
       return 1  #<---- item name
      #
      when 36   #<---- enemy name
       return 1  #<---- item name
      #
      when 38   #<---- boss name
       return 51  #<---- item name
      #
      when 39   #<---- boss name
       return 3  #<---- item name
      #
      when 40   #<---- boss name
       return 3  #<---- item name
      #
      when 41   #<---- boss name
       return 7  #<---- item name
      #
      when 50   #<---- boss name
       return 17  #<---- item name
      #
      when 60 #<---- enemy name
         return 19 #<---- item name
      #  
      when 61 #<---- enemy name
         return 17 #<---- item name
      #  
      when 62 #<---- enemy name
         return 20 #<---- item name
      # 
      when 79 #<---- ACE COMMENT: this is the boss and his rare armor
        return 68 #<---- ACE COMMENT: this is supposed to be the armor code, but the script considers it an item code, instead
      #  
     else
       return 0  #<---- Unspecified enemy.
     end
   end
   return 0  #<---- Already stolen.
end
end
#--------------------------------------------------------------------------
# Next, to customize the "Peep" command.  You may want some enemies in your game
# To be immune to being peeped.  If so, just push their ID#'s into this array.
# Some sample lines are present, and if they were un-commented, they would render
# enemies #1(the database ID#), #3, #5 and 31 immune to peeping.  Immune enemies
# are still peeped, but no data is shown.  Test it out to see how it looks. 
# This array may be left blank if you like.
# Also, the ID numbers do not need to be in any particular order.
#-------------------------------------------------------------------------- 
def peep_immune?
   @peep_immune.push(31)
   @peep_immune.push(32)
   @peep_immune.push(27)
end


Part 2: (note: the squirrel and poop and butt are part of the original comments, and they do pertain to the script, so I've decided to keep them in. 20 years later, I did get a chuckle out of reading those comments. Remnants of an era... Laughing + Tongue sticking out ):

Code:
#==================================================
#                           --  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!!!!  Aieeeeeeeeeeeeeeeeee!!!!!
#==================================================
# 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...!
#==================================================

class Game_Enemy < Game_Battler
  def skill_effect(user, skill)
    case skill.id
    when STEAL_SKILL_ID_NUM
      tempything = steal_attempt(user)
      unless tempything == 0
        $scene.steal_source = user.name
        $scene.steal_target = self.name
        return true
      else
        return false
      end
    when PEEP_SKILL_ID_NUM
      super_squirrel = peep_attempt(user)
      if super_squirrel
        if self.peep_immune?.include?(self.id)
          self.damage = PEEP_IMMUNE_STRING
          $peep_miss = true
        else
          $peep_miss = false
        end
        $peep = self
        return true
      else
        return false
      end
    else
      return super(user, skill)
    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.
    #------------------------------------------------------------------------
    # It's true... maybe... actually i can't remember.. but it is in one of my sections.. so it's probably true
    #(If you're the wierdo then what does that make me?) -Midge-
  end
  #--------------------------------------------------------------------------
  # This mods the init a little to include some flags that determine
  # whether the enemy's item is stolen or not.  There's no need to mess with it.
  #--------------------------------------------------------------------------
  alias mk_steal_initialize initialize
  def initialize(troop_id, member_index)
    mk_steal_initialize(troop_id, member_index)
    @stolen = (steal_item_id == 0) # If the enemy has a common item, it's marked as not stolen.
    @stolen_rare = (steal_rare_id == 0) # If the enemy has a rare item, it's marked as not stolen.
    @peep_immune = []
    peep_immune
  end
  #--------------------------------------------------------------------------
  # This bad boy decides whether or not an attempt to "peep" will
  # succeed, and sets the 'damage' string that will pop on the target.
  #--------------------------------------------------------------------------
  def peep_attempt(user)
    Input.update
    if (rand(100) < (100  - (100 * [(self.mdef.to_f - user.agi.to_f), 0].max / (self.mdef.to_f + user.agi.to_f)).to_i))
      self.damage = AFTER_PEEP_STRING
      return true
    else
      self.damage = PEEP_FAIL_STRING
      return false
      end
  end
  #--------------------------------------------------------------------------
  # This processes the steal attempt.  The probability is based on the
  # "attack" command.  Rare items are stolen by "critical" hits.
  # Note that attacker wants a high "dex" and defender wants a high "agi" and "eva".
  #--------------------------------------------------------------------------
  def steal_attempt(attacker)
    if self.cant_evade?  # If they can't evade, they fail to defend against the theft.
      if (rand(100) < 4 * attacker.dex / self.agi) #"critical" checking
        temporary = steal(true, attacker) #steal rare item
      else
        temporary = steal(false, attacker) #steal common item
      end
      return temporary
    end
    # This next line determines if the attack is accurate and if the enemy evades or not.
    if (rand(100) < attacker.hit) and (rand(100) < (100 - (8 * self.agi / attacker.dex + self.eva)))
      if (rand(100) < 4 * attacker.dex / self.agi) and (not @stolen_rare) #"critical" checking
        temporary = steal(true, attacker) #steal rare item
      else
        temporary = steal(false, attacker) #steal common item
      end
      return temporary
    end
    self.damage = STEAL_FAIL_STRING
    return 0
  end
  #--------------------------------------------------------------------------
  # This one handles the actual theft, as far as giving the item, setting the flags, etc.
  #--------------------------------------------------------------------------
  def steal(rare, attacker)
    $scene.steal_rare = rare #Ghetto pass!  Woohah! (this ghetto pass brought to you in part by Khatharr
    if rare
      item_id = steal_rare_id(true)
      $game_party.gain_item(item_id, 1)  #If you're digging through this code in hopes of being clever,
      @stolen_rare = true                        #You could start changing the item quantities here....
    else
      item_id = steal_item_id
      $game_party.gain_item(item_id, 1)
      @stolen = true
    end
    $scene.steal_item_id = item_id #Ghetto pass!  Woohah! (he can't stop passin ghetto style)
    if item_id == 0 #This part handles what to do if there's no item.
      if @stolen_rare #"If the rare item exists and is not stolen."
        self.damage = NO_ITEM_TO_STEAL_STRING
      else
        self.damage = FAILED_RARE_STEAL_STRING
      end
      return 0
    else #This part sets the item name as the "damage" message.
      self.damage = $data_items[item_id].name
      self.steal_icon = $data_items[item_id].icon_name #save icon so that it can be displayed
      attacker.damage = $data_items[item_id].name #added so the actor can have damage pop'ed too
      attacker.steal_icon = $data_items[item_id].icon_name #actor icon...
      if rare
        self.damage = $data_items[item_id].name + " (rare)"
        self.steal_icon = $data_items[item_id].icon_name #save icon so that it can be displayed
        attacker.damage = $data_items[item_id].name + " (rare)" #added so the actor can have damage poped too
        attacker.steal_icon = $data_items[item_id].icon_name #actor icon..
      end
      return self.damage
    end
  end
end
#--------------------------------------------------------------------------
class Scene_Battle
  #These accessors are actually used by our ghetto-ass variable passing tech.
  #(There's 2 of us, so it's a dual tech!  Yay!)
  #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  #Who's stealin'?
  attr_accessor :steal_target   #Who's gettin' stole on?
  attr_accessor :steal_rare      #Is the item being stolen the target's "rare" item?
  attr_accessor :steal_item_id #The item_id number of the item stolen.
  attr_accessor :pop_done      #Is the damage_pop routine in RPG::Sprite finished executing?
  #--------------------------------------------------------------------------
  alias mk_steal_main main
  def main
    #initialize the new variables
    @steal_source = nil
    @steal_target = nil
    @steal_item_id = 0
    @steal_rare = false
    @pop_done = false
    mk_steal_main  #run the original "main"
    unless @steal_window == nil
      @steal_window.dispose #after "main" is done, dispose any steal window that may exist
    end #unless @steal_window == nil
    @steal_message = nil  #I think I may have done these two lines purely for kicks.
    @pop_done = nil
  end #def main
  #--------------------------------------------------------------------------
  alias mk_steal_update update
  def update
    if @pop_done == true       #If the damage_pop routine is finished
      @pop_done = false          #turn off the notifier
      unless @steal_source == nil          #check to see if someone got jacked and handle the window if they did
        @steal_window = Window_Steal.new(@steal_source, @steal_item_id, @steal_target, @steal_rare)
        @steal_source = nil                   #reset all the variables that were passed to the window
        @steal_item_id = nil
        @steal_target = nil
        @steal_rare = false
      end #unless @steal_source == nil
    end #@pop_done == true
    unless @steal_window == nil  #if the steal window is showing...
      if @steal_window.done           #check to see if it's done
        @steal_window.dispose         #if it is, get rid of it
        @steal_window = nil           #and set it to 'nil'
      else #if @steal_window.done
        @steal_window.update           #if it's not done, update the window
      end #if @steal_window.done
    else #unless @steal_window == nil
      mk_steal_update                      #if the window is not showing, proceed with battle
    end #unless @steal_window == nil
  end #def update
  #--------------------------------------------------------------------------
  alias mk_steal_update_phase4_step5 update_phase4_step5
  def update_phase4_step5
    mk_steal_update_phase4_step5                  #run the original method
    if @active_battler.damage != nil && @active_battler.steal_icon != nil
      #If the battler has a damage value(potentially an item name) and a value is set in the icon variable,
      #"pop" the damage for the battler.  This is basically so that the stealing party get's the item name popped.
      @active_battler.damage_pop = true          
    end  #if @active_battler.dam.....
  end  #def update_phase4_step5
  #--------------------------------------------------------------------------
end # class Scene_Battle
class Window_Steal < Window_Base
  attr_reader :done
  def initialize(source, item_id, target, rare)
    @done = false
    item_name = $data_items[item_id].name   
    unless rare
      #These two lines compose the common-item steal message.  The icon appears between them.
      string = source + " stole a  "
      string_b = " from " + target + "."
    else
      #These two lines compose the rare-item steal message.  The icon appears between them.
      string = source + " grabbed a  "
      string_b = " away from " + target + "."
    end
    super(0, 96, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
    self.width = self.contents.text_size(string + string_b + item_name).width + 64
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
    self.x = 320 - (self.width / 2)
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, self.width - 40, 32, string)
    icon_x = self.contents.text_size(string).width
    bitmap = RPG::Cache.icon($data_items[item_id].icon_name)
    self.contents.blt(icon_x, 4, bitmap, Rect.new(0, 0, 24, 24))
    self.contents.draw_text(self.contents.text_size(string).width + 23, 0, self.width - 40, 32, item_name + string_b)
    self.back_opacity = 160
    self.visible = true
    @counter = STEAL_WINDOW_DURATION
  end
  def update
    Input.update
    Graphics.update
    if Input.press?(Input::C)
      @counter = 0
    end
    if @counter == 0
      @done = true
    else
      @counter -= 1
    end
  end
  def dispose
    @done = nil
    @counter = nil
    self.contents.clear
    super
  end
end

class Game_Battler
  attr_accessor :steal_icon #this exists solely to save the icon of the stolen item in... that and
  alias mk_steal_initialize2 initialize   
  def initialize
    mk_steal_initialize2
    @steal_icon = nil
  end
end

  #--------------------------------------------------------------------------
  # okay this is the amazing mod to the sprite class so that the icon and the battler type
  # gets passed to it... also where the color changing for the steal popping is handled...
  #--------------------------------------------------------------------------
module RPG
  class Sprite < ::Sprite
    def damage(value, critical, icon = nil, battler = nil)#added the info to send to determine where and what to pop
      dispose_damage
      if value.is_a?(Numeric)
        damage_string = value.abs.to_s
      else
       damage_string = value.to_s
      end
      if icon == nil #if there is no icon(then that means nothing was stolen) buisiness is taken care of per normal...
        bitmap = Bitmap.new(160, 48)
        bitmap.font.name = "Arial Black"
        bitmap.font.size = 32
        bitmap.font.color.set(0, 0, 0)
        bitmap.draw_text(-1, -1, 160, 36, damage_string, 1)
        bitmap.draw_text(1, -1, 160, 36, damage_string, 1)
        bitmap.draw_text(-1, +1, 160, 36, damage_string, 1)
        bitmap.draw_text(1, +1, 160, 36, damage_string, 1)
        if value.is_a?(Numeric) and value < 0
          bitmap.font.color.set(176, 255, 144)
        else
          bitmap.font.color.set(255, 255, 255)
        end
        bitmap.draw_text(0, 0, 160, 36, damage_string, 1)
      else #BUT.. if there is... then this crap happens...
        bitmap = Bitmap.new(180, 48)
        bitmap.font.name = "Arial Black"
        bitmap.font.size = 32
        #if the character is an Enemy then the color scheme is whatever you set up in the customize section
        #this is the outline color by the way... if the character is a player character then it's the player section
        if battler.is_a?(Game_Enemy)
          bitmap.font.color.set(ENEMY_BPOP_R, ENEMY_BPOP_G, ENEMY_BPOP_B)
        else
          bitmap.font.color.set(ACTOR_BPOP_R, ACTOR_BPOP_G, ACTOR_BPOP_B)
        end
        iconbmp = RPG::Cache.icon(icon) #gets the actual icon for the poping
        #the offset for the x value cause the damage is centered...
        size = [((bitmap.text_size(damage_string).width / 2) + 5), 80].min
        bitmap.blt(80 - size, 16, iconbmp,  Rect.new(0,0,24,24))
        bitmap.draw_text(19, 12-1, 160, 36, damage_string, 1)  #these next for lines are making the outline of the
        bitmap.draw_text(21, 12-1, 160, 36, damage_string, 1)  #damage pop.. this is how the damage can have an outline
        bitmap.draw_text(19, 12+1, 160, 36, damage_string, 1) #it's pretty spiffy if you ask me... (makeamidget)
        bitmap.draw_text(21, 12+1, 160, 36, damage_string, 1)
        #the next little section is the center color of the damage pop... (normaly the white middle part)
        if battler.is_a?(Game_Enemy)
          bitmap.font.color.set(ENEMY_POP_R, ENEMY_POP_G, ENEMY_POP_B)
        else
          bitmap.font.color.set(ACTOR_POP_R, ACTOR_POP_G, ACTOR_POP_B)
        end
        bitmap.draw_text(20, 12, 160, 36, damage_string, 1)
      end
      if critical
        bitmap.font.size = 10
        bitmap.font.color.set(0, 0, 0)
        bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
        bitmap.font.color.set(255, 100, 100)
        bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
      end
      @_damage_sprite = ::Sprite.new(self.viewport)
      @_damage_sprite.bitmap = bitmap
      @_damage_sprite.ox = 80
      @_damage_sprite.oy = 20
      @_damage_sprite.x = self.x
      @_damage_sprite.y = self.y - self.oy / 2
      @_damage_sprite.z = 3000
      @_damage_duration = 40
    end
    
    def update_animation
      if @_animation_duration > 0
        frame_index = @_animation.frame_max - @_animation_duration
        cell_data = @_animation.frames[frame_index].cell_data
        position = @_animation.position
        animation_set_sprites(@_animation_sprites, cell_data, position)
        for timing in @_animation.timings
          if timing.frame == frame_index
            animation_process_timing(timing, @_animation_hit)
          end
        end
      else
        dispose_animation
        if ($peep != nil) and (self.battler.is_a?(Game_Enemy))
          @super_mario_rpg = WindowPeep.new($peep, $peep_miss)
          $peep = nil
        end
      end
    end
   
    def update
      super
      if @_whiten_duration > 0
        @_whiten_duration -= 1
        self.color.alpha = 128 - (16 - @_whiten_duration) * 10
      end
      if @_appear_duration > 0
        @_appear_duration -= 1
        self.opacity = (16 - @_appear_duration) * 16
      end
      if @_escape_duration > 0
        @_escape_duration -= 1
        self.opacity = 256 - (32 - @_escape_duration) * 10
      end
      if @_collapse_duration > 0
        @_collapse_duration -= 1
        self.opacity = 256 - (48 - @_collapse_duration) * 6
      end
      if @_damage_duration > 0
        @_damage_duration -= 1
        case @_damage_duration
        when 38..39
          @_damage_sprite.y -= 4
        when 36..37
          @_damage_sprite.y -= 2
        when 34..35
          @_damage_sprite.y += 2
        when 28..33
          @_damage_sprite.y += 4
        end
        @_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32

        if @_damage_duration == 0
          $scene.pop_done = true
          dispose_damage
        end
      end
     
      if @_animation != nil and (Graphics.frame_count % 2 == 0)
        @_animation_duration -= 1
        update_animation
      end
      if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
        update_loop_animation
        @_loop_animation_index += 1
        @_loop_animation_index %= @_loop_animation.frame_max
      end
      if @_blink
        @_blink_count = (@_blink_count + 1) % 32
        if @_blink_count < 16
          alpha = (16 - @_blink_count) * 6
        else
          alpha = (@_blink_count - 16) * 6
        end
        self.color.set(255, 255, 255, alpha)
      end
      @@_animations.clear
    end
  end
end


class Sprite_Battler < RPG::Sprite
   def update
    super
    if @battler == nil
      self.bitmap = nil
      loop_animation(nil)
      return
    end
    if @battler.battler_name != @battler_name or
       @battler.battler_hue != @battler_hue
      @battler_name = @battler.battler_name
      @battler_hue = @battler.battler_hue
      self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
      @width = bitmap.width
      @height = bitmap.height
      self.ox = @width / 2
      self.oy = @height
      if @battler.dead? or @battler.hidden
        self.opacity = 0
      end
    end
    if @battler.damage == nil and
       @battler.state_animation_id != @state_animation_id
      @state_animation_id = @battler.state_animation_id
      loop_animation($data_animations[@state_animation_id])
    end
    if @battler.is_a?(Game_Actor) and @battler_visible
      if $game_temp.battle_main_phase
        self.opacity += 3 if self.opacity < 255
      else
        self.opacity -= 3 if self.opacity > 207
      end
    end
    if @battler.blink
      blink_on
    else
      blink_off
    end
    unless @battler_visible
      if not @battler.hidden and not @battler.dead? and
         (@battler.damage == nil or @battler.damage_pop)
        appear
        @battler_visible = true
      end
    end
    if @battler_visible
      if @battler.hidden
        $game_system.se_play($data_system.escape_se)
        escape
        @battler_visible = false
      end
      if @battler.white_flash
        whiten
        @battler.white_flash = false
      end
      if @battler.animation_id != 0
        animation = $data_animations[@battler.animation_id]
        animation(animation, @battler.animation_hit)
        @battler.animation_id = 0
      end
     
      #the only mod in this section...
      #it sends the icon and battler type to the modified damage section so that the icon can be popped..
      #then sets both to nil.. so that they are all forgotten and stuff....
      if @battler.damage_pop
        damage(@battler.damage, @battler.critical, @battler.steal_icon, @battler)
        @battler.damage = nil                                                                         
        @battler.critical = false
        @battler.steal_icon = nil
        @battler.damage_pop = false
      end
     
      if @battler.damage == nil and @battler.dead?
        if @battler.is_a?(Game_Enemy)
          $game_system.se_play($data_system.enemy_collapse_se)
        else
          $game_system.se_play($data_system.actor_collapse_se)
        end
        collapse
        @battler_visible = false
      end
    end
    self.x = @battler.screen_x
    self.y = @battler.screen_y
    self.z = @battler.screen_z
  end
end

class WindowPeep < Window_Base
  def initialize(enemy, immune = false)
    super(120,32,400,262)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype  # "Skill" status window font
    self.contents.font.size = $defaultfontsize
    self.z =9990
    self.opacity=0
    self.contents_opacity = 0
    @enemy = enemy
    refresh(immune)
  end
 
  def refresh(immune = false) #immune is wether or not the enemy is immune to the 'peep' skill
    done = false #used to know when the shrinking of the sprite is done so that movement can begin
    opacity = 0 #sets opacity to 0.. this will be used in the do loop in a minute...
    text = ""
    for i in @enemy.states #going through the statuses afflicted on the enemy
      if $data_states[i].rating >= 1 #when the rating of the statusis above 1
        if text == "" #and if there wasn't one prior to this status
          text = $data_states[i].name #then text will = the name of the inflicted statuf
        else #if there was a status inflicted already
          text = text + "/" + $data_states[i].name #then the new status is added along with the previous statuses
        end
      end
    end
    if text == ""
      text = "[Normal]" #no status is inflicted
    else
      text = "[" + text + "]" #adding the brackets to the statuses
    end
   
    if @enemy.steal_item_id == 0  #getting the info on the available items
      common = "None" #when stolen or not possessing an item.. returns none
    else
      common = $data_items[@enemy.steal_item_id].name.to_s  #otherwise it will return the name of the available item
    end
    if @enemy.steal_rare_id == 0
      rare = "None" #when stolen or not possessing an item.. returns none
    else
      rare =  $data_items[@enemy.steal_rare_id].name.to_s #otherwise it will return the name of the available item
    end
   
    if immune #if the enemy is immune to peeping then it will only display the name... and whatever the peep display constant contains
      self.contents.draw_text(10,-18,400,50,"Name: " + @enemy.name.to_s)
      self.contents.draw_text(0, self.height / 2,400-64,60, PEEP_IMMUNE_DISPLAY, 1)
    else #otherwise all the available information for the enemy is displayed...
      self.contents.draw_text(10,-18,400,50,"Name: " + @enemy.name.to_s)
      self.contents.draw_text(10,12,400,50,$data_system.words.hp.to_s + ": " + @enemy.hp.to_s + " / "  + @enemy.maxhp.to_s)
      self.contents.draw_text(10,42,400,50,$data_system.words.sp.to_s + ": " + @enemy.sp.to_s + " / " + @enemy.maxsp.to_s)
      self.contents.draw_text(10,72, 400, 50,"Exp: " + @enemy.exp.to_s)
      self.contents.draw_text(10,102,400,50,$data_system.words.gold.to_s + ": " + @enemy.gold.to_s)
      self.contents.draw_text(10, 132, 400, 50, "Current Status: " + text)
      self.contents.draw_text(10,162,400,50,"Common Steal: " + common)
      self.contents.draw_text(10,192,400,50,"Rare Steal: " + rare)
    end
   
    @sprite = Sprite.new #making the enemy sprite that i will be shrinking and moving from its current position...
    @sprite.bitmap = RPG::Cache.battler(@enemy.battler_name, @enemy.battler_hue) #getting the battle sprite of the enemy   
    @sprite.x = (@enemy.screen_x - (@sprite.bitmap.width / 2)) #the wierd ass formula that determines where the sprite is
    @sprite.y = (@enemy.screen_y - @sprite.bitmap.height)       #on the screen...
    @sprite.z = 9999
    old_center_x = @sprite.bitmap.width / 2  #these are two variables that are set up so that i can center
    old_center_y = @sprite.bitmap.height / 2 #zoom the battle sprite... it's cool looking...
    thing = (400 - (@sprite.bitmap.width / 4)) #the stopping x position
    div = 1 #the amount of zoom that the sprite is... uh... zoomed... this will be decreasing shortly
   
    #ok.. the meat of the window... and where all the cool stuff takes place... it's really cool..
    #i set up a loop so that the gameplay would pause.. except for what i wanted to happen...
    loop do
      Graphics.update #graphics update
      Input.update      #input update... so that the Input::C is always read...
      if Input.trigger?(Input::C) #when C is pressed
        dispose #the window is disposed and the rest of the battle is allowed to happen
        break #stop the loop
      end
     
      if self.opacity < 255 #this is where the fade in occurs...
        self.opacity = opacity #makes the back of the window = to opacity.. which was defined at the beginning of this method
        self.contents_opacity = opacity #same thing as above.. except that it's for the contents of the window
        unless opacity >= 255 #if opacity is less than 255 the 20 is added to it...
          opacity += 20
        end
      end
     
      if (@sprite.bitmap.width * div >= 200 or @sprite.bitmap.height * div >= 150) #if the sprite is too big.. then some shrinkin occurs
        @sprite.zoom_x = div #remember div? well this is where it shrinks the sprite.. zoom_x is the zooming functions for sprites
        @sprite.zoom_y = div #when it's over 1.. it will zoom in.. when its under 1 it will shrink.. that is what is happening in this case
        div -= 0.01  #takes div lower so that it can shrink more... its goes 0.01 so that it is smooth
        new_center_x = (@sprite.bitmap.width * div)  / 2 #updating the center x so that i can find the difference in the x and y positions so that i can
        new_center_y = (@sprite.bitmap.height * div) / 2 #move the x and y of the sprite to make it look like it's actually zooming inward
        x_move = new_center_x - old_center_x #this is where it gets the x and y
        y_move = new_center_y - old_center_y #to move the sprite down and right
        old_center_x = new_center_x #makes the old_center_x the new_center_x also does the same with y
        old_center_y = new_center_y #so that the whole process can be repeated during the next iteration of the loop
        @sprite.x -= x_move.to_i #moves the sprite the amount of x that was shrunk because of div and zoom_x
        @sprite.y -= y_move.to_i #same thing as the x
      else #when the sprite is an acceptable size...
        done = true #done is true and the movement can begin
      end

       unless done == false #if the shrinkig is finished...
        xlen = @sprite.x - thing #the length of the x
        ylen = @sprite.y - 40 #the length of the y
        len = Math.hypot(xlen, ylen) # the squareroot of xlen^2 and ylen^2, which is the length of the line
        len /= 5 #makes the length shorter.. so that it moves faster
        line = []
        line.push([@sprite.x, @sprite.y]) #push the starting points
        for i in 1..len
          #getting the points from the beggining to the end of the line
          newx = @sprite.x - ((xlen / len) * i)
          newy = @sprite.y - ((ylen / len) * i)
          newx = newx.to_i
          newy = newy.to_i
          line.push([newx, newy])
        end
        line.uniq! #removing any duplicates
        for i in 0...line.size
          Graphics.update
          givexy = line[i]
          @sprite.x = givexy[0] #moving the sprite to it's new x and y along the line...
          @sprite.y = givexy[1]
        end
      end
     end
   end

   def dispose
    @sprite.dispose
    self.contents.dispose
    super
  end
end

I'm not a scripter, so I am following makeamidget's advice regarding not touching the second part of the script.  Sweat
Can anyone please help?
It IS a bit ... messy...

The rewrite of the script's damage pop code erred with the 'non-theft' text position. They forgot about the 'critical' text pop's location.

The peep system had issues with differentiating between the peep_immune? method and the @peep_immune array. And I'm wondering what's the point when it only appears to show "Peeper!" and the window to show enemy stats doesn't even get triggered.
Yeah it was / is definitely a headache!
The script does work, though. It displays the enemy stats when you successfully peep.

Would there be a similar existing script that I can swap this out for that can do what I need?
- Scan / Peep
- Scan / Peep + damage (i.e. Mind Invade/Pierce)
- Steal item / equipment
- Mug (steal gold + damage)
I'm looking at this, cleaning it up in waves...

Trickster has a Steal/Mug/Scan script. However, it was written with the RMXP SDK as a requirement. And while MUG is possible, scan psychic damage is not an option.
Aw. I don't use SDK in my ancient project, so I can't use Trickster's script. Laughing
These guys sure didn't give anything in way of instructions, did they?
 
I managed to get the "Pepper" window to show.  However, I am a little... annoyed... that one does need to apply a target battle animation to the one being peeped.  My attempts were with a clean skill that had no battle animations, and thus the Peeper window wouldn't show.  An annoyance at least. But now understood.
 
Work may proceed.
 
Do be warned... The config page is GONNA GET WRECKED!!!   Joe Cool
 
 
EDIT:   A little before/after in how I clean things...

BEFORE: (two methods in RPG::Sprite modified by the script)
  # gets passed to it... also where the color changing for the steal popping is handled...
  #--------------------------------------------------------------------------
module RPG
  class Sprite < ::Sprite
   
    def update_animation
      if @_animation_duration > 0
        frame_index = @_animation.frame_max - @_animation_duration
        cell_data = @_animation.frames[frame_index].cell_data
        position = @_animation.position
        animation_set_sprites(@_animation_sprites, cell_data, position)
        for timing in @_animation.timings
          if timing.frame == frame_index
            animation_process_timing(timing, @_animation_hit)
          end
        end
      else
        dispose_animation
        if ($peep != nil) and (self.battler.is_a?(Game_Enemy))
          @super_mario_rpg = WindowPeep.new($peep, $peep_miss)
          $peep = nil
        end
      end
    end
 
    def update
      super
      if @_whiten_duration > 0
        @_whiten_duration -= 1
        self.color.alpha = 128 - (16 - @_whiten_duration) * 10
      end
      if @_appear_duration > 0
        @_appear_duration -= 1
        self.opacity = (16 - @_appear_duration) * 16
      end
      if @_escape_duration > 0
        @_escape_duration -= 1
        self.opacity = 256 - (32 - @_escape_duration) * 10
      end
      if @_collapse_duration > 0
        @_collapse_duration -= 1
        self.opacity = 256 - (48 - @_collapse_duration) * 6
      end
      if @_damage_duration > 0
        @_damage_duration -= 1
        case @_damage_duration
        when 38..39
          @_damage_sprite.y -= 4
        when 36..37
          @_damage_sprite.y -= 2
        when 34..35
          @_damage_sprite.y += 2
        when 28..33
          @_damage_sprite.y += 4
        end
        @_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32

        if @_damage_duration == 0
          $scene.pop_done = true
          dispose_damage
        end
      end
   
      if @_animation != nil and (Graphics.frame_count % 2 == 0)
        @_animation_duration -= 1
        update_animation
      end
      if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
        update_loop_animation
        @_loop_animation_index += 1
        @_loop_animation_index %= @_loop_animation.frame_max
      end
      if @_blink
        @_blink_count = (@_blink_count + 1) % 32
        if @_blink_count < 16
          alpha = (16 - @_blink_count) * 6
        else
          alpha = (@_blink_count - 16) * 6
        end
        self.color.set(255, 255, 255, alpha)
      end
      @@_animations.clear
    end
  end
end

AFTER:  (I saw I could just 'alias' the two methods)

#==============================================================================
# ** 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 @frankie_f12.nil?
    @frankie_f12 = true
    alias rpg_sprite_update_stealpeeper_update update
    alias rpg_sprite_update_stealpeeper_update_anim update_animation
  end
 
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    #
    # Flag the peeper pop done once the duration expired but before disposal
    $scene.pop_done = true if @_damage_duration == 0 && @_damage_sprite != nil
    #
    # Perform the original Method
    rpg_sprite_update_stealpeeper_update
    #
  end
 
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update_animation
    #
    # Once the animation duration is over
    if @_animation_duration == 0
      #
      # 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 = WindowPeep.new($peep, $peep_miss)
        $peep = nil
      end
      #
    end
    #
    # Perform the original method
    rpg_sprite_update_stealpeeper_update_anim
    #
  end
 
end

It works just the same, but shorter and cleaner code.

ALSO NOTE:
The damage pop code that was introduced assumed only two options were possible:
  1.   If no "ICON" (indicating a stolen item), then it was a normal damage pop depicting normal damage values
  2.   If there was an "ICON" (indicating a stolen item), then it ONLY showed the item stolen and no damage.

There was no in-between, so work would need to be done within the rewritten RPG::Sprite damage method in the script.  That is, if damage pops AND theft are requested simultaneously.... and cleanly.

The victim's 'damage' value (or self.damage) is currently holding the name of the item stolen and who stole it (for the thief to receive a pop).  This would negate having actual physical damage during a theft.  In other words... you can't mug anyone.

My idea is to replace the "ICON" being passed into the damage pop with an array: [type, ID, Actor_ID].  *This is how I brainstorm*  The params of this array are thus:
  • Type:  The type of item:  Item/Weapon/Armor
  • ID:  The ID of the item from its database
  • Actor_ID:  Well, I will look at the system.  Spit-balling, but basically to let it know who GETS the item stolen

Rather than generate the icon in the Game_Enemy code that performs its own damage pop... Get the icon in the RPG::Sprite system itself.



Quick lesson on how to 'replace' the old damage pop in Sprite_Battler without doing a whole dang rewrite:
#==============================================================================
# ** 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_update_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
    dmg                 = @battler.damage
    crit                = @battler.critical
    icon                = @battler.steal_icon
    #
    # Erase the default pop command
    @battler.damage_pop = false
    #
    # Perform the original method
    sprite_battler_update_stealpeeper_update
    #
    # If the pop was indeed valid
    if pop_steal_flag
      # Perform the updated damage pop and clear the values
      damage(dmg, crit, icon, @battler)
      @battler.damage      = nil                                                                       
      @battler.critical    = false
      @battler.steal_icon  = nil
      pop_steal_flag       = false
    end
    #
  end

end

Yeah, that reduced 100+ lines down to 48... and that's with me adding a lot o' comments and spacing while allowing for other aliased material.
[quote pid="62528" dateline="1738964420"]
DerVVulfman Wrote:These guys sure didn't give anything in way of instructions, did they?


Indeed! It was a pain to read through and make out how the whole system worked. Happy with a sweat

 
Quote:I managed to get the "Peeper" window to show.  However, I am a little... annoyed... that one does need to apply a target battle animation to the one being peeped.  My attempts were with a clean skill that had no battle animations, and thus the Peeper window wouldn't show.  An annoyance at least. But now understood.
 
Work may proceed.
Salute
 
Quote:Do be warned... The config page is GONNA GET WRECKED!!!   Joe Cool

 Does this refer to the list of items? I don't mind! That was super old and outdated (aside from that one boss whose armor I wanted to steal, I hadn't updated the item list in 20 years). If I have to repopulate, it's a small price to pay for progress!
 

Quote:It works just the same, but shorter and cleaner code.

This is highly appreciated!

Quote:ALSO NOTE:
The damage pop code that was introduced assumed only two options were possible:
  1.   If no "ICON" (indicating a stolen item), then it was a normal damage pop depicting normal damage values
  2.   If there was an "ICON" (indicating a stolen item), then it ONLY showed the item stolen and no damage.

There was no in-between, so work would need to be done within the rewritten RPG::Sprite damage method in the script.  That is, if damage pops AND theft are requested simultaneously.... and cleanly.

The victim's 'damage' value (or self.damage) is currently holding the name of the item stolen and who stole it (for the thief to receive a pop).  This would negate having actual physical damage during a theft.  In other words... you can't mug anyone.

That's OK with me! Though is it still possible to Mind Invade (i.e. Peep + Damage)?


Quote:My idea is to replace the "ICON" being passed into the damage pop with an array: [type, ID, Actor_ID].  *This is how I brainstorm*  The params of this array are thus:
  • Type:  The type of item:  Item/Weapon/Armor
  • ID:  The ID of the item from its database
  • Actor_ID:  Well, I will look at the system.  Spit-balling, but basically to let it know who GETS the item stolen

Rather than generate the icon in the Game_Enemy code that performs its own damage pop... Get the icon in the RPG::Sprite system itself.

This is great! Grinning

Quote:Yeah, that reduced 100+ lines down to 48... and that's with me adding a lot o' comments and spacing while allowing for other aliased material.

[/quote]

Blushing + Cheery I really appreciate that! 

(On a similar note, while reviewing some of my older event-based work from 2005, the 2024 Me kept shaking his head because I couldn't believe how inefficient some of my older work was. I used up too many switches (when self switch worked just as well) and one sequence involved me using multiple Parallel Processes for a cutscene with wait commands to time them all together (WHY, do that, 2005 Ace??? Though I later figured it was to allow the player to roam while waiting on other characters. Still, it is very inefficient and clunky and I rewrote the cutscene to be simpler and to use less resources.)
Okay, so the "Window_Steal" thingamabob popup won't show unless you have THAT battle animation too.  Really?  Not that I noticed before because I didn't put a freaking "HIT" animation on the act of theft before... but ugh.

Seeing that both the peep and the steal pop-up "windows" are both generated at the end of a battle animation suggests to me that the code within their edit of RPG::Sprite to turn on the pop-up flag could be streamlined a bit more.

EDIT:  Okay, some work on the CONFIG page...


module MM_Steal

  #--------------------------------------------------------------------------
  COMMON, RARE = {}, {}    # Do Not Touch
  #--------------------------------------------------------------------------

 
  # SKILL ID VALUES
  # ===============
  # These define the skill IDs  that permit the Steal and Peep actions
  #--------------------------------------------------------------------------
  #
    STEAL_ID          = 81
    PEEP_ID           = 82
   
  # WINDOW DURATION
  # ===============
  # These define how long the windows stay on screen (in frames)
  #--------------------------------------------------------------------------
  #   
    STEAL_DURATION    = 65
   
    PEEP_IMMUNE       = [1,3,5,31]
   
 
  # SKILL POP TEXTS
  # ===============
  # These define the text that appears when a Steal and/or Peep skill is used
  #--------------------------------------------------------------------------
  #
    STEAL_EMPTY_TEXT  = "No item to steal!"   # Damage pop if no items to steal
    STEAL_POP_FAIL    = "You Missed!  Chump!" # Damage pop on a failed theft
    STEAL_RARE_FAIL   = "Being stingy!"       # Damage pop on a failed rare theft
  #--------------------------------------------------------------------------
    PEEP_IMMUNE_TEXT  = "No Data Available"   # Shown in the display if immune
    PEEP_POP          = "Peeper!"             # Damage pop on a successful peep
    PEEP_IMMUNE_POP   = "Immune"              # Damage pop on an immune peep
    PEEP_POP_FAIL     = "Failed to Peep"      # Damage pop on a failed peep

   
   
  # ENEMY ITEMS
  # ===========
  # These define the items that can be stolen, common and rare
  #--------------------------------------------------------------------------
  #   
    COMMON[1]   = 1 #[0,1] # Assume Item(0) is Potion(1)
    COMMON[31]  = 3 #[0,3] # Assume Item(0) is Full Potion(3)
  #--------------------------------------------------------------------------
    RARE[1]     = 2 #[0,2] # Assume Item(0) is High Potion(2)
    RARE[31]    = 4 #[1,4] # Assume Weapon(1) is Mythril Sword(4)
   
end


I moved the definition of the stealable items as you can see.  And the whole 'Peep Immunity' thing ...  one configuration value made about a dozen lines of code obsolete.

I didn't move the color definitions in there yet.... but that's later.
Code:
# ENEMY ITEMS
  # ===========
  # These define the items that can be stolen, common and rare
  #--------------------------------------------------------------------------
  #   
    COMMON[1]   = 1 #[0,1] # Assume Item(0) is Potion(1)
    COMMON[31]  = 3 #[0,3] # Assume Item(0) is Full Potion(3)
  #--------------------------------------------------------------------------
    RARE[1]     = 2 #[0,2] # Assume Item(0) is High Potion(2)
    RARE[31]    = 4 #[1,4] # Assume Weapon(1) is Mythril Sword(4)

Quick question: where are the item/weapon/armor defined in that script? (Can it read #[1,4] for a Mythril Sword, or won't that text count as a comment and not part of the script?)
The arrays within those lines are commented out right now because the mechanics that read from the configuration page still assumes the stolen items are just items.  I need to alter/adjust the mechanics so they can read from the arrays which would allow for Item/Weapon/Armor types.

Once done, the configuration section would look a bit nicer...

  # ENEMY ITEMS
  # ===========
  # These define the items that can be stolen, common and rare
  #--------------------------------------------------------------------------
  #   
    COMMON[1]   = [0,1] # Assume Item(0) is Potion(1)
    COMMON[31]  = [0,3] # Assume Item(0) is Full Potion(3)
  #--------------------------------------------------------------------------
    RARE[1]     = [0,2] # Assume Item(0) is High Potion(2)
    RARE[31]    = [1,4] # Assume Weapon(1) is Mythril Sword(4)   

... and defining weapons and armor would be possible.

EDIT:   Okay, I got THAT part done.  Blushing + Cheery

Now for preliminary work, I am now assulting the WINDOW class code.  For example, the Window_Peep class now begins like this:


#==============================================================================
# ** Window_Peep
#------------------------------------------------------------------------------
#  This window class contains cursor movement and scroll functions.
#==============================================================================

class Window_Peep < Window_Base
 
  #--------------------------------------------------------------------------
  # * Object Initialization
  #    enemy  :
  #    immune :
  #--------------------------------------------------------------------------
  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          = 250
    self.contents_opacity = 250
    #
    # Set enemy and refresh
    @enemy                = enemy
    refresh(immune)
    #
  end

  #--------------------------------------------------------------------------
  # * Refresh
  #    immune : if enemy is blocked from being peeped/examined
  #--------------------------------------------------------------------------
  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


Clearly, its gonna be easier to manage and figure out when I get done with cleanup.

Oh, and yep, I do have Weapon/Armor theft right now.  But not mugging (yet).
Pages: 1 2