Kain Nobel
Member
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
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:
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: