Project1

标题: 关于DEF中对武器属性变量的累加 [打印本页]

作者: typhon_524    时间: 2009-12-4 11:17
标题: 关于DEF中对武器属性变量的累加
本帖最后由 typhon_524 于 2009-12-4 14:52 编辑

下面这段脚本是加在 Scene_Map 里的,在地图上会用事件随时调用 $scene.attack,参照了这个链接里紫苏的优化改法,但是发现变量31没有累加,始终是0,为什么?
  1.   def attack
  2.     $game_variables[31] = 0         # 火属性伤害归零
  3.     $game_variables[32] = 0         # 冰属性伤害归零
  4.     $game_variables[33] = 0         # 雷属性伤害归零
  5.     $game_variables[34] = 0         # 水属性伤害归零
  6.     $game_variables[35] = 0         # 土属性伤害归零
  7.     $game_variables[36] = 0         # 风属性伤害归零
  8.     $game_variables[37] = 0         # 光属性伤害归零
  9.     $game_variables[38] = 0         # 暗属性伤害归零
  10.    
  11.     actor = $game_party.actors[0]
  12.     weapon_id = actor.weapon_id
  13.    
  14.     weaped = weapon_id != 0
  15.    
  16.     weapon = $data_weapons[weapon_id]
  17.    
  18.     es = weapon.element_set
  19.    
  20.     # 主角的火属性武器的伤害累加
  21.     $game_variables[31] += 10 if weaped and es.include?(1)
  22.     for i in [31,35,39]
  23.       $game_variables[31] += 2 if weaped and es.include?(i)
  24.     end
  25.     for i in [32,36,40]
  26.       $game_variables[31] += 4 if weaped and es.include?(i)
  27.     end
  28.     for i in [33,37,41]
  29.       $game_variables[31] += 6 if weaped and es.include?(i)
  30.     end
  31.     for i in [34,38,42]
  32.       $game_variables[31] += 8 if weaped and es.include?(i)
  33.     end
  34.     ....................
  35.     ..........
  36.     .....
  37.     ..........
  38.     ..............
  39.     ............
  40.     .................
复制代码





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1