cgmsv引擎论坛

 找回密码
 注册/Sign up
搜索
查看: 365|回复: 18

【求助】检测敌人血量怎么每回合都触发

[复制链接]

Rank: 1

发表于 2024-4-29 12:15:13 | 显示全部楼层 |阅读模式
lua里这么写只能在进入战斗时触发一次检测,大佬们帮着看看如何改进


ScouterReport.rar

581 Bytes, 下载次数: 11

Rank: 1

发表于 2024-4-29 21:53:52 | 显示全部楼层
getturn 判断回合数

Rank: 1

 楼主| 发表于 2024-4-29 23:31:08 | 显示全部楼层

试过,没成功,能具体说说怎么改吗

Rank: 1

发表于 2024-4-30 12:48:13 | 显示全部楼层
试试is waiting command.

Rank: 1

 楼主| 发表于 2024-4-30 13:47:30 | 显示全部楼层
ahsin 发表于 2024-4-30 12:48
试试is waiting command.

这些也都想到了,能正常跑起来的只有附件那个,大佬们直接告诉我改哪里我再试试

Rank: 1

发表于 2024-4-30 15:04:54 | 显示全部楼层
用战斗开始event,就会在战斗开始检测
用战斗回合前event,就会每回合开始前检测
查lua接口文档更换对应event

Rank: 1

 楼主| 发表于 2024-4-30 16:04:42 | 显示全部楼层
头要想秃了

Rank: 4

发表于 2024-4-30 17:39:48 | 显示全部楼层
有些接口新框架才有,查lua参考
框架写法格式也不太一样

如上面,BattleStartEvent
换成BeforeBattleTurnStartEvent

Rank: 1

 楼主| 发表于 2024-4-30 18:59:54 | 显示全部楼层
接口里好像是没有战斗回合前event或者BeforeBattleTurnStartEvent这两种的,改了头部的类型会提示注册失败,用的是论坛里的cgmsv 24.3c

getturn和battle is waiting command这两个作为触发条件也试过,没成功,应该是我功夫不到家

Rank: 1

发表于 2024-4-30 19:23:17 | 显示全部楼层
用m佬新框架的写法   仅提供思路,不保证无错
local module = ModuleBase:createModule('XXXXX')
function module:aaaTest(battleIndex)
      for BWhile=10,19 do
                local PlayerIndex = Battle.GetPlayer(battle,BWhile);
                if(VaildChar(PlayerIndex)==true) then
                        if(Char.GetData(PlayerIndex,%对象_名字%) ~= "取消检测") then
                                for BPWhile=0,4 do
                                        local BPlayerIndex = Battle.GetPlayer(battle,BPWhile);
                                        if(BPlayerIndex >= 0) then
                                                local ground = Char.GetData(PlayerIndex,%对象_地属性%);
                                                local water = Char.GetData(PlayerIndex,%对象_水属性%);
                                                local fire = Char.GetData(PlayerIndex,%对象_火属性%);
                                                local wind = Char.GetData(PlayerIndex,%对象_风属性%);
                                                local xue = Char.GetData(PlayerIndex,%对象_血%);
                                                local combat = Char.GetData(PlayerIndex,%对象_攻击力%);
                                                local level = Char.GetData(PlayerIndex,%对象_等级%);
                                                                                                NLG.TalkToCli(BPlayerIndex,-1,"[".. BWhile.."]"..Char.GetData(PlayerIndex,%对象_名字%).." 等级".. level..",属性 地".. ground.." 水".. water.." 火".. fire.." 风".. wind..",生命值".. xue..",攻击力".. combat.."",%颜色_黄色%,%字体_小%);                                                                                                                                                                end
                                end
                        end
                end
        end
end
function module:onLoad()
    self:logInfo('load')
    self:regCallback('BeforeBattleTurnStartEvent', Func.bind(self.aaaTest, self))
end
function module:onUnload()
    self:logInfo('unload')
end
return module

您需要登录后才可以回帖 登录 | 注册/Sign up

本版积分规则

手机版|cgmsv引擎论坛

GMT+8, 2024-5-19 05:33 , Processed in 0.151703 second(s), 9 queries , Gzip On, MemCached On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表