Project1
标题:
当角色HP=1时,执行。。。
[打印本页]
作者:
天浩
时间:
2018-1-23 10:32
标题:
当角色HP=1时,执行。。。
1. 怎么在当某角色HP = 1 时,随机添加1 。 2 或3的状态。
2. 当存在3状态时,直接执行一个命令。比如命令名是 : command_by
作者:
芯☆淡茹水
时间:
2018-1-23 10:32
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
def hp=(hp)
super(hp)
@hp == 1 && (state?(3) ? command_by : add_new_state(rand(3)+1))
end
end
#==============================================================================
复制代码
作者:
芯☆淡茹水
时间:
2018-1-23 14:24
本帖最后由 芯☆淡茹水 于 2018-1-24 08:24 编辑
#==============================================================================
class Game_Actor < Game_Battler
#能使用这个效果的角色ID。
Actors_data = [1,2,3,4]
#--------------------------------------------------------------------------
def hp=(hp)
last_hp = @hp
super(hp)
can_use_effect(last_hp) && (state?(3) ? command_by : add_new_state(rand(3)+1))
end
#--------------------------------------------------------------------------
def can_use_effect(last_hp)
return @hp == 1 && last_hp > @hp && Actors_data.include?(@actor_id)
end
end
#==============================================================================
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1