Shoplifting

I am trying to get this script: https://grimoirecastle.wordpress.com/rgss3-scripts/gameplay-scripts/shoplifting/
The only problem is the dropbox link is dead and it is not in the repository. Any help is appreciated.
https://forums.rpgmakerweb.com/index.php?threads/recovering-lost-scripts.103561/
follow the link in the post
Look under Kread-Ex
Thats the name of the author for scripts for Grimoire Castle
https://forums.rpgmakerweb.com/index.php?threads/recovering-lost-scripts.103561/
follow the link in the post
Look under Kread-Ex
Thats the name of the author for scripts for Grimoire Castle
https://grimoirecastle.wordpress.com/rgss3-scripts/gameplay-scripts/shoplifting/ I am trying to use this script in my game but it came up with this error:
Screenshot_1.png

How do i fix this?
did you start a new game or from a saved one?
did you start a new game or from a saved one?
New game.
Some testing gets this to work
Code:
class Window_ShopCommand < Window_HorzCommand
  #--------------------------------------------------------------------------
  # ● Create the list of commands
  #--------------------------------------------------------------------------
  def make_command_list
    add_command(Vocab::ShopBuy,    :buy)
    add_command(Vocab::ShopSell,   :sell,   !@purchase_only)
    # Make sure the scene isn't the synthesis shop
    if ($imported['KRX-SynthesisShop'] == true) &&
      (SceneManager.scene_is?(Scene_SynthesisShop))
    else
      add_command(KRX::VOCAB::SHOPLIFT_COMMAND, :steal, steal_ok?)
    end # End check
    add_command(Vocab::ShopCancel, :cancel)
  end
  #--------------------------------------------------------------------------
  # ● Determine if the class requirement is fullfilled
  #--------------------------------------------------------------------------
  def steal_ok?
    return true unless KRX::NEED_THIEF
    return $game_party.leader.class.steal_ok
  end
end
Some testing gets this to work
Code:
class Window_ShopCommand < Window_HorzCommand
  #--------------------------------------------------------------------------
  # ● Create the list of commands
  #--------------------------------------------------------------------------
  def make_command_list
    add_command(Vocab::ShopBuy,    :buy)
    add_command(Vocab::ShopSell,   :sell,   !@purchase_only)
    # Make sure the scene isn't the synthesis shop
    if ($imported['KRX-SynthesisShop'] == true) &&
      (SceneManager.scene_is?(Scene_SynthesisShop))
    else
      add_command(KRX::VOCAB::SHOPLIFT_COMMAND, :steal, steal_ok?)
    end # End check
    add_command(Vocab::ShopCancel, :cancel)
  end
  #--------------------------------------------------------------------------
  # ● Determine if the class requirement is fullfilled
  #--------------------------------------------------------------------------
  def steal_ok?
    return true unless KRX::NEED_THIEF
    return $game_party.leader.class.steal_ok
  end
end
It works but now it has everything i can normally buy as stealable, how do i fix this?
From What I can tell, that is how the script is designed. You could put a 0% chance on every item you don't want stolen. Or change the default to 0 and set a chance on items you want stolen.
From What I can tell, that is how the script is designed. You could put a 0% change on every item you don't want stolen. Or change the default to 0 and set a chance on items you want stolen.
Default to 0? What do you mean? (Sorry if this is a stupid question)
if ($imported['KRX-SynthesisShop'] == true) &&
(SceneManager.scene_is?(Scene_SynthesisShop))

It could be replaced with

if (Objects.constants.include?("Scene_SynthesisShop") and SceneManager.scene_is?(Scene_SynthesisShop))

if (Objects.constants.include?🙂Scene_SynthesisShop) and SceneManager.scene_is?(Scene_SynthesisShop))

or even

HAS_SYNTHESIS = Objects.constants.include?("Scene_SynthesisShop")

if (HAS_SYNTHESIS and SceneManager.scene_is?(Scene_SynthesisShop))

Depending on the Ruby version running there. Thus you can avoid creating just another $global variable.
Just saying...

And slick, if you're handling a hash, then it has a default value method

