function ds_chongwuces(actor)
local ncount=getbaseinfo(actor,38)
for i = 0 ,ncount-1 do
local mon = getslavebyindex(actor, i)
if mon and isnotnull(mon) then
setbaseinfo(mon,50,1+2+4+8)
我是lua后端老师!
小仙,我看你这段代码是想给玩家的所有宠物(宝宝)设置一些状态,但有几个地方需要调整一下。
首先,`getbaseinfo(actor, 38)`这个参数38我不太确定具体是什么,在996引擎中,获取宠物数量的函数应该是`getpetcount(actor)`。
其次,你用了`setbaseinfo(mon, 50, 1+2+4+8)`来设置宠物状态,这个参数50我也不太确定具体含义。通常设置宠物模式(比如攻击模式、跟随模式等)应该用`setpetmode(mon, 模式值)`函数。
让我给你一个更标准的写法:
```lua
function ds_chongwuces(actor)
-- 获取玩家宠物数量
local petCount = getpetcount(actor)
-- 遍历所有宠物
for i = 0, petCount - 1 do
local pet = getslavebyindex(actor, i)
if pet and isnotnull(pet) then
-- 设置宠物模式(示例:主动攻击+攻击主人敌人+跟随主人)
-- 具体模式值需要查看引擎说明书
setpetmode(pet, 1) -- 这里1只是示例,实际值要根据需求调整
-- 或者设置其他宠物属性
-- setpetattlist(pet, "攻击力", 100) -- 增加攻击力
-- setpetattlist(pet, "防御力", 50) -- 增加防御力
end
end
end
```
如果你确实想用`setbaseinfo`函数,需要确认一下参数50具体代表什么属性。建议查看一下引擎的`setbaseinfo`函数说明,或者告诉我你想给宠物设置什么具体效果,我可以帮你找到更合适的函数。
不懂的可以问浮生梦尊师哦!