Project1
标题:
关于DEF中对武器属性变量的累加
[打印本页]
作者:
typhon_524
时间:
2009-12-4 11:17
标题:
关于DEF中对武器属性变量的累加
本帖最后由 typhon_524 于 2009-12-4 14:52 编辑
下面这段脚本是加在 Scene_Map 里的,在地图上会用事件随时调用 $scene.attack,参照了这个链接里紫苏的优化改法,但是发现变量31没有累加,始终是0,为什么?
def attack
$game_variables[31] = 0 # 火属性伤害归零
$game_variables[32] = 0 # 冰属性伤害归零
$game_variables[33] = 0 # 雷属性伤害归零
$game_variables[34] = 0 # 水属性伤害归零
$game_variables[35] = 0 # 土属性伤害归零
$game_variables[36] = 0 # 风属性伤害归零
$game_variables[37] = 0 # 光属性伤害归零
$game_variables[38] = 0 # 暗属性伤害归零
actor = $game_party.actors[0]
weapon_id = actor.weapon_id
weaped = weapon_id != 0
weapon = $data_weapons[weapon_id]
es = weapon.element_set
# 主角的火属性武器的伤害累加
$game_variables[31] += 10 if weaped and es.include?(1)
for i in [31,35,39]
$game_variables[31] += 2 if weaped and es.include?(i)
end
for i in [32,36,40]
$game_variables[31] += 4 if weaped and es.include?(i)
end
for i in [33,37,41]
$game_variables[31] += 6 if weaped and es.include?(i)
end
for i in [34,38,42]
$game_variables[31] += 8 if weaped and es.include?(i)
end
....................
..........
.....
..........
..............
............
.................
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1