Por LuckOake, 04 de out. de 2012 em Scripts
info
Grupo: Marquês
Registrado: 22/07/12
Posts: 1.1k
Reputação: +400
Gênero: Masculino
Char no Tibia: Luck Oake
Olá galera. Vou direto ao ponto dessa vez. Adaptei de um script uma função de follow, mas ela tá bugada. O monstro não segue, só muda o lookdir.
function doCreatureFollow(cid, target, playerpos, targetpos, times)
followstor = 51325
if playerdir ~= getCreatureLookDirection(cid) then
doCreatureSetLookDirection(target, getCreatureLookDirection(cid))
end
if playerpos ~= getCreaturePosition(cid) then
if playerpos.z == getCreaturePosition(cid).z then
ntpos = getCreaturePosition(cid)
local x,y,z = ntpos.x-playerpos.x,ntpos.y-playerpos.y,ntpos.z-playerpos.z
ntpos = getCreaturePosition(target)
ntpos.x, ntpos.y, ntpos.z = ntpos.x+x,ntpos.y+y,ntpos.z+z
if queryTileAddThing(target, ntpos) == RETURNVALUE_NOERROR and getCreaturePosition(cid).z == getCreaturePosition(target).z then
doMoveCreature(target, getCreatureLookDirection(cid))
local playerpos, targetpos = getCreaturePosition(cid), getCreaturePosition(target)
if getPlayerStorageValue(cid, followstor) == 1 then
addEvent(move, 1, cid, target, playerpos, targetpos, times)
else
doCreatureSetNoMove(target, 0)
Dá pra ser usada mais ou menos assim:
setPlayerStorageValue(cid, followstor, 1) doCreatureFollow(cid, target, playerpos, targetpos, times)
Mas não sei como usar corretamente. Alguém quer dar uma luz?
Editado Outubro 4 por LuckOake
info
Grupo: Marquês
Registrado: 22/07/12
Posts: 1.1k
Reputação: +400
Gênero: Masculino
Char no Tibia: Luck Oake
Olá galera. Vou direto ao ponto dessa vez. Adaptei de um script uma função de follow, mas ela tá bugada. O monstro não segue, só muda o lookdir.
function doCreatureFollow(cid, target, playerpos, targetpos, times)
followstor = 51325
if playerdir ~= getCreatureLookDirection(cid) then
doCreatureSetLookDirection(target, getCreatureLookDirection(cid))
end
if playerpos ~= getCreaturePosition(cid) then
if playerpos.z == getCreaturePosition(cid).z then
ntpos = getCreaturePosition(cid)
local x,y,z = ntpos.x-playerpos.x,ntpos.y-playerpos.y,ntpos.z-playerpos.z
ntpos = getCreaturePosition(target)
ntpos.x, ntpos.y, ntpos.z = ntpos.x+x,ntpos.y+y,ntpos.z+z
if queryTileAddThing(target, ntpos) == RETURNVALUE_NOERROR and getCreaturePosition(cid).z == getCreaturePosition(target).z then
doMoveCreature(target, getCreatureLookDirection(cid))
end
end
end
local playerpos, targetpos = getCreaturePosition(cid), getCreaturePosition(target)
if getPlayerStorageValue(cid, followstor) == 1 then
addEvent(move, 1, cid, target, playerpos, targetpos, times)
else
doCreatureSetNoMove(target, 0)
end
end
Dá pra ser usada mais ou menos assim:
Mas não sei como usar corretamente. Alguém quer dar uma luz?
Editado Outubro 4 por LuckOake