Ir para conteúdo
  • 0

Ajuda Com Comando /a


1579091

Pergunta

O comando /a não quer funfa, pq eu tava mechendo no data\lib\032-position.lua e resolvi traduzi aí bugo, ele ta assim:

function isInRange(position, fromPosition, toPosition)

return (position.x >= fromPosition.x and position.y >= fromPosition.y and position.z >= fromPosition.z and position.x <= toPosition.x and position.y <= toPosition.y and position.z <= toPosition.z)

end

 

function getDistanceBetween(fromPosition, toPosition)

local x, y = math.abs(fromPosition.x - toPosition.x), math.abs(fromPosition.y - toPosition.y)

local diff = math.max(x, y)

if(fromPosition.z ~= toPosition.z) then

diff = diff + 9 + 6

end

 

return diff

end

 

function getDirectionTo(pos1, pos2)

local dir = NORTH

if(pos1.x > pos2.x) then

dir = WEST

if(pos1.y > pos2.y) then

dir = NORTHWEST

elseif(pos1.y < pos2.y) then

dir = SOUTHWEST

end

elseif(pos1.x < pos2.x) then

dir = EAST

if(pos1.y > pos2.y) then

dir = NORTHEAST

elseif(pos1.y < pos2.y) then

dir = SOUTHEAST

end

else

if(pos1.y > pos2.y) then

dir = NORTH

elseif(pos1.y < pos2.y) then

dir = SOUTH

end

end

 

return dir

end

 

function getCreatureLookPosition(cid)

return getPosByDir(getThingPos(cid), getCreatureLookDirection(cid))

end

 

function getPositionByDirection(position, direction, size)

local n = size or 1

if(direction == NORTH) then

position.y = position.y - n

elseif(direction == SOUTH) then

position.y = position.y + n

elseif(direction == WEST) then

position.x = position.x - n

elseif(direction == EAST) then

position.x = position.x + n

elseif(direction == NORTHWEST) then

position.y = position.y - n

position.x = position.x - n

elseif(direction == NORTHEAST) then

position.y = position.y - n

position.x = position.x + n

elseif(direction == SOUTHWEST) then

position.y = position.y + n

position.x = position.x - n

elseif(direction == SOUTHEAST) then

position.y = position.y + n

position.x = position.x + n

end

 

return position

end

 

function doComparePositions(position, positionEx)

return position.x == positionEx.x and position.y == positionEx.y and position.z == positionEx.z

end

 

function getArea(position, x, y)

local t = {}

for i = (position.x - x), (position.x + x) do

for j = (position.y - y), (position.y + y) do

table.insert(t, {x = i, y = j, z = position.z})

end

end

 

return t

end

 

E não funfaaaaaa arruma aí

Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

  • 0

voce modifico o lib32-position e começo a dar erro no comando /a ? é isso? tente voltar como era antes de vc modificar, apenas copie e cole o original sem modificaçao:

 

function isInRange(position, fromPosition, toPosition)
return (position.x >= fromPosition.x and position.y >= fromPosition.y and position.z >= fromPosition.z and position.x <= toPosition.x and position.y <= toPosition.y and position.z <= toPosition.z)
end
function getDistanceBetween(fromPosition, toPosition)
local x, y = math.abs(fromPosition.x - toPosition.x), math.abs(fromPosition.y - toPosition.y)
local diff = math.max(x, y)
if(fromPosition.z ~= toPosition.z) then
 diff = diff + 9 + 6
end
return diff
end
function getDirectionTo(pos1, pos2)
local dir = NORTH
if(pos1.x > pos2.x) then
 dir = WEST
 if(pos1.y > pos2.y) then
  dir = NORTHWEST
 elseif(pos1.y < pos2.y) then
  dir = SOUTHWEST
 end
elseif(pos1.x < pos2.x) then
 dir = EAST
 if(pos1.y > pos2.y) then
  dir = NORTHEAST
 elseif(pos1.y < pos2.y) then
  dir = SOUTHEAST
 end
else
 if(pos1.y > pos2.y) then
  dir = NORTH
 elseif(pos1.y < pos2.y) then
  dir = SOUTH
 end
end
return dir
end
function getCreatureLookPosition(cid)
return getPosByDir(getThingPos(cid), getCreatureLookDirection(cid))
end
function getPositionByDirection(position, direction, size)
local n = size or 1
if(direction == NORTH) then
 position.y = position.y - n
elseif(direction == SOUTH) then
 position.y = position.y + n
elseif(direction == WEST) then
 position.x = position.x - n
elseif(direction == EAST) then
 position.x = position.x + n
elseif(direction == NORTHWEST) then
 position.y = position.y - n
 position.x = position.x - n
elseif(direction == NORTHEAST) then
 position.y = position.y - n
 position.x = position.x + n
elseif(direction == SOUTHWEST) then
 position.y = position.y + n
 position.x = position.x - n
elseif(direction == SOUTHEAST) then
 position.y = position.y + n
 position.x = position.x + n
end
return position
end
function doComparePositions(position, positionEx)
return position.x == positionEx.x and position.y == positionEx.y and position.z == positionEx.z
end
function getArea(position, x, y)
local t = {}
for i = (position.x - x), (position.x + x) do
 for j = (position.y - y), (position.y + y) do
  table.insert(t, {x = i, y = j, z = position.z})
 end
end
return t
end

 

--

 

Ajudei: +Rep mdr.gif

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...