Project1
标题:
怎么设置怪物掉落多个物品?
[打印本页]
作者:
zui3320
时间:
2011-7-17 22:34
标题:
怎么设置怪物掉落多个物品?
怎么设置怪物掉落多个物品? 弄来弄去还是只能设置掉落一个 dsu_plus_rewardpost_czw
作者:
Wind2010
时间:
2011-7-17 22:44
$shizi_battle_result = []
#上面这个依旧是初始化用,不用管
$shizi_battle_result_goldrand = false #是否开启随机金钱
$shizi_battle_result_goldrandnum = 50 #随机幅度为50
$shizi_battle_result_exprand = false #是否开启随机经验
$shizi_battle_result_exprandnum = 30 #随机幅度为30
$shizi_battle_result_max = 99 #最多获得99件宝物
#宝物设置的格式:
#$shizi_battle_result[*] = [怪物ID,[ [宝物类型,宝物ID,宝物出现几率] , [宝物类型,宝物ID,宝物出现几率]]
#宝物类型:
#0、物品
#1、武器
#2、防具
$shizi_battle_result[0] = [1,[[2,1,70],[1,2,40]]]
#下面是脚本内容
class Scene_Battle
def start_phase5
@phase = 5
$game_system.me_play($game_system.battle_end_me)
$game_system.bgm_play($game_temp.map_bgm)
exp = 0
gold = 0
treasures = []
for enemy in $game_troop.enemies
unless enemy.hidden
exp += enemy.exp
gold += enemy.gold
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
for i in $shizi_battle_result
if enemy.id == i[0]
for shizi in i[1]
if rand(100) < shizi[2]
case shizi[0]
when 0
treasures.push($data_items[shizi[1]])
when 1
treasures.push($data_weapons[shizi[1]])
when 2
treasures.push($data_armors[shizi[1]])
end
end
end
end
end
end
end
end
treasures = treasures[0...$shizi_battle_result_max]
gold = rand($shizi_battle_result_goldrandnum*2)-$shizi_battle_result_goldrandnum+gold if gold >= $shizi_battle_result_goldrandnum and $shizi_battle_result_goldrand == true
exp = rand($shizi_battle_result_exprandnum*2)-$shizi_battle_result_exprandnum+exp if exp >= $shizi_battle_result_exprandnum and $shizi_battle_result_exprand == true
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
$game_party.gain_gold(gold)
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
@result_window = Window_BattleResult.new(exp, gold, treasures)
@phase5_wait_count = 100
end
end
复制代码
作者:
zui3320
时间:
2011-7-17 22:57
Wind2010 发表于 2011-7-17 22:44
不是太懂!!!!!
作者:
xiezhen6805
时间:
2011-7-17 23:58
掉落多物品.rar
(189.62 KB, 下载次数: 273)
2011-7-17 23:57 上传
点击文件名下载附件
可以直接用脚本来实现,比如“战斗处理——幽灵*2”,然后战斗结束得到物品,如果需要加入得到物品的概率的话就用变量分歧来操作,具体看范例。变量因为只是是随机数,所以可以用在多个事件中。。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1