Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[XP]-Steal/Mug Script Combo Package!

How easy is this script to set up?

  • Very Easy!

    Votes: 1 12.5%
  • Easy

    Votes: 0 0.0%
  • Its alright...

    Votes: 2 25.0%
  • Kinda hard

    Votes: 0 0.0%
  • I DON'T KNOW WTF TO DO!!!

    Votes: 5 62.5%

  • Total voters
    8
Introduction

Good day everyone!

This is a Steal/Mug script, which allows you to designate a skill ID representing Steal or Mug. This script is pretty easy to set up and doesn't require events. There's no instructions included because this script is pretty self-explanetory and extremely easy to set up! However, if you're ever in doubt just reply here 'n I'll tell you how to.

This version is very BETA and will change to be more dynamic, but for now it gets the basic point across.

Requirements

SDK version 2.4 or higher, individual parts listing

GAME_BATTLER#ATTACK_EFFECT
GAME_BATTLER#SKILL_EFFECT
PART 3:SCENE_BATTLE
PART 4:SCENE_BATTLE

Place below 'SDK' & above 'main' if you don't already know :P

Script

Code:
#===============================================================================
# ** Skills Steal (Actor Version)
#-------------------------------------------------------------------------------
# Written by  : Kain Nobel
# Version     : 2.0
# Last Update : 10.02.2008
#===============================================================================
#-------------------------------------------------------------------------------
# * SDK Log
#-------------------------------------------------------------------------------
SDK.log('Skills.Steal/Mug', 'Kain Nobel', 2.0, '10.02.2008')
#-------------------------------------------------------------------------------
# * SDK Enabled Test - BEGIN
#-------------------------------------------------------------------------------
if SDK.enabled?('Skills.Steal/Mug')
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
# ~**                 CUSTOMIZABLE CONSTANTS - BEGIN                       **~ #
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
#-------------------------------------------------------------------------------
# * Set Steal/Mug Command Names
#-------------------------------------------------------------------------------
SDK::Scene_Commands::Scene_Battle::Mug   = "Mug"
SDK::Scene_Commands::Scene_Battle::Steal = "Steal"
#-------------------------------------------------------------------------------
# * Set Steal/Mug Skill ID
#-------------------------------------------------------------------------------
Skill_Steal   = 81
Skill_Mug     = 82
#-------------------------------------------------------------------------------
# * Set Steal List Enemy Items
#-------------------------------------------------------------------------------
Steal_Items   = {
  1 => [1]
}
#-------------------------------------------------------------------------------
# * Set Steal List Enemy Weapons
#-------------------------------------------------------------------------------
Steal_Weapons = {
  1 => [2]
}
#-------------------------------------------------------------------------------
# * Set Steal List Enemy Armors
#-------------------------------------------------------------------------------
Steal_Armors  = {
  1 => [2]
}
#-------------------------------------------------------------------------------
# * String for Steal : Success ('[?]' represents item)
#-------------------------------------------------------------------------------
Steal_Success = "You stole a [?]!"
#-------------------------------------------------------------------------------
# * String for Steal : Failure
#-------------------------------------------------------------------------------
Steal_Failure = "Couldn't steal anything..."
#-------------------------------------------------------------------------------
# * String for Steal : Nothing Left
#-------------------------------------------------------------------------------
Steal_Nothing = "Nothing to steal..."
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
# ~**                  CUSTOMIZABLE CONSTANTS - END                        **~ #
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
#===============================================================================
# ** Game_Actor
#-------------------------------------------------------------------------------
#   This class has been enhanced to handle steal/mug processing.
#===============================================================================

