this is a mod of this: http://www.creationasylum.net/index.php?showtopic=16875
Please comment
#==============================================================================
# * Hima's Monster Drop Item v. 1.2
#------------------------------------------------------------------------------
# This script will allow you to create a monster that drop various item with
# different rarity. You can do this by naming the monster with special pattern
# "Monstername-spdrop-r(type)(id)-u(type)(id)-c(type)(id)"
# (type) = Insert w,a or i in here. w = weapon, a = armor, i = item.
# (id) = Insert the id of item/weapon/armor that the monster will drop here.
# So if you want the rare item to be weapon id 1, uncommon item to be armor id 1
# and common item to be item id 1, this is how you name the monster
# (assuming the monster's name is Ghost)
#
# "Ghost-spdrop-rw1-ua1-ci1"
#
# If you want a monster to drop item like what RMXP default, then just don't name
# them in this special pattern :)
# contact : [email hidden]
#==============================================================================
module HIMA_MONSTERDROP
#--------------------------------------------------------------------------
# - Customize Point -
# SPDROP_KEYWORD - This will be your keyword to tell the script that the monster will drop sp item
# RARE_RATE - The chance for dropping a rare item.
# UNCOMMON_RATE - The chance for dropping an uncommon item.
# COMMON_RATE - The chance for dropping an common item.
#--------------------------------------------------------------------------
SPDROP_KEYWORD = "spdrop"
RARE_RATE = 10
UNCOMMON_RATE = 30
COMMON_RATE = 60
STATS_AT_NAME = true # if false you can use ccoas Status Effect Icons
end
class Scene_Battle
def monster_drop_item(monster)
name = monster.name.clone
if name.include?(HIMA_MONSTERDROP::SPDROP_KEYWORD)
text=name.scan(/([a-z])([a-z])([0-9]+)/)
temp = 0
text.each_index { |i|
case text[i][0]
when 'r'
item[i]['rate']=HIMA_MONSTERDROP::RARE_RATE
when 'u'
item[i]['rate']=HIMA_MONSTERDROP::UNCOMMON_RATE
when 'c'
item[i]['rate']=HIMA_MONSTERDROP::COMMON_RATE
end
temp+=item[i]['rate']
item[i]['typ']=text[i][1]
item[i]['id']=text[i][2].to_i
}
get = rand(temp)
item.each { |value|
if get > value['rate']
get-=value['rate']
else
return get_item(value['typ'],value['id'])
end
}
else
if monster.item_id > 0
return $data_items[monster.item_id]
end
if monster.weapon_id > 0
return $data_weapons[monster.weapon_id]
end
if monster.armor_id > 0
return $data_armors[monster.armor_id]
end
end
end #method
def get_item(type,id)
if id > 0
case type
when "w"
return $data_weapons[id]
when "a"
return $data_armors[id]
when "i"
return $data_items[id]
end #case
else
return nil
end
end
#--------------------------------------------------------------------------
# - After battle phase start
#--------------------------------------------------------------------------
def start_phase5
# It moves to phase 5
@phase = 5
# Performing battle end ME
$game_system.me_play($game_system.battle_end_me)
# You reset to BGM before the battle starting
$game_system.bgm_play($game_temp.map_bgm)
# Initializing EXP, the gold and the treasure
exp = 0
gold = 0
treasures = []
# Loop
for enemy in $game_troop.enemies
# When the enemy hides and it is not state
unless enemy.hidden
# Adding acquisition EXP and the gold
exp += enemy.exp
gold += enemy.gold
# Treasure appearance decision
if rand(100) < enemy.treasure_prob
item = monster_drop_item(enemy)
treasures.push(item) unless item == nil
end
end
end
# It limits the number of treasures up to 6
treasures = treasures[0..5]
# EXP acquisition
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
@status_window.level_up(i)
end
end
end
# Gold acquisition
$game_party.gain_gold(gold)
# Treasure acquisition
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# Drawing up the battle result window
@result_window = Window_BattleResult.new(exp, gold, treasures)
# Setting weight count
@phase5_wait_count = 100
end
end #class
#==============================================================================
# * Window_Help
#------------------------------------------------------------------------------
# Well we need to do something with showing Enemy's name, don't we?
#==============================================================================
class Window_Help < Window_Base
#--------------------------------------------------------------------------
# - Enemy setting
# enemy : The enemy which indicates name and the state
#--------------------------------------------------------------------------
def set_enemy(enemy)
text = enemy.name.clone
text = text.split('-')[0] if text.include?(HIMA_MONSTERDROP::SPDROP_KEYWORD)
states = make_battler_state_text(enemy, 112, false)
if HIMA_MONSTERDROP::STATS_AT_NAME
if state_text != ""
text += " " + states
end
set_text(text, 1)
else
for state in states
text += " "
end
set_text(text, 1, states)
end
end
end
# * Hima's Monster Drop Item v. 1.2
#------------------------------------------------------------------------------
# This script will allow you to create a monster that drop various item with
# different rarity. You can do this by naming the monster with special pattern
# "Monstername-spdrop-r(type)(id)-u(type)(id)-c(type)(id)"
# (type) = Insert w,a or i in here. w = weapon, a = armor, i = item.
# (id) = Insert the id of item/weapon/armor that the monster will drop here.
# So if you want the rare item to be weapon id 1, uncommon item to be armor id 1
# and common item to be item id 1, this is how you name the monster
# (assuming the monster's name is Ghost)
#
# "Ghost-spdrop-rw1-ua1-ci1"
#
# If you want a monster to drop item like what RMXP default, then just don't name
# them in this special pattern :)
# contact : [email hidden]
#==============================================================================
module HIMA_MONSTERDROP
#--------------------------------------------------------------------------
# - Customize Point -
# SPDROP_KEYWORD - This will be your keyword to tell the script that the monster will drop sp item
# RARE_RATE - The chance for dropping a rare item.
# UNCOMMON_RATE - The chance for dropping an uncommon item.
# COMMON_RATE - The chance for dropping an common item.
#--------------------------------------------------------------------------
SPDROP_KEYWORD = "spdrop"
RARE_RATE = 10
UNCOMMON_RATE = 30
COMMON_RATE = 60
STATS_AT_NAME = true # if false you can use ccoas Status Effect Icons
end
class Scene_Battle
def monster_drop_item(monster)
name = monster.name.clone
if name.include?(HIMA_MONSTERDROP::SPDROP_KEYWORD)
text=name.scan(/([a-z])([a-z])([0-9]+)/)
temp = 0
text.each_index { |i|
case text[i][0]
when 'r'
item[i]['rate']=HIMA_MONSTERDROP::RARE_RATE
when 'u'
item[i]['rate']=HIMA_MONSTERDROP::UNCOMMON_RATE
when 'c'
item[i]['rate']=HIMA_MONSTERDROP::COMMON_RATE
end
temp+=item[i]['rate']
item[i]['typ']=text[i][1]
item[i]['id']=text[i][2].to_i
}
get = rand(temp)
item.each { |value|
if get > value['rate']
get-=value['rate']
else
return get_item(value['typ'],value['id'])
end
}
else
if monster.item_id > 0
return $data_items[monster.item_id]
end
if monster.weapon_id > 0
return $data_weapons[monster.weapon_id]
end
if monster.armor_id > 0
return $data_armors[monster.armor_id]
end
end
end #method
def get_item(type,id)
if id > 0
case type
when "w"
return $data_weapons[id]
when "a"
return $data_armors[id]
when "i"
return $data_items[id]
end #case
else
return nil
end
end
#--------------------------------------------------------------------------
# - After battle phase start
#--------------------------------------------------------------------------
def start_phase5
# It moves to phase 5
@phase = 5
# Performing battle end ME
$game_system.me_play($game_system.battle_end_me)
# You reset to BGM before the battle starting
$game_system.bgm_play($game_temp.map_bgm)
# Initializing EXP, the gold and the treasure
exp = 0
gold = 0
treasures = []
# Loop
for enemy in $game_troop.enemies
# When the enemy hides and it is not state
unless enemy.hidden
# Adding acquisition EXP and the gold
exp += enemy.exp
gold += enemy.gold
# Treasure appearance decision
if rand(100) < enemy.treasure_prob
item = monster_drop_item(enemy)
treasures.push(item) unless item == nil
end
end
end
# It limits the number of treasures up to 6
treasures = treasures[0..5]
# EXP acquisition
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
@status_window.level_up(i)
end
end
end
# Gold acquisition
$game_party.gain_gold(gold)
# Treasure acquisition
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# Drawing up the battle result window
@result_window = Window_BattleResult.new(exp, gold, treasures)
# Setting weight count
@phase5_wait_count = 100
end
end #class
#==============================================================================
# * Window_Help
#------------------------------------------------------------------------------
# Well we need to do something with showing Enemy's name, don't we?
#==============================================================================
class Window_Help < Window_Base
#--------------------------------------------------------------------------
# - Enemy setting
# enemy : The enemy which indicates name and the state
#--------------------------------------------------------------------------
def set_enemy(enemy)
text = enemy.name.clone
text = text.split('-')[0] if text.include?(HIMA_MONSTERDROP::SPDROP_KEYWORD)
states = make_battler_state_text(enemy, 112, false)
if HIMA_MONSTERDROP::STATS_AT_NAME
if state_text != ""
text += " " + states
end
set_text(text, 1)
else
for state in states
text += " "
end
set_text(text, 1, states)
end
end
end
Expand to see the code.
Please comment