Project1
标题: 挨打获得四维 [打印本页]
作者: y967 时间: 2026-4-25 11:37
标题: 挨打获得四维
本帖最后由 y967 于 2026-4-25 11:42 编辑
获得一个神通天赋,装备可以获得一个状态,该状态下,挨打获得防御+1,其他四维也可以加,挨打攻击+2,挨打魔力+2,挨打速度+1,也可以不要状态,就装备一个防具,挨打获得四维,使用状态是方便解除,该神通只能一场战斗内生效,战斗结束归零。脚本怎么写
对了,怎么悬赏,100星屑
作者: 灯笼菜刀王 时间: 2026-4-25 16:58
首先, 要临时生效,那就考虑用什么储存, 可以在game battler 里建个实变量, 也可以用全局变量, 根据 角色ID + N 的变量作为临时面板用, 然后战斗结束后把它归零就实现战斗后清除
第二步是让新变量和你想要的属性挂钩, 在 game battler 里找到 def pdef , 把临时面板的变量给它加上去, 如果是用全局变量,就到 game actor 里去加
第三步, 找到伤害公式(平A,技能,道具 三个公式), 在 self.hp -= self.damage 下面, 加上判断, if state?(10086) , 或者 if self.is_a?(Game_Actor) and @armor10086_id == 10086 时, 把临时面板变量增加/减少需要的值, 搞定收工
如果想状态取消的同时把变量归零, 那找到 def remove_state 在最后给它加个判断, if state_id == 10086 , 把变量 = 0
作者: 无忧谷主幻 时间: 2026-4-28 01:08
本帖最后由 无忧谷主幻 于 2026-4-28 01:28 编辑
我帮你写一个吧,不过我的技术不如楼上,估计有些繁琐
第一步,确定一个变量
Game_Battler 3
# HP 的伤害计算
self.hp -= self.damage
# HP 的伤害计算
self.hp -= self.damage
下面加上
# 带有10号状态且受到大于0的伤害时,变量增加
if self.damage > 0 and self.state?(10)
$game_variables[1] += 1
end
# 带有10号状态且受到大于0的伤害时,变量增加
if self.damage > 0 and self.state?(10)
$game_variables[1] += 1
end
特技也要加,在这下面
# HP 的伤害减法运算
last_hp = self.hp
self.hp -= self.damage
effective |= self.hp != last_hp
# HP 的伤害减法运算
last_hp = self.hp
self.hp -= self.damage
effective |= self.hp != last_hp
道具的话看情况,毕竟敌人是不会用道具的,你自己应该也不会用道具打自己
第二步,把这个变量应用于状态中
Game_Battler 1
#--------------------------------------------------------------------------
# ● 获取力量
#--------------------------------------------------------------------------
def str
n = [[base_str + @str_plus, 1].max, 999].min
for i in @states
n *= $data_states[i].str_rate / 100.0
end
n = [[Integer(n), 1].max, 999].min
return n
end
#--------------------------------------------------------------------------
# ● 获取力量
#--------------------------------------------------------------------------
def str
n = [[base_str + @str_plus, 1].max, 999].min
for i in @states
n *= $data_states[i].str_rate / 100.0
end
n = [[Integer(n), 1].max, 999].min
return n
end
将其改成
# ● 获取力量
def str
n = [[base_str + @str_plus, 1].max, 999].min
for i in @states
n *= $data_states[i].str_rate / 100.0
end
# 带有10号状态时,力量增加变量1的数值
if self.state?(10)
n += $game_variables[1]
end
n = [[Integer(n), 1].max, 999].min
return n
end
# ● 获取力量
def str
n = [[base_str + @str_plus, 1].max, 999].min
for i in @states
n *= $data_states[i].str_rate / 100.0
end
# 带有10号状态时,力量增加变量1的数值
if self.state?(10)
n += $game_variables[1]
end
n = [[Integer(n), 1].max, 999].min
return n
end
如果你想改成魔力之类的,也是差不多的改法
第三步,也就是最重要的,如何在战斗结束后重置
#--------------------------------------------------------------------------
# ● 胜负判定
#--------------------------------------------------------------------------
def judge
# 全灭判定是真、并且同伴人数为 0 的情况下
if $game_party.all_dead? or $game_party.actors.size == 0
# 允许失败的情况下
if $game_temp.battle_can_lose
# 还原为战斗开始前的 BGM
$game_system.bgm_play($game_temp.map_bgm)
#--------------------------------------------------------------------------
# ● 胜负判定
#--------------------------------------------------------------------------
def judge
# 全灭判定是真、并且同伴人数为 0 的情况下
if $game_party.all_dead? or $game_party.actors.size == 0
# 允许失败的情况下
if $game_temp.battle_can_lose
# 还原为战斗开始前的 BGM
$game_system.bgm_play($game_temp.map_bgm)
# 如果存在任意 1 个敌人就返回 false
for enemy in $game_troop.enemies
if enemy.exist?
return false
end
end
# 如果存在任意 1 个敌人就返回 false
for enemy in $game_troop.enemies
if enemy.exist?
return false
end
end
# 逃跑成功判定
success = rand(100) < 50 * actors_agi / enemies_agi
# 成功逃跑的情况下
if success
# 逃跑成功判定
success = rand(100) < 50 * actors_agi / enemies_agi
# 成功逃跑的情况下
if success
的下面,统统加上
最后放上工程
Project2.zip
(201.97 KB, 下载次数: 2)
| 欢迎光临 Project1 (https://rpg.blue/) |
Powered by Discuz! X3.1 |