class Game_Battler
  #-----------------------------------------------------------------------------
  # * Alias Listings
  #-----------------------------------------------------------------------------
  alias_method :steal_atk_eff_2ndhitresult,      :attack_effect_second_hit_result
  alias_method :steal_atk_eff_damage,            :attack_effect_damage
  alias_method :steal_skl_eff_hit_result,        :skill_effect_second_hit_result
  alias_method :steal_skl_eff_damage,            :skill_effect_damage
  #-----------------------------------------------------------------------------
  # * Attack Effect Second Hit Result
  #-----------------------------------------------------------------------------
  def attack_effect_second_hit_result(attacker)
    steal_atk_eff_2ndhitresult(attacker)
    @attacker ||= attacker
  end
  #-----------------------------------------------------------------------------
  # * Attack Effect Damage
  #-----------------------------------------------------------------------------
  def attack_effect_damage
    steal_atk_eff_damage
    steal_effect if @attacker.is_a?(Game_Actor) && @attacker.has_mug?
  end
  #-----------------------------------------------------------------------------
  # * Steal Effect Hit Result
  #-----------------------------------------------------------------------------
  def steal_effect_hit_result(attacker)
    return (rand(100) < attacker.hit)
  end
  #-----------------------------------------------------------------------------
  # * Skill Effect Second Hit Result
  #-----------------------------------------------------------------------------
  def skill_effect_second_hit_result(user, skill)
    @attacker ||= user
    steal_skl_eff_hit_result(user, skill)
  end
  #-----------------------------------------------------------------------------
  # * Skill Effect Damage
  #-----------------------------------------------------------------------------
  def skill_effect_damage
    steal_skl_eff_damage
    if @attacker.is_a?(Game_Actor)
      if @attacker.current_action.basic == "Steal"
        steal_effect
      end
    end
  end
  #-----------------------------------------------------------------------------
  # * Steal Attack Effect Damage
  #-----------------------------------------------------------------------------
  def steal_effect
    unless self.steal_list.empty?
      if steal_effect_hit_result(@attacker)
        @attacker = nil
        stolen_item = self.steal_list[rand(self.steal_list.size)]
        if stolen_item.is_a?(RPG::Item)
          $game_party.gain_item(stolen_item.id, 1)
        elsif stolen_item.is_a?(RPG::Weapon)
          $game_party.gain_weapon(stolen_item.id, 1)
        elsif stolen_item.is_a?(RPG::Armor)
          $game_party.gain_armor(stolen_item.id, 1)
        end
        self.steal_list.delete(stolen_item)
        $scene.help_window.steal_success(stolen_item)
      else ; $scene.help_window.steal_failure
      end
    else ; $scene.help_window.steal_nothing
    end
  end
end

#===============================================================================
# ** Game_Actor
#-------------------------------------------------------------------------------
#   This class has been enhanced to check if actor has Steal/Mug.
#===============================================================================

class Game_Actor < Game_Battler
  #-----------------------------------------------------------------------------
  # * Has Steal?
  #-----------------------------------------------------------------------------
  def has_steal?
    return false if has_mug?
    return @skills.include?(Skill_Steal) if Skill_Steal.is_a?(Integer)
    if Skill_Steal.is_a?(String)
      @skills.each do |id|
        return true if $data_skills[id].name == Skill_Steal
      end
    end
    return false
  end
  #-----------------------------------------------------------------------------
  # * Has Mug?
  #-----------------------------------------------------------------------------
  def has_mug?
    return @skills.include?(Skill_Mug) if Skill_Mug.is_a?(Integer)
    if Skill_Mug.is_a?(String)
      @skills.each do |id|
        return true if $data_skills[id].name == Skill_Mug
      end
    end
    return false
  end
end

#===============================================================================
# ** Window_Help
#-------------------------------------------------------------------------------
#   This window has been enhanced to set message for steal success/failure.
#===============================================================================

class Window_Help
  #-----------------------------------------------------------------------------
  # * Steal Success
  #-----------------------------------------------------------------------------
  def steal_success(stolen_item)
    if Steal_Success.is_a?(String)
      string = Steal_Success
      string.gsub!("[?]", "#{stolen_item.name}")
      set_text(Steal_Success, 1)
      return
    end
    raise NoMethodError.new("Failed to create Help String for Steal_Success")
  end
  #-----------------------------------------------------------------------------
  # * Steal Failure
  #-----------------------------------------------------------------------------
  def steal_failure
    if Steal_Failure.is_a?(String)
      set_text(Steal_Failure, 1)
      return
    end
    raise NoMethodError.new("Failed to create Help String for Steal_Failure")
  end
  #-----------------------------------------------------------------------------
  # * Steal Nothing
  #-----------------------------------------------------------------------------
  def steal_nothing
    if Steal_Nothing.is_a?(String)
      set_text(Steal_Nothing, 1)
      return
    end
    raise NoMethodError.new("Failed to create Help String for Steal_Nothing")
  end