@some_hash.default = 0
if ($imported['KRX-SynthesisShop'] == true) &&
(SceneManager.scene_is?(Scene_SynthesisShop))

It could be replaced with

if (Objects.constants.include?("Scene_SynthesisShop") and SceneManager.scene_is?(Scene_SynthesisShop))

if (Objects.constants.include?🙂Scene_SynthesisShop) and SceneManager.scene_is?(Scene_SynthesisShop))

or even

HAS_SYNTHESIS = Objects.constants.include?("Scene_SynthesisShop")

if (HAS_SYNTHESIS and SceneManager.scene_is?(Scene_SynthesisShop))

Depending on the Ruby version running there. Thus you can avoid creating just another $global variable.
Just saying...

And slick, if you're handling a hash, then it has a default value method

@some_hash.default = 0
@kyonides I am not seeing anything with the = 0.
Default to 0? What do you mean?
Code:
module KRX
#===========================================================================
# ■ CONFIGURATION
#===========================================================================

  BUSTED_SWITCH_ID = 2
  DEFAULT_STEAL_CHANCE = 100   <-######################## This here
  INFAMY_VARIABLE_ID = 4
  NEED_THIEF = true # Set this to false so everybody can steal
 
  module VOCAB
    SHOPLIFT_COMMAND = 'Steal'
  end
Code:
module KRX
#===========================================================================
# ■ CONFIGURATION
#===========================================================================

  BUSTED_SWITCH_ID = 2
  DEFAULT_STEAL_CHANCE = 100   <-######################## This here
  INFAMY_VARIABLE_ID = 4
  NEED_THIEF = true # Set this to false so everybody can steal
 
  module VOCAB
    SHOPLIFT_COMMAND = 'Steal'
  end
That worked, thanks for the help.
That worked
Try this addon I just made
Spoiler: Kread-Ex - ShopLifting addon
Code:
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#  ▼ Shoplifting
#  Author: Kread-EX
#  Addon: Roninator2
#  Version 1.02.01 # addon
#  Release date: 13/12/2019
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

#------------------------------------------------------------------------------
#  ▼ UPDATES
#------------------------------------------------------------------------------
# # 13/12/2019. Added steal_item to stop stealing everything.
# # 10/12/2012. Added class bonus and requirement. Couple bug fixes.
# # 02/12/2012. Added a variable to keep track of steal attempts.
#------------------------------------------------------------------------------
#  ▼ TERMS OF USAGE
#------------------------------------------------------------------------------
# #  You are free to adapt this work to suit your needs.
# #  You can use this work for commercial purposes if you like it.
# #  Credit is appreciated.
# #
# # For support:
# # grimoirecastle.wordpress.com
# # rpgmakerweb.com
#------------------------------------------------------------------------------
#  ▼ INTRODUCTION
#------------------------------------------------------------------------------
# # You can steal from shops, making you a THIEF. You can customize the %
# # chance of being caught, and how much agility and luck influence
# # your chances.
#------------------------------------------------------------------------------
#  ▼ INSTRUCTIONS
#------------------------------------------------------------------------------
# # In the item/weapon/armor database tabs, you must use the following notetag
# # to make the option to steal the item:

# # <steal_item> # must be used to specify if an item can be stolen
# #
#------------------------------------------------------------------------------

module KRX
  module REGEXP
    STEAL_ITEM = /<steal_item>/i
  end
end

module KRX
  module SHOPLIFT
    attr_reader   :steal_item
    attr_reader   :steal_chance
    attr_reader   :steal_agi
    attr_reader   :steal_luk
    def load_shoplift_notetags
      @note.split(/[\r\n]+/).each do |line|
        case line     
        when KRX::REGEXP::STEAL_CHANCE
          @steal_chance = $1.to_i
        when KRX::REGEXP::STEAL_AGILITY
          @steal_agi = $1.to_i
        when KRX::REGEXP::STEAL_LUCK
          @steal_luk = $1.to_i
        when KRX::REGEXP::STEAL_ITEM
          @steal_item = true
        end
      end
    end
  
  end
