加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
弄了一个宠物合成的脚本,如何修改当成品数组里面的宠物ID全部在队伍和仓库里时, 就无法继续获得,如果队伍和仓库没有该ID的宠物就获得该宠物 脚本1 class Game_Alchemy attr_accessor :recipe_list attr_accessor :fail_id def initialize @recipe_list = [] main end def main 材料A = [0,181] 材料B = [0,206] 成品 = [103, 104] @recipe_list << [材料A, 材料B, 成品] end end 脚本2 def make_result @alchemy = [] for i in 0...2 kind = 0 @alchemy[i] = [kind,@alchemy_window.stuff[i].id] end @list = $game_alchemy.recipe_list for i in 0...@list.size if @alchemy[0] == @list[i][0] and @alchemy[1] == @list[i][1] # 获得炼妖宠物,从成品数组中随机选择一个 成品索引 = rand(@list[i][2].size) @result = $data_actors[@list[i][2][成品索引]] # 检查队伍和仓库是否包含该宠物ID if $game_actors[$game_variables[1]].kds_baby.include?(@result.id) || $game_party.actors2.include?($game_actors[@result.id]) p "无法继续获得宠物" # 如果没有该宠物 else p "获得宠物" # 添加进队伍 switch_baby(@result.id) end end end end
弄了一个宠物合成的脚本,如何修改当成品数组里面的宠物ID全部在队伍和仓库里时,
就无法继续获得,如果队伍和仓库没有该ID的宠物就获得该宠物
脚本1
class Game_Alchemy
attr_accessor :recipe_list
attr_accessor :fail_id
def initialize
@recipe_list = []
main
end
def main
材料A = [0,181]
材料B = [0,206]
成品 = [103, 104]
@recipe_list << [材料A, 材料B, 成品]
end
end
脚本2
def make_result
@alchemy = []
for i in 0...2
kind = 0
@alchemy[i] = [kind,@alchemy_window.stuff[i].id]
end
@list = $game_alchemy.recipe_list
for i in 0...@list.size
if @alchemy[0] == @list[i][0] and @alchemy[1] == @list[i][1]
# 获得炼妖宠物,从成品数组中随机选择一个
成品索引 = rand(@list[i][2].size)
@result = $data_actors[@list[i][2][成品索引]]
# 检查队伍和仓库是否包含该宠物ID
if $game_actors[$game_variables[1]].kds_baby.include?(@result.id) ||
$game_party.actors2.include?($game_actors[@result.id])
p "无法继续获得宠物"
# 如果没有该宠物
else
p "获得宠物"
# 添加进队伍
switch_baby(@result.id)
end
end
end
end
|