加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
求教一下,在战斗结束的时候根据结果不同给不同的变量赋值
意思就是胜利的时候 变量1 +=1
逃跑的时候 变量2 += 1
我搜索到几个地方
一个是 加在这~
Game_Interpreter里面的
#-------------------------------------------------------------------------- # ● 胜利的时候 #-------------------------------------------------------------------------- def command_601 command_skip if @branch[@indent] != 0 $game_variables[1] +=1 #这是我加的 end #-------------------------------------------------------------------------- # ● 撤退的时候 #-------------------------------------------------------------------------- def command_602 command_skip if @branch[@indent] != 1 $game_variables[2] +=1 #这是我加的 end
#--------------------------------------------------------------------------
# ● 胜利的时候
#--------------------------------------------------------------------------
def command_601
command_skip if @branch[@indent] != 0
$game_variables[1] +=1 #这是我加的
end
#--------------------------------------------------------------------------
# ● 撤退的时候
#--------------------------------------------------------------------------
def command_602
command_skip if @branch[@indent] != 1
$game_variables[2] +=1 #这是我加的
end
但是加在这里的话,在游戏里无论是胜利还是撤退,变量1和2都会同时+1
然后我又找了
BattleManager 加在这里
#-------------------------------------------------------------------------- # ● 战斗结束 # result : 结果(0:胜利 1:撤退 2:全灭) #-------------------------------------------------------------------------- def self.battle_end(result) @phase = nil @event_proc.call(result) if @event_proc $game_party.on_battle_end $game_troop.on_battle_end SceneManager.exit if $BTEST if self.battle_end(result) == 0 #我加的 $game_variables[1] += 1 #我加的 end if self.battle_end(result) == 1 #我加的 $game_variables[2] += 1 #我加的 end end
#--------------------------------------------------------------------------
# ● 战斗结束
# result : 结果(0:胜利 1:撤退 2:全灭)
#--------------------------------------------------------------------------
def self.battle_end(result)
@phase = nil
@event_proc.call(result) if @event_proc
$game_party.on_battle_end
$game_troop.on_battle_end
SceneManager.exit if $BTEST
if self.battle_end(result) == 0 #我加的
$game_variables[1] += 1 #我加的
end
if self.battle_end(result) == 1 #我加的
$game_variables[2] += 1 #我加的
end
end
然后加在这里会报错
发生systemstackerror.
stack level too deep
这样- -
求脚下,怎么弄这个问题啊 |