/script y0n = y0n or false
if y0n then
y0n=false OutputMessage("MSG_SYS","自动选定→关\n")
else
y0n=true OutputMessage("MSG_SYS","自动选定→开\n")
end
function Selto()
local p=GetClientPlayer()
local npc={}
for i,v in pairs(GetNpcList()) do
local s=GetNpc(v)
local d=math.floor(GetCharacterDistance(p.dwID,v)/64)
SceneObject_SetTitleEffect(TARGET.NPC, v, 0)
if s.szName=="龙胆蛇" or s.szName=="血玉" or (s.szName=="维提吠达特天罚剑" and s.nZ>(p.nZ+1000) and d<25) then
table.insert(npc,{I=v,S=s.szName,Z=s.nZ,D=d})
end
end
table.sort(npc,function(a,b) return (a.D<b.D) end)
SceneObject_SetTitleEffect(TARGET.NPC, npc[1].I,8)
local t=GetTargetHandle(p.GetTarget())
if t and t.szName==npc[1].S then return end
SelectTarget(TARGET.NPC,npc[1].I)
end
RegisterBreatheEvent("Selto",function()
if not y0n then return end
Selto()
end)
if y0n then
y0n=false OutputMessage("MSG_SYS","自动选定→关\n")
else
y0n=true OutputMessage("MSG_SYS","自动选定→开\n")
end
function Selto()
local p=GetClientPlayer()
local npc={}
for i,v in pairs(GetNpcList()) do
local s=GetNpc(v)
local d=math.floor(GetCharacterDistance(p.dwID,v)/64)
SceneObject_SetTitleEffect(TARGET.NPC, v, 0)
if s.szName=="龙胆蛇" or s.szName=="血玉" or (s.szName=="维提吠达特天罚剑" and s.nZ>(p.nZ+1000) and d<25) then
table.insert(npc,{I=v,S=s.szName,Z=s.nZ,D=d})
end
end
table.sort(npc,function(a,b) return (a.D<b.D) end)
SceneObject_SetTitleEffect(TARGET.NPC, npc[1].I,8)
local t=GetTargetHandle(p.GetTarget())
if t and t.szName==npc[1].S then return end
SelectTarget(TARGET.NPC,npc[1].I)
end
RegisterBreatheEvent("Selto",function()
if not y0n then return end
Selto()
end)