end

class Window_ShopSteal < Window_ShopBuy
  def draw_item(index)
    item = @data[index]
    rect = item_rect(index)
    draw_item_name(item, rect.x, rect.y, enable?(item))
    rect.width -= 4
    leader = $game_party.leader
    chance = item.steal_chance || KRX::DEFAULT_STEAL_CHANCE
    chance += (leader.agi * (item.steal_agi || 0) / 100.00)
    chance += (leader.luk * (item.steal_luk || 0) / 100.00)
    chance += (leader.class.steal_class || 0)
    chance = 100 if chance > 100
    chance = chance.round
    draw_text(rect, chance.to_s + '%', 2) if item.steal_item
  end

  def enable?(item)
    item.steal_item
  end
end

Mark items in your inventory with <steal_item> to make them steal-able.
Try this addon I just made
Spoiler: Kread-Ex - ShopLifting addon
Code:
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#  ▼ Shoplifting
#  Author: Kread-EX
#  Addon: Roninator2
#  Version 1.02.01 # addon
#  Release date: 13/12/2019
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

#------------------------------------------------------------------------------
#  ▼ UPDATES
#------------------------------------------------------------------------------
# # 13/12/2019. Added steal_item to stop stealing everything.
# # 10/12/2012. Added class bonus and requirement. Couple bug fixes.
# # 02/12/2012. Added a variable to keep track of steal attempts.
#------------------------------------------------------------------------------
#  ▼ TERMS OF USAGE
#------------------------------------------------------------------------------
# #  You are free to adapt this work to suit your needs.
# #  You can use this work for commercial purposes if you like it.
# #  Credit is appreciated.
# #
# # For support:
# # grimoirecastle.wordpress.com
# # rpgmakerweb.com
#------------------------------------------------------------------------------
#  ▼ INTRODUCTION
#------------------------------------------------------------------------------
# # You can steal from shops, making you a THIEF. You can customize the %
# # chance of being caught, and how much agility and luck influence
# # your chances.
#------------------------------------------------------------------------------
#  ▼ INSTRUCTIONS
#------------------------------------------------------------------------------
# # In the item/weapon/armor database tabs, you must use the following notetag
# # to make the option to steal the item:

# # <steal_item> # must be used to specify if an item can be stolen
# #
#------------------------------------------------------------------------------

module KRX
  module REGEXP
    STEAL_ITEM = /<steal_item>/i
  end
end

module KRX
  module SHOPLIFT
    attr_reader   :steal_item
    attr_reader   :steal_chance
    attr_reader   :steal_agi
    attr_reader   :steal_luk
    def load_shoplift_notetags
      @note.split(/[\r\n]+/).each do |line|
        case line    
        when KRX::REGEXP::STEAL_CHANCE
          @steal_chance = $1.to_i
        when KRX::REGEXP::STEAL_AGILITY
          @steal_agi = $1.to_i
        when KRX::REGEXP::STEAL_LUCK
          @steal_luk = $1.to_i
        when KRX::REGEXP::STEAL_ITEM
          @steal_item = true
        end
      end
    end
 
  end
end

class Window_ShopSteal < Window_ShopBuy
  def draw_item(index)
    item = @data[index]
    rect = item_rect(index)
    draw_item_name(item, rect.x, rect.y, enable?(item))
    rect.width -= 4
    leader = $game_party.leader
    chance = item.steal_chance || KRX::DEFAULT_STEAL_CHANCE
    chance += (leader.agi * (item.steal_agi || 0) / 100.00)
    chance += (leader.luk * (item.steal_luk || 0) / 100.00)
    chance += (leader.class.steal_class || 0)
    chance = 100 if chance > 100
    chance = chance.round
    draw_text(rect, chance.to_s + '%', 2) if item.steal_item
  end

  def enable?(item)
    item.steal_item
  end
end

Mark items in your inventory with <steal_item> to make them steal-able.
Do I have to have the item in the shop list for them to be in the steal list?

Original thread: https://forums.rpgmakerweb.com/threads/shoplifting.116154/