end

#===============================================================================
# ** Game_Enemy
#-------------------------------------------------------------------------------
#   This class has been enhanced to hold its own Steal list.
#===============================================================================

class Game_Enemy < Game_Battler
  #-----------------------------------------------------------------------------
  # * Public Instance Variables
  #-----------------------------------------------------------------------------
  attr_accessor :steal_list
  #-----------------------------------------------------------------------------
  # * Alias Listings
  #-----------------------------------------------------------------------------
  alias_method :steal_game_enemy_initialize, :initialize
  #-----------------------------------------------------------------------------
  # * Object Initialization
  #-----------------------------------------------------------------------------
  def initialize(troop_id, member_index)
    steal_game_enemy_initialize(troop_id, member_index)
    @steal_list = steal_list_master
  end
  #-----------------------------------------------------------------------------
  # * Steal List Items
  #-----------------------------------------------------------------------------
  def steal_items
    list = Array.new
    if Steal_Items.has_key?(id)
      unless Steal_Items[id].empty?
        Steal_Items[id].each do |item|
          if item.is_a?(Integer)
            list << $data_items[item]
          end
        end
      end
    end
    return list
  end
  #-----------------------------------------------------------------------------
  # * Steal List Weapons
  #-----------------------------------------------------------------------------
  def steal_weapons
    list = Array.new
    if Steal_Weapons.has_key?(id)
      unless Steal_Weapons[id].empty?
        Steal_Weapons[id].each do |weapon|
          if weapon.is_a?(Integer)
            list << $data_weapons[weapon]
          end
        end
      end
    end
    return list
  end
  #-----------------------------------------------------------------------------
  # * Steal List Armors
  #-----------------------------------------------------------------------------
  def steal_armors
    list = Array.new
    if Steal_Armors.has_key?(id)
      unless Steal_Armors[id].empty?
        Steal_Armors[id].each do |armor|
          if armor.is_a?(Integer)
            list << $data_armors[armor]
          end
        end
      end
    end
    return list
  end
  #-----------------------------------------------------------------------------
  # * Steal List All
  #-----------------------------------------------------------------------------
  def steal_list_master
    list = Array.new
    [steal_items, steal_weapons, steal_armors].each do |lists|
      lists.each do |item|
        list << item
      end
    end
    return list
  end
end

#===============================================================================
# ** Scene_Battle
#-------------------------------------------------------------------------------
#   This scene has been enhanced to change commands based on Steal/Mug skills.
#===============================================================================

class Scene_Battle < SDK::Scene_Base
  #-----------------------------------------------------------------------------
  # * Public Instance Variables
  #-----------------------------------------------------------------------------
  attr_reader   :help_window
  #-----------------------------------------------------------------------------
  # * Alias Listings
  #-----------------------------------------------------------------------------
  alias_method :steal_scnbtlp3_setup_command_window,:phase3_setup_command_window
  alias_method :steal_scnbtlp3_basic_command_input, :phase3_basic_command_input
  alias_method :steal_scnbtl_end_enemy_select,      :end_enemy_select
  #-----------------------------------------------------------------------------
  # * Phase 3 : Setup Command Window
  #-----------------------------------------------------------------------------
  def phase3_setup_command_window
    steal_scnbtlp3_setup_command_window
    actor = $game_party.actors[@actor_index]
    if actor.has_mug?
      unless @steal_command_set
        @steal_command_set = true
        commands = @actor_command_window.commands.dup
        commands[0] = SDK::Scene_Commands::Scene_Battle::Mug
        @actor_command_window.commands = commands
      end
    elsif actor.has_steal?
      unless @steal_command_set
        @steal_command_set = true
        commands = @actor_command_window.commands.dup
        commands.insert(2, SDK::Scene_Commands::Scene_Battle::Steal)
        unless commands.include?(SDK::Scene_Commands::Scene_Battle::Steal)
          commands << SDK::Scene_Commands::Scene_Battle::Steal
        end
        @actor_command_window.commands = commands
        @actor_command_window.refresh
      end
    end
  end
  #-----------------------------------------------------------------------------
  # * Phase 3 : Basic Command Input
  #-----------------------------------------------------------------------------
  def phase3_basic_command_input
    steal_scnbtlp3_basic_command_input
    case @actor_command_window.command
    when SDK::Scene_Commands::Scene_Battle::Mug
      phase3_command_attack
    when SDK::Scene_Commands::Scene_Battle::Steal
      phase3_command_steal
    end
  end
  #-----------------------------------------------------------------------------
  # * Phase 3 : Command Steal
  #-----------------------------------------------------------------------------
  def phase3_command_steal
    $game_system.se_play($data_system.decision_se)
    @active_battler.current_action.kind = 1
    @active_battler.current_action.basic = "Steal"
    @active_battler.current_action.skill_id = Skill_Steal
    start_enemy_select
  end
  #-----------------------------------------------------------------------------
  # * Phase 3 : End Enemy Select
  #-----------------------------------------------------------------------------
  def end_enemy_select
    unless @active_battler.current_action.basic == "Steal"
      steal_scnbtl_end_enemy_select
    else
      @enemy_arrow.dispose
      @enemy_arrow = nil
      @actor_command_window.active  = true
      @actor_command_window.visible = true
      @help_window.visible = false
    end
  end
