Boa tarde!
Estou com um problema em um script no qual o personagem irá avançar alguns sqm de distância. Ele está funcionando em alguns pisos e em outros não. Já tentei várias coisas diferentes e não consegui resolver. Poderia me ajudar?
Uso Otx 2
Esse é o script que estou usando:
Caso alguém tenha um script melhor e puder me enviar, agradeço.
local damage = 20 -- dano que toma qnd bate em algum obstáculo
local speed = 1000 -- velocidade do player ao usar o dash (vai de 0 a mil)
local pzprotect = true -- nao deixa entrar em pz com a spell
local distance = 20
function onWalk(cid)
if isCreature(cid) then
local poslook = getCreatureLookPosition(cid)
poslook.stackpos = STACKPOS_TOP_MOVEABLE_ITEM
if isWalkable(poslook, false, false, pzprotect) then
if not isCreature(getThingfromPos(poslook).uid) then
doMoveCreature(cid, getPlayerLookDirection(cid))
doSendMagicEffect(getPlayerPosition(cid), 10)
else
doCreatureAddHealth(cid, -damage)
doSendMagicEffect(getPlayerPosition(cid), 31)
doSendAnimatedText(getPlayerPosition(cid), "-"..damage , 180)
end
else
doCreatureAddHealth(cid, -damage)
doSendMagicEffect(getPlayerPosition(cid), 31)
doSendAnimatedText(getPlayerPosition(cid), "-"..damage , 180)
end
end
return true
end
function onCastSpell(cid, var)
if exhaustion.check(cid, 13117) == TRUE then
doPlayerSendCancel(cid, "Podera usar novamente dentro de 10 segundos.")
return false
end
for i = 0, distance do
addEvent(onWalk, (1001- math.min(speed, 1000)) *i, cid)
end
exhaustion.set(cid, 13117, 10.0)
return true
end