Olá, Ékstibiano.
function isTargetAround(cid)
local p, tp = getThingPosition(cid), getThingPosition(getCreatureTarget(cid))
return isInRange(tp, {x=p.x-1, y=p.y+1, z=p.z}, {x=p.x+1, y=p.y-1, z=p.z})
end
Abraços,
Oneshot.
Olá, Ékstibiano.
function isTargetAround(cid)
local p, tp = getThingPosition(cid), getThingPosition(getCreatureTarget(cid))
return isInRange(tp, {x=p.x-1, y=p.y+1, z=p.z}, {x=p.x+1, y=p.y-1, z=p.z})
end
Abraços,
Oneshot.
info
Grupo: Visconde
Registrado: 11/08/10
Posts: 477
Reputação: +175
Gênero: Masculino
Tipo do script: function
Protocolo: 8.54
Servidor utilizado: The Forgotten Server 0.3.6pl1
Nível de experiência: Bom (mas não consegui fazer ><)
O que o script deve fazer: Checar se o a creatura("target") que o player("cid") está atacando, está em volta do player(Nos 8 squares[quadradinhos] em volta).
Valeu
PS. a que eu tentei fazer é a seguinte:
function isAround(cid, target) local p = getCreaturePosition(cid) n = {x=p.x, y=p.y-1, z=p.z} ne = {x=p.x+1, y=p.y-1, z=p.z} e = {x=p.x+1, y=p.y, z=p.z} se = {x=p.x+1, y=p.y+1, z=p.z} s = {x=p.x, y=p.y+1, z=p.z} sw = {x=p.x-1, y=p.y+1, z=p.z} w = {x=p.x-1, y=p.y, z=p.z} nw = {x=p.x-1, y=p.y-1, z=p.z} local i = getCreaturePosition(target) if i == n or i == ne or i == e or i == se or i == s or i == sw or i == w or i == nw then return 1 else return 0 end end