end
#-------------------------------------------------------------------------------
# * SDK Enabled Test - BEGIN
#-------------------------------------------------------------------------------
end

Demo

Don't have one, if enough people are having problems with this system or don't know how to use it, I'll create a one.

Author's Notes

Feel free to post any suggestions and/or report any bugs here. Absolutely free to use in commercial/non-commercial games so long as 1.) I am credited, 2.) You send me a friendly reply or PM telling that you'll be using it :thumb:
 
Oh wow, this is awesome! Do those hashes mean you can assign an infinite amount of items/weapons/armors to a single enemy?

-Krobe
 
Yeah, you can assign whatever kinds of items, weapons and armors as you want to your Enemies. I am pleased as it is a great first attempt at a Steal script, but after seeing Trickster's version I decided I wanted to re-write mine, and I aim to even make it better than his (but lets be modest here, Trickster's is still pretty cool :thumb:)

I will leave this Beta version posted until I get this one done, this is going to be a helluvalot cooler script if I ever finish it. I took alot of tips seeing his system, how he has Steal skills set up by Element ID, I'm going to do that too. Steal::Skill_ID will be the ID of the 'main' steal command, and you'll be able to assign other Steal/Mug-type skills in your Skill Menu too based off element tag.

Here is a teaser of the only thing I've gotten re-started on is the brand new Steal module.

Code:
#===============================================================================
# ** Steal
#-------------------------------------------------------------------------------
#   This module handles element tag for 'Steal' skills, and skill ID and Command 
# Name for main "Steal" command.
#===============================================================================
module Steal
  Elem_Tag = 30
  Skill_ID = 81
  Command  = "Steal"
end
#===============================================================================
# ** Mug
#-------------------------------------------------------------------------------
#   This module handles element tag for 'Mug' skills, and skill ID and Command 
# Name for main "Mug" command.
#===============================================================================
module Steal::Mug
  Elem_Tag = 31
  Skill_ID = 82
  Command  = "Mug"
end
#===============================================================================
# ** Steal::Actors
#-------------------------------------------------------------------------------
#   This module handles actors who have Steal/Mug default, and Reserved Items
#===============================================================================
module Steal::Actors
  Has_Mug   = []
  Has_Steal = []
  Reserved_Items    = []
  Reserved_Weapons  = []
  Reserved_Armors   = []
end
#===============================================================================
# ** Steal::Enemies
#-------------------------------------------------------------------------------
#   This module handles enemies who have Steal/Mug default, and List of Items
#===============================================================================
module Steal::Enemies
  Has_Mug   = []
  Has_Steal = []
  List_Items    = {}
  List_Weapons  = {}
  List_Armors   = {}
