gmaker808 0 Report post Posted June 25, 2013 I'm trying to convert the master thief script so that it's compatible with Blizz Abs I know it's probably ferly easy but I really suck at this I don't know where to pull from to change it so that it's pulling an item, weapon, armor, or gold fron the event instead of troops. Someone please help it'd be much appreciated please. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=# Master Thief Skill by Blizzard# Version: 1.0b# Type: Enhanced Skill# Date: 19.10.2008# Date v1.0b: 6.10.2009#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=## This skill allows stealing items or gold from enemies or vice versa. The# skill success probability is multiplied with the enemy success probability# which makes it possible to make different skills and enemy combinations.# Success rates of skills higher than 100% will make it easier to steal from# enemies.# # Gold and item loot are slightly different. While only one item can be# stolen at the time, gold can be stolen all at once. The loot with a higher# success rate has priority over loot with lower success priority.#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= #==============================================================================# module BlizzCFG#============================================================================== module BlizzCFG def self.steal_skill_database(id) case id#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::# START Steal Database## Use following template to create Stealing Skills:## when ID then return RATE## ID - ID of the skill in the database# RATE - success multiplier rate in percents## Example:## when 23 then return 200# when 24 then return 100# # Skill with ID 23 will be twice as successful when stealing things than# skill with ID 24.#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: when 132 then return 100 #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::# END Demi Database#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: end return 0 end def self.weapon_loot_database(id) case id#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::# START Weapon Loot Database## Use following template to create weapon loot for enemies:## when ID then return [[WEAPON_ID1, AMOUNT1, RATE1], ...]## WEAPON_ID - ID of the item in the database# AMOUNT - how many can be stolen# RATE - success rate in percents## Example:## when 1 then return [[1, 2, 50], [4, 1, 10]]# # Enemy with ID 1 possesses 2 weapons of ID 1 and the success rate to steal# one is 50% and 1 weapon of ID 4 with a success rate of 10%.#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: when 1 then return [[1, 2, 50], [2, 1, 10]] when 0 then return [[2, 1, 80]]#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::# END Item Loot Database#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: end return [] end def self.armor_loot_database(id) case id#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::# START Armor Loot Database## Use following template to create armor loot for enemies:## when ID then return [[ARMOR_ID1, AMOUNT1, RATE1], ...]## ARMOR_ID - ID of the item in the database# AMOUNT - how many can be stolen# RATE - success rate in percents## Example:## when 1 then return [[1, 2, 50], [4, 1, 10]]# # Enemy with ID 1 possesses 2 armors of ID 1 and the success rate to steal# one is 50% and 1 armor of ID 4 with a success rate of 10%.#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: when 1 then return [[1, 1, 20], [2, 1, 30]]#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::# END Item Loot Database#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: end return [] end def self.item_loot_database(id) case id#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::# START Item Loot Database## Use following template to create item loot for enemies:## when ID then return [[iTEM_ID1, AMOUNT1, RATE1], ...]## ITEM_ID - ID of the item in the database# AMOUNT - how many can be stolen# RATE - success rate in percents## Example:## when 1 then return [[1, 2, 50], [4, 1, 10]]# # Enemy with ID 1 possesses 2 items of ID 1 and the success rate to steal one# is 50% and 1 item of ID 4 with a success rate of 10%.#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: when 1 then return [[4, 1, 100]]#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::# END Item Loot Database#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: end return [] end def self.gold_loot_database(id) case id#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::# START Gold Loot Database## Use following template to create gold loot for enemies:## when ID then return [AMOUNT, BASE, RATE]## AMOUNT - how many can be stolen# BASE - probability calculation base# RATE - success rate in percents## Example:## when 3 then return [300, 100, 90]# # Enemy with ID 1 possesses 300 gold and the success rate to steal each 100# pieces of gold is 90%. Since the enemy has 300 gold, the success chance to# steal all 300 at once is 90% * 90% * 90% = 72.9%. If at first 100 gold was# stolen, the enemy is still in possession of 200 more gold hence the# success rate to steal the remaining 200 gold is 90% * 90% = 81%.#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: when 1 then return [300, 100, 90] when 0 then return [1000, 200, 70]#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::# END Gold Loot Database#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: end return nil end end #==============================================================================# Game_Temp#============================================================================== class Game_Temp attr_accessor :loot_data end #==============================================================================# Game_Battler#============================================================================== class Game_Battler alias skill_effect_master_thief_later skill_effect def skill_effect(user, skill) result = skill_effect_master_thief_later(user, skill) if $game_system.MASTER_THIEF && self.is_a?(Game_Enemy) rate = BlizzCFG.steal_skill_database(skill.id) self.set_loot(rate) if rate != 0 end return result end end #==============================================================================# Game_Enemy#============================================================================== class Game_Enemy alias init_master_thief_later initialize def initialize(troop_id, member_index) init_master_thief_later(troop_id, member_index) @loot = [] BlizzCFG.weapon_loot_database(self.id).each {|w| @loot.push([0] + w)} BlizzCFG.armor_loot_database(self.id).each {|a| @loot.push([1] + a)} BlizzCFG.item_loot_database(self.id).each {|i| @loot.push([2] + i)} gold = BlizzCFG.gold_loot_database(self.id) @loot.push([3] + gold) if gold != nil end def set_loot(rate) possible_loot = self.get_possible_loot(rate) if possible_loot == nil $game_temp.loot_data = [false] elsif possible_loot.size == 0 $game_temp.loot_data = [true] else $game_temp.loot_data = possible_loot.max {|a, b| a[2] <=> b[2]} if $game_temp.loot_data[0] == 3 @loot.each_index {|i| if @loot[0] == 3 @loot[1] -= $game_temp.loot_data[1] @loot = nil if @loot[1] <= 0 end} @loot.compact! else $game_temp.loot_data[2] -= 1 @loot.delete($game_temp.loot_data) if $game_temp.loot_data[2] == 0 end end end def get_possible_loot(rate) return nil if @loot.size == 0 possible_loot = [] @loot.each {|loot| if loot[0] == 3 gold, rates = 0, 1.0 (loot[1].to_f / loot[2]).ceil.times { if rand(100) < loot[3] * rate / 100 rates *= loot[3].to_f / 100 gold += loot[2] end} possible_loot.push([3, gold, 0, (rates * 100).to_i]) if gold != 0 else possible_loot.push(loot) if rand(100) < loot[3] * rate / 100 end} return possible_loot end end #==============================================================================# Scene_Battle#============================================================================== class Scene_Battle alias update_phase4_step5_master_thief_later update_phase4_step5 def update_phase4_step5(battler = nil) if battler != nil update_phase4_step5_master_thief_later(battler) else update_phase4_step5_master_thief_later end if $game_temp.loot_data != nil loot = nil case $game_temp.loot_data[0] when 0 $game_party.gain_weapon($game_temp.loot_data[1], 1) loot = "#{$data_weapons[$game_temp.loot_data[1]].name} stolen" when 1 $game_party.gain_armor($game_temp.loot_data[1], 1) loot = "#{$data_armors[$game_temp.loot_data[1]].name} stolen" when 2 $game_party.gain_item($game_temp.loot_data[1], 1) loot = "#{$data_items[$game_temp.loot_data[1]].name} stolen" when 3 $game_party.gain_gold($game_temp.loot_data[1]) loot = "#{$game_temp.loot_data[1]} #{$data_system.words.gold} stolen" when true loot = 'Stealing failed' when false loot = 'Nothing left' end @help_window.set_text(loot, 1) if loot != nil end end alias update_phase4_step6_master_thief_later update_phase4_step6 def update_phase4_step6(battler = nil) if $game_temp.loot_data != nil @help_window.visible, $game_temp.loot_data = false, nil end if battler != nil update_phase4_step6_master_thief_later(battler) else update_phase4_step6_master_thief_later end end end Share this post Link to post Share on other sites