生命体AI跳错
情况如图[img]http://p13.freep.cn/p.aspx?u=v20_p13_p_0903191447377136_0.jpg[/img]
求解答~:ph34r: 问狗狗吧~ 没人知道么-.- 调用了不存在的function所致(根据参数看是果冻的随机),程序上的错误,估计你的ai得编译一下这一段
[[i] 本帖最后由 喵喵の狗狗 于 2009-3-20 16:07 编辑 [/i]] if object == 0 then
local actors = GetActors()
for i,v in ipairs(actors) do
if (v ~= OwnerID and v ~= MyID) then
if (0 == IsMonster(v)) then
object = GetEnemyOf(v)
if GetV(V_MOTION, object) == MOTION_DEAD then
object = 0
end
if (object ~= 0) then
if ((GetV (V_HOMUNTYPE, v) < 1) or (GetV (V_HOMUNTYPE, v) > 16)) then DoSkill_AAS(AAH, v)
break
end
end
end
是这段么 你找找还有没有DoSkill_AAS的语句 搜过了 就这段有这个的 local object = 0
-- 1: SAFETY FIRSTY! Is the homunculus is under attack?
local Agressor = GetMyEnemy_AttackingMe(MyID) -- get TactData too
local AgBehav, AgSkill, AgLevel, AgAlche
if Agressor ~= 0 then
if (HomunHPPerc < HP_PERC_DANGER) or (HTact.Behav == BEHA_avoid) or (HTact.Behav == BEHA_coward) then
MyState = EVADE_ST -- flee away if HP < secure level
MyEnemy = Agressor
Evade_ComeBackTime = EVADE_COMEBACK
Log(string.format("[ -> EVADE_ST] GetMyNextTarget() attacked by enemy(%d) (avoid/coward mode or while HP < HP_PERC_DANGER)", MyEnemy))
return 0
else -- we are not in danger for now: save these data and let's check for other threats first
AgBehav = HTact.Behav
AgSkill = HTact.Skill
AgLevel = HTact.Level
AgAlche = HTact.Alche
if KILL_YOUR_ENEMIES_1ST == true then -- ... unless KILL_YOUR_ENEMIES_1ST is enabled
Log(string.format("GetMyNextTarget() <defensive scan + KILL_YOUR_ENEMIES_1ST> attacked by enemy(%d)", Agressor))
HTact.Behav = AgBehav
HTact.Skill = AgSkill
HTact.Level = AgLevel
HTact.Alche = AgAlche
return Agressor
end
end
end
-- 2: if the owner or a friend is under attack, help him/her
object = GetEnemyOf(OwnerID)
if object ~= 0 then
if GetV(V_MOTION, object) == MOTION_DEAD then
object = 0
end
end
if object == 0 then
local actors = GetActors()
for i,v in ipairs(actors) do
if (v ~= OwnerID and v ~= MyID) then
if (0 == IsMonster(v)) then
object = GetEnemyOf(v)
if GetV(V_MOTION, object) == MOTION_DEAD then
object = 0
end
if (object ~= 0) then
if ((GetV (V_HOMUNTYPE, v) < 1) or (GetV (V_HOMUNTYPE, v) > 16)) then DoSkill_AAS(AAH, v)
break
end
end
end
end
end
end
if object ~= 0 then
Log(string.format("GetMyNextTarget() the owner or a friend is attacked by enemy(%d):", object))
HTact = GetFullTact(GetV(V_HOMUNTYPE, object))
if (HTact.Behav ~= BEHA_avoid) then
return object
end
end
-- 3: if the homunculus is under attack (and his/her life is not in danger, see priority 1)
if Agressor ~= 0 then
Log(string.format("GetMyNextTarget() <defensive scan> attacked by enemy(%d)", Agressor))
HTact.Behav = AgBehav
HTact.Skill = AgSkill
HTact.Level = AgLevel
HTact.Alche = AgAlche
return Agressor
end
-- 4: if the owner or a friend is attacking --> cooperate
local OwnerMotion = GetV(V_MOTION, OwnerID)
local CooTarget = 0
object = GetV(V_TARGET, OwnerID)
if (object ~= 0) and (OwnerMotion == MOTION_ATTACK or OwnerMotion == MOTION_ATTACK2) then
CooTarget = object
end
if CooTarget == 0 then -- Owner is not attacking. Maybe a friend?
local FriendMotion = 0
for i,v in Friends do
if (v ~= OwnerID and v ~= MyID) then
if (0 == IsMonster(v)) then
object = GetV(V_TARGET, v)
FriendMotion = GetV(V_MOTION, v)
if (object ~= 0) and (FriendMotion == MOTION_ATTACK or FriendMotion == MOTION_ATTACK2) then
CooTarget = object
break
end
end
end
end
end
if CooTarget ~= 0 then
Log(string.format("GetMyNextTarget() cooperative target(%d) found:", CooTarget))
HTact = GetFullTact(GetV(V_HOMUNTYPE, CooTarget))
if (HTact.Behav ~= BEHA_avoid) then
return CooTarget
end
end
-- 5: aggressive, if HPs are OK and a target is near
if HomunHPPerc > HP_PERC_SAFE2ATK
then
object = GetMyEnemy_AnyNoKS(MyID) -- get TactData too
if (object ~= 0) then
Log(string.format("GetMyNextTarget() <aggressive scan> target(%d) found", object))
return object
end
end
return 0
end 你在其他几个文件找找 -- Log("OnIDLE_ST")
local cmd = List.popleft(ResCmdList)
if (cmd ~= nil) then
ProcessCommand(cmd)
return
end
AtkStartTime = 0
AtkSkillDoneCount = 0
HTact.Behav = -1
HTact.Skill = -1
local CurrTime = GetTick()
local HomunHP = GetV(V_HP, MyID)
local HomunMaxHP = GetV(V_MAXHP, MyID)
local HomunHPPerc = (HomunHP / HomunMaxHP) * 100
local HomunSP = GetV(V_SP, MyID)
local HomunMaxSP = GetV(V_MAXSP, MyID)
OwnerMotion = GetV(V_MOTION, OwnerID)
-- Heal wounds
if GetV(V_HP, OwnerID) < GetV(V_MAXHP, OwnerID) - 560 then
DoSkill_AAS(AAH, OwnerID)
end
就这有一个 其他都没了 看来……你ai差文件……
打开ai.lua
查看前几行的
require语句
看看涉及几个文件,这几个文件你都有么?
[[i] 本帖最后由 喵喵の狗狗 于 2009-3-20 17:08 编辑 [/i]] AI。LUA里的都没少 换个AI算了- - 多谢版主。。 :ph34r: 嗯,现在上班,要不我可以看看你ai有啥具体问题,目前只能这么分析一下了
页:
[1]