Boa tarde.
Estou tentando reproduzir o script Pokémon Move de "pota".
mas estou com um problema, pois os monstros podem passar por tudo.
Código:
function pokemonWalk(summon, position, maxDistance, extra)
local path = summon:getPathTo(position, 0, maxDistance, false, false, 15)
if not path then
return false
end
setCreatureIdle(summon:getId(), #path * 500 + 10000)
walkToPosition(summon:getId(), path, 1, extra)
return true
end
function walkToPosition(cid, path, count, extra)
local creature = Creature(cid)
if not creature then
return true
end
if creature:getCondition(CONDITION_MOVING) == nil then
return true
end
local dir = path[count]
creature:move(dir)
count = count + 1
addEvent(walkToPosition, creature:getWalkDelay(dir), cid, path, count, extra)
end
function setCreatureIdle(cid, time)
local creature = Creature(cid)
if not creature then
return true
end
local condition = Condition(CONDITION_MOVING)
condition:setParameter(CONDITION_PARAM_TICKS, time)
creature:addCondition(condition)
end