查看: 1549|回复: 2

[已经解决] 事件中的脚本问题

[复制链接]
梦石
0
星屑
50
在线时间
129 小时
注册时间
2011-9-19
回帖
9
发表于 2012-2-3 23:01:04 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
请问,在公共事件里第三页下面的那个脚本窗口里写不下脚本怎么办呀?脚本写到一半就写不下了
比如说:
SP吸收(效果:本来伤害到对方HP上的改到伤害到SP上,攻击者增加等同于伤害值的SP,对不死系(属性9)反效果):
脚本段落1(还原&SP伤害):
for t in $scene.target_battlers
  t.hp=t.last_hp
  if t.damage.is_a?(Integer)
    if t.element_rate(9)>=150
      t.sp+=t.damage
      t.damage=-t.damage
    else
      t.sp-=t.damage
    end
  end
end
脚本段落2(SP吸收):
a = $scene.active_battler
for t in $scene.target_battlers
  f=t.damage; f=0 unless f.is_a?(Integer)
  if t.element_rate(9)>=150
    a.damage=f
    a.sp-=a.damage
  else
    a.damage=-f
    a.sp-=a.damage
  end
end
$scene.active_battler = a

路人

梦石
0
星屑
595
在线时间
943 小时
注册时间
2011-8-20
回帖
965
发表于 2012-2-3 23:05:36 | 显示全部楼层
分成两个脚本来写啊
脚本段1
  1. for t in $scene.target_battlers
  2.   t.hp=t.last_hp
  3.   if t.damage.is_a?(Integer)
  4.     if t.element_rate(9)>=150
  5.       t.sp+=t.damage
  6.       t.damage=-t.damage
  7.     else
  8.       t.sp-=t.damage
  9.     end
  10.   end
  11. end
复制代码
脚本段2
  1. a = $scene.active_battler
  2. for t in $scene.target_battlers
  3.   f=t.damage; f=0 unless f.is_a?(Integer)
  4.   if t.element_rate(9)>=150
  5.     a.damage=f
  6.     a.sp-=a.damage
  7.   else
  8.     a.damage=-f
  9.     a.sp-=a.damage
  10.   end
  11. end
  12. $scene.active_battler = a
复制代码
为填坑而修炼中……
回复

使用道具 举报

梦石
0
星屑
50
在线时间
129 小时
注册时间
2011-9-19
回帖
9
 楼主| 发表于 2012-2-3 23:15:56 | 显示全部楼层
aaalbx 发表于 2012-2-3 23:05
分成两个脚本来写啊
脚本段1脚本段2

明白了,谢谢你{:1_12:}@
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部