# Help with a specific script?

This topic is 968 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I have recently purchased RPG Maker XV Ace, and
have begun just messing with bits and pieces.
I have a specific script I am trying to input, and customize.

The issue is, I have no previous scripting experience, and have
no idea how to customize the specific script.

Here is the script, I need to know how to customize it, so that a specific character has the skill.

Any help would be greatly appreciated, thanks!

#--# Steal Ability v 1.1
#
# Allows to create abilities that steal items or gold from enemies.
#  Or abilities! Which last until the end of the battle.
#
# Usage: Plug and play, customize and set up note tags as needed.
#
#   Enemy Notetags:
#    Id is the id of the item and chance is the percentage of success
#     <STEAL ITEM id chance>
#     <STEAL WEAPON id chance>
#     <STEAL ARMOR id chance>
#     <STEAL ABILITY id>
#     <STEAL GOLD amount>
#
#   Skill/Class/Actor/Equips notetags:
#     <STEAL>      - Skill only, allows skill to steal items
#     <PICKPOCKET> - Skill only, allows skill to steal gold
#     <STEAL_ABILITY> - Skill only, allows skill to steal ability
#     <STEAL CHANCE bonus> - provides a percentage bonus to steal chance
#
#------#
#-- Script by: V.M of D.T
#
#- Questions or comments can be:
#    given by email: sumptuaryspade@live.ca
#   All my other scripts and projects can be found here: http://daimonioustails.weebly.com/
#
#--- Free to use in any project, commercial or non-commercial, with credit given
#--Though a donation's always a nice way to say thank you~ (I also accept actual thank you's)

ABILITY_STEAL_CHANCE = 100
PICKPOCKET_STEAL_CHANCE = 60

class RPG::Enemy
def steal_array
steal = {}
notes = self.note.clone
while notes =~ /<STEAL ITEM (\d+) (\d+)>/
steal[[0,$1.to_i]] =$2.to_i
notes[notes.index("<STEAL")] = "N"
end
while notes =~ /<STEAL WEAPON (\d+) (\d+)>/
steal[[1,$1.to_i]] =$2.to_i
notes[notes.index("<STEAL")] = "N"
end
while notes =~ /<STEAL ARMOR (\d+) (\d+)>/
steal[[2,$1.to_i]] =$2.to_i
notes[notes.index("<STEAL")] = "N"
end
steal
end
def gold_amount
self.note =~ /<STEAL GOLD (\d+)>/ ? $1 : 0 end def ability_steal self.note =~ /<STEAL ABILITY (\d+)>/ ?$1 : 0
end
end

class RPG::UsableItem
def steal?
self.note.include?("<STEAL>")
end
def pickpocket?
self.note.include?("<PICKPOCKET>")
end
def steal_ability?
self.note.include?("<STEAL_ABILITY>")
end
end

class RPG::BaseItem
def steal_chance
self.note =~ /<STEAL CHANCE (\d+)>/ ? $1.to_i : 0 end end class Game_Enemy alias steal_init initialize def initialize(*args) steal_init(*args) @steal = enemy.steal_array.clone @gold = enemy.gold_amount.to_i @ability = enemy.ability_steal.to_i end def steal_array @steal end def steal(user,skill) steal_array.each do |id,chance| if rand(100) < chance + user.steal_bonus(skill) if Module.const_defined?(:AFFIXES) item =$game_party.add_item(id[1],1) if id[0] == 0
item = $game_party.add_weapon(id[1],1) if id[0] == 1 item =$game_party.add_armor(id[1],1) if id[0] == 2
else
item = $data_items[id[1]] if id[0] == 0 item =$data_weapons[id[1]] if id[0] == 1
item = $data_armors[id[1]] if id[0] == 2$game_party.gain_item(item,1)
end
@steal[id] = -1000
return item
end
end
return nil
end
def pickpocket(user,skill)
return nil if @gold == 0
if rand(100) < PICKPOCKET_STEAL_CHANCE + user.steal_bonus(skill)
amount = rand(enemy.gold_amount.to_i) / 5 * (user.steal_bonus(skill) / 100.to_f + 1)
if amount > @gold
amount = @gold
end
@gold -= amount
$game_party.gain_gold(amount.to_i) return amount.to_i end return nil end def steal_ability(user,skill) return nil if @ability == 0 if rand(100) < ABILITY_STEAL_CHANCE + user.steal_bonus(skill) user.add_stolen_ability(@ability) return @ability end return nil end end class Game_Actor def steal_bonus(item) bonus = item.steal_chance bonus += self.actor.steal_chance bonus += self.class.steal_chance @equips.each do |item| next if item.is_nil? bonus += item.object.steal_chance end bonus end def add_stolen_ability(skill_id) @stolen_ability = [] if @stolen_ability.nil? @stolen_ability.push(skill_id) learn_skill(skill_id) end def clear_stolen_ability return unless @stolen_ability @stolen_ability.each do |skill_id| forget_skill(skill_id) end @stolen_ability = [] end def on_battle_end super clear_stolen_ability end end class Scene_Battle def apply_item_effects(target, item) target.item_apply(@subject, item) refresh_status if item.steal? stolen_item = target.steal(@subject,item) target.result.success = true end if item.pickpocket? stolen_gold = target.pickpocket(@subject,item) target.result.success = true end if item.steal_ability? stolen_ability = target.steal_ability(@subject,item) target.result.success = true end @log_window.display_action_results(target, item) if item.steal? || item.pickpocket? || item.steal_ability? if stolen_item @log_window.display_theft(@subject,stolen_item) end if stolen_gold @log_window.display_pickpocket(@subject,stolen_gold) end if stolen_ability @log_window.display_ability_steal(@subject,target,stolen_ability) end @log_window.display_theft_fail(@subject) if !stolen_item && !stolen_gold && !stolen_ability end end end class Window_BattleLog def display_theft(user,item) add_text(user.name + " stole a " + item.name) wait end def display_theft_fail(user) add_text(user.name + " failed to steal anything") wait end def display_pickpocket(user,gold) add_text(user.name + " pickpocketed " + gold.to_s + " " + Vocab::currency_unit) wait end def display_ability_steal(user,target,ability) add_text(user.name + " stole " + target.name + "'s " +$data_skills[ability].name + " ability!")
wait
end
end

##### Share on other sites

Not many people are familiar with RGSS. I know the XP variant, but it looks like there have been a lot of changes since then. You may have better luck looking for an RMMV dedicated forum.

##### Share on other sites

It's been years since I last dabbled with RPG Maker, but looking at the code and the info comment, all you have to do is create a Steal skill and put <STEAL> in its note tag, and then you give that skill to your thief.

By the way that script is very cool.   The steal effect is coded to trigger in addition to the other skill effect so you can put <STEAL> it on a physical attack and you can make a Capture command like Locke has in Final Fantasy VI. (One that rolls attack and steal into one action.) And looking at the code, it looks like you have a new steal chance bonus stat so you can create items that buff thieves. It also has other effect like pick pocket, or blue mage style ability stealing. I wish we had that back in RPG Maker 2000. (I had to hack a Steal command using RPG Maker event.  )

1. 1
Rutin
23
2. 2
3. 3
JoeJ
20
4. 4
5. 5

• 32
• 41
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631742
• Total Posts
3001987
×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!