end
#===============================================================================
# ** Steal::FromActors
#-------------------------------------------------------------------------------
#   This module handles how Enemies steal from Actors.
#===============================================================================
module Steal::FromActors
  Enabled = true
  Steal_Back = true
  Probability_Items   = {}
  Probability_Weapons = {}
  Probability_Armors  = {}
  Probability_Gold    = []
  Probability_Items.default   = 50
  Probability_Weapons.default = 25
  Probability_Armors.default  = 25
end
#===============================================================================
# ** Steal::FromEnemies
#-------------------------------------------------------------------------------
#   This module handles how Actors steal from Enemies.
#===============================================================================
module Steal::FromEnemies
  Enabled = true
  Steal_Back = true
  Probability_Items   = {}
  Probability_Weapons = {}
  Probability_Armors  = {}
  Probability_Items.default = 50
  Probability_Weapons.default = 25
  Probability_Armors.default  = 25
end
#===============================================================================
# ** Steal::Items
#-------------------------------------------------------------------------------
#   This module handles specific and individual probabilities for Items.
#===============================================================================
module Steal::Items
  Probabilities = {}
end
#===============================================================================
# ** Steal::Weapons
#-------------------------------------------------------------------------------
#   This module handles specific and individual probabilities for Weapons.
#===============================================================================
module Steal::Weapons
  Probabilities = {}
end
#===============================================================================
# ** Steal::Armors
#-------------------------------------------------------------------------------
#   This module handles specific and individual probabilities for Armors.
#===============================================================================
module Steal::Armors
  Probabilities = {}
end
 
Depending, does the CBS use the SDK at all? If not, it shouldn't be that hard to implement, if you direct me to the script I'll see how it works. I did do this just based off Default BS and SDK method splits of Game_Battler #attack_effect and #skill_effect, but those should be easy mods.

This new version I'm working on will be easier to non-SDK, but will still require some edits depending on which CBS you're using. (This one is prettymuch outdated as of today, I re-wrote the entire script on a new project.) I'm about 70% done with it, lets hope I can get it up by tonight. When that one is done, I'll make quick 'n easy instructions for any exotic CBS you may need patch for.

I'll write instructions on how to plug the steal_effect commands 'n such into a non-SDK CBS for the *new* version when its up, for the old version Vs your CBS just link me to the script and I'll see what I can do with it if it doesn't work together already.
 
Oh wow! I like what I see so far! But be careful, too much hashes might scare off the newbs.. o.O

In any case.. what are the 'reserved' items for? Like.. key items that the opponent shouldn't be able to steal from you? And if you would, think about this; Make a hash allowing certain enemies whom can steal/mug to be able to use the item stolen afterwards, or make a skill to use the item stolen, and they have a chance to use the stolen item, or if they steal more, then it's randomized whichever item is used. And it can work for AI controlled Actors too..? haha..

And maybe the enemy can steal an item equipped to the Actor, and vice-versa, but then you'd have to make enemies be able to equip armors and weapons.. and if that were to happen then you might as well rewrite that script that someone (can't remember off the top of my head) made that allows copies of actors to be battled in place of monsters and you able to catch them and multiple copies as well. I have those scripts (which are surprisingly small) if you're interested in messing around with them.

But yea.. those are my 2943 cents for tonight =D, I can't wait to see the finished script!

Good Luck!
-Krobe
 
Kain Nobel":9g6yzucx said:
Depending, does the CBS use the SDK at all? If not, it shouldn't be that hard to implement, if you direct me to the script I'll see how it works. I did do this just based off Default BS and SDK method splits of Game_Battler #attack_effect and #skill_effect, but those should be easy mods.

This new version I'm working on will be easier to non-SDK, but will still require some edits depending on which CBS you're using. (This one is prettymuch outdated as of today, I re-wrote the entire script on a new project.) I'm about 70% done with it, lets hope I can get it up by tonight. When that one is done, I'll make quick 'n easy instructions for any exotic CBS you may need patch for.

I'll write instructions on how to plug the steal_effect commands 'n such into a non-SDK CBS for the *new* version when its up, for the old version Vs your CBS just link me to the script and I'll see what I can do with it if it doesn't work together already.
Here is the thread of that cbs:
http://www.rmxp.org/forums/index.php?topic=24608.0

it doesnt use SDK. But it's a large cbs with different scripts. I hope you can have a look at it :)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top