赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 35025 |
最后登录 | 2017-9-29 |
在线时间 | 231 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 231 小时
- 注册时间
- 2007-12-17
- 帖子
- 541
|
5楼
楼主 |
发表于 2013-5-17 12:58:40
|
只看该作者
chd114 发表于 2013-5-17 12:49
不是一个变量你怎么合···
写成这样可以么? 两段全部并到 for i in 1..5 里面,会有冲突么?
for i in 1..5 next if $game_map.events[i+5].character_name == "" or $game_map.events[i+5].character_name == "敌人尸体" #XXOO如果敌人刀剑伤害判定 if $game_switches[105+i] == true and $game_switches[20] == false for j in 11..14 next if $game_map.events[j].character_name == "" a = $game_map.events[i+5].screen_x b = $game_map.events[j].screen_x c = $game_map.events[i+5].screen_y d = $game_map.events[j].screen_y if $game_map.events[i+5].direction == 4 if a-b <= 40 and a-b > 0 and (c-d).abs <= 24 and $game_self_switches[[$game_map.map_id, j, "D"]] == false $game_switches[105+i] = false $game_map.events[j].animation_id = 300 $game_map.events[j].move_backward $game_map.events[j].damage = 78 $game_map.events[j].critical = false $game_map.events[j].damage_pop = true #XXOO开始改宠物事件名字并根据事件名的变化判定是否死亡 name = $game_map.events[j].name pet_sn = j.to_s data = name.split(/,/) data[1]=data[1].to_i-$game_map.events[j].damage $game_variables[j] -= 78 $game_map.events[j].name="守卫"+pet_sn+","+data[1].to_s+","+data[2].to_s+","+data[3].to_s+","+data[4].to_s+","+data[5].to_s if data[1].to_i <= 0 data[1] = 0 $game_map.events[j].name="守卫"+pet_sn+","+data[1].to_s+","+data[2].to_s+","+data[3].to_s+","+data[4].to_s+","+data[5].to_s $game_self_switches[[$game_map.map_id, j, "D"]] = true $game_self_switches[[$game_map.map_id, j, "C"]] = false $game_map.need_refresh = true $game_map.events[j].refresh end end elsif $game_map.events[i+5].direction == 6 if a-b >= -40 and a-b < 0 and (c-d).abs <= 24 and $game_self_switches[[$game_map.map_id, j, "D"]] == false $game_switches[105+i] = false $game_map.events[j].animation_id = 300 $game_map.events[j].move_backward $game_map.events[j].damage = 78 $game_map.events[j].critical = false $game_map.events[j].damage_pop = true #XXOO开始改宠物事件名字并根据事件名的变化判定是否死亡 name = $game_map.events[j].name pet_sn = j.to_s data = name.split(/,/) data[1]=data[1].to_i-$game_map.events[j].damage $game_variables[j] -= 78 $game_map.events[j].name="守卫"+pet_sn+","+data[1].to_s+","+data[2].to_s+","+data[3].to_s+","+data[4].to_s+","+data[5].to_s if data[1].to_i <= 0 data[1] = 0 $game_map.events[j].name="守卫"+pet_sn+","+data[1].to_s+","+data[2].to_s+","+data[3].to_s+","+data[4].to_s+","+data[5].to_s $game_self_switches[[$game_map.map_id, j, "D"]] = true $game_self_switches[[$game_map.map_id, j, "C"]] = false $game_map.need_refresh = true $game_map.events[j].refresh end end end end end #XXOO如果敌人长枪戳刺伤害判定 if $game_switches[115+i] == true and $game_switches[20] == false for j in 11..14 next if $game_map.events[j].character_name == "" a = $game_map.events[i+5].screen_x b = $game_map.events[j].screen_x c = $game_map.events[i+5].screen_y d = $game_map.events[j].screen_y if $game_map.events[i+5].direction == 4 if a-b <= 72 and a-b > 0 and (c-d).abs <= 16 and $game_self_switches[[$game_map.map_id, j, "D"]] == false $game_switches[115+i] = false $game_map.events[j].animation_id = 300 $game_map.events[j].move_backward $game_map.events[j].damage = 46 $game_map.events[j].critical = false $game_map.events[j].damage_pop = true #XXOO开始改宠物事件名字并根据事件名的变化判定是否死亡 name = $game_map.events[j].name pet_sn = j.to_s data = name.split(/,/) data[1]=data[1].to_i-$game_map.events[j].damage $game_variables[j] -= 46 $game_map.events[j].name="守卫"+pet_sn+","+data[1].to_s+","+data[2].to_s+","+data[3].to_s+","+data[4].to_s+","+data[5].to_s if data[1].to_i <= 0 data[1] = 0 $game_map.events[j].name="守卫"+pet_sn+","+data[1].to_s+","+data[2].to_s+","+data[3].to_s+","+data[4].to_s+","+data[5].to_s $game_self_switches[[$game_map.map_id, j, "D"]] = true $game_self_switches[[$game_map.map_id, j, "C"]] = false $game_map.need_refresh = true $game_map.events[j].refresh end end elsif $game_map.events[i+5].direction == 6 if a-b >= -72 and a-b < 0 and (c-d).abs <= 16 and $game_self_switches[[$game_map.map_id, j, "D"]] == false $game_switches[115+i] = false $game_map.events[j].animation_id = 300 $game_map.events[j].move_backward $game_map.events[j].damage = 46 $game_map.events[j].critical = false $game_map.events[j].damage_pop = true #XXOO开始改宠物事件名字并根据事件名的变化判定是否死亡 name = $game_map.events[j].name pet_sn = j.to_s data = name.split(/,/) data[1]=data[1].to_i-$game_map.events[j].damage $game_variables[j] -= 46 $game_map.events[j].name="守卫"+pet_sn+","+data[1].to_s+","+data[2].to_s+","+data[3].to_s+","+data[4].to_s+","+data[5].to_s if data[1].to_i <= 0 data[1] = 0 $game_map.events[j].name="守卫"+pet_sn+","+data[1].to_s+","+data[2].to_s+","+data[3].to_s+","+data[4].to_s+","+data[5].to_s $game_self_switches[[$game_map.map_id, j, "D"]] = true $game_self_switches[[$game_map.map_id, j, "C"]] = false $game_map.need_refresh = true $game_map.events[j].refresh end end end end end end
for i in 1..5
next if $game_map.events[i+5].character_name == "" or $game_map.events[i+5].character_name == "敌人尸体"
#XXOO如果敌人刀剑伤害判定
if $game_switches[105+i] == true and $game_switches[20] == false
for j in 11..14
next if $game_map.events[j].character_name == ""
a = $game_map.events[i+5].screen_x
b = $game_map.events[j].screen_x
c = $game_map.events[i+5].screen_y
d = $game_map.events[j].screen_y
if $game_map.events[i+5].direction == 4
if a-b <= 40 and a-b > 0 and (c-d).abs <= 24 and $game_self_switches[[$game_map.map_id, j, "D"]] == false
$game_switches[105+i] = false
$game_map.events[j].animation_id = 300
$game_map.events[j].move_backward
$game_map.events[j].damage = 78
$game_map.events[j].critical = false
$game_map.events[j].damage_pop = true
#XXOO开始改宠物事件名字并根据事件名的变化判定是否死亡
name = $game_map.events[j].name
pet_sn = j.to_s
data = name.split(/,/)
data[1]=data[1].to_i-$game_map.events[j].damage
$game_variables[j] -= 78
$game_map.events[j].name="守卫"+pet_sn+","+data[1].to_s+","+data[2].to_s+","+data[3].to_s+","+data[4].to_s+","+data[5].to_s
if data[1].to_i <= 0
data[1] = 0
$game_map.events[j].name="守卫"+pet_sn+","+data[1].to_s+","+data[2].to_s+","+data[3].to_s+","+data[4].to_s+","+data[5].to_s
$game_self_switches[[$game_map.map_id, j, "D"]] = true
$game_self_switches[[$game_map.map_id, j, "C"]] = false
$game_map.need_refresh = true
$game_map.events[j].refresh
end
end
elsif $game_map.events[i+5].direction == 6
if a-b >= -40 and a-b < 0 and (c-d).abs <= 24 and $game_self_switches[[$game_map.map_id, j, "D"]] == false
$game_switches[105+i] = false
$game_map.events[j].animation_id = 300
$game_map.events[j].move_backward
$game_map.events[j].damage = 78
$game_map.events[j].critical = false
$game_map.events[j].damage_pop = true
#XXOO开始改宠物事件名字并根据事件名的变化判定是否死亡
name = $game_map.events[j].name
pet_sn = j.to_s
data = name.split(/,/)
data[1]=data[1].to_i-$game_map.events[j].damage
$game_variables[j] -= 78
$game_map.events[j].name="守卫"+pet_sn+","+data[1].to_s+","+data[2].to_s+","+data[3].to_s+","+data[4].to_s+","+data[5].to_s
if data[1].to_i <= 0
data[1] = 0
$game_map.events[j].name="守卫"+pet_sn+","+data[1].to_s+","+data[2].to_s+","+data[3].to_s+","+data[4].to_s+","+data[5].to_s
$game_self_switches[[$game_map.map_id, j, "D"]] = true
$game_self_switches[[$game_map.map_id, j, "C"]] = false
$game_map.need_refresh = true
$game_map.events[j].refresh
end
end
end
end
end
#XXOO如果敌人长枪戳刺伤害判定
if $game_switches[115+i] == true and $game_switches[20] == false
for j in 11..14
next if $game_map.events[j].character_name == ""
a = $game_map.events[i+5].screen_x
b = $game_map.events[j].screen_x
c = $game_map.events[i+5].screen_y
d = $game_map.events[j].screen_y
if $game_map.events[i+5].direction == 4
if a-b <= 72 and a-b > 0 and (c-d).abs <= 16 and $game_self_switches[[$game_map.map_id, j, "D"]] == false
$game_switches[115+i] = false
$game_map.events[j].animation_id = 300
$game_map.events[j].move_backward
$game_map.events[j].damage = 46
$game_map.events[j].critical = false
$game_map.events[j].damage_pop = true
#XXOO开始改宠物事件名字并根据事件名的变化判定是否死亡
name = $game_map.events[j].name
pet_sn = j.to_s
data = name.split(/,/)
data[1]=data[1].to_i-$game_map.events[j].damage
$game_variables[j] -= 46
$game_map.events[j].name="守卫"+pet_sn+","+data[1].to_s+","+data[2].to_s+","+data[3].to_s+","+data[4].to_s+","+data[5].to_s
if data[1].to_i <= 0
data[1] = 0
$game_map.events[j].name="守卫"+pet_sn+","+data[1].to_s+","+data[2].to_s+","+data[3].to_s+","+data[4].to_s+","+data[5].to_s
$game_self_switches[[$game_map.map_id, j, "D"]] = true
$game_self_switches[[$game_map.map_id, j, "C"]] = false
$game_map.need_refresh = true
$game_map.events[j].refresh
end
end
elsif $game_map.events[i+5].direction == 6
if a-b >= -72 and a-b < 0 and (c-d).abs <= 16 and $game_self_switches[[$game_map.map_id, j, "D"]] == false
$game_switches[115+i] = false
$game_map.events[j].animation_id = 300
$game_map.events[j].move_backward
$game_map.events[j].damage = 46
$game_map.events[j].critical = false
$game_map.events[j].damage_pop = true
#XXOO开始改宠物事件名字并根据事件名的变化判定是否死亡
name = $game_map.events[j].name
pet_sn = j.to_s
data = name.split(/,/)
data[1]=data[1].to_i-$game_map.events[j].damage
$game_variables[j] -= 46
$game_map.events[j].name="守卫"+pet_sn+","+data[1].to_s+","+data[2].to_s+","+data[3].to_s+","+data[4].to_s+","+data[5].to_s
if data[1].to_i <= 0
data[1] = 0
$game_map.events[j].name="守卫"+pet_sn+","+data[1].to_s+","+data[2].to_s+","+data[3].to_s+","+data[4].to_s+","+data[5].to_s
$game_self_switches[[$game_map.map_id, j, "D"]] = true
$game_self_switches[[$game_map.map_id, j, "C"]] = false
$game_map.need_refresh = true
$game_map.events[j].refresh
end
end
end
end
end
end
|
|