Precisava de um video pra mandar pro site do edubart vou usar o seu.
Edit: Se quiser acompalhar esse e o topico ele ja ajudo no ultimo erro e somente ele pra arrumar esse.
Precisava de um video pra mandar pro site do edubart vou usar o seu.
Edit: Se quiser acompalhar esse e o topico ele ja ajudo no ultimo erro e somente ele pra arrumar esse.
Editado Abril 14 por nociam
info
Grupo: Príncipe
Registrado: 19/08/10
Posts: 4k
Reputação: +1.1k
Gênero: Masculino

pode ter certeza q ngm vai responder '--' nos q vm ter q se virar... foda q o sistema de walk foi totalmente mudado da versao 0.5.5 pras 0.6+ ;/ n tem nem como ver 'oq' foi mudado pra tentar remover kkk
pode ter certeza q ngm vai responder '--' nos q vm ter q se virar... foda q o sistema de walk foi totalmente mudado da versao 0.5.5 pras 0.6+ ;/ n tem nem como ver 'oq' foi mudado pra tentar remover kkk
Slicer todas as mudanças feita no OTclient é postada no github... Só você da uma olhada lá... ![]()
info
Grupo: Artesão
Registrado: 30/03/13
Posts: 124
Reputação: +21
Char no Tibia: Two One Two

pode ter certeza q ngm vai responder '--' nos q vm ter q se virar... foda q o sistema de walk foi totalmente mudado da versao 0.5.5 pras 0.6+ ;/ n tem nem como ver 'oq' foi mudado pra tentar remover kkk
Slicer todas as mudanças feita no OTclient é postada no github... Só você da uma olhada lá...
Já dei uma procurada la, e não achei nada :S
info
Grupo: Visconde
Registrado: 20/08/06
Posts: 250
Reputação: +146

Mostra o script do order, fica mais fácil de achar o problema vendo as funções que ele usa.
esta ai o script a funcao que faz mover e a function goThere.
function doPushCreature(uid,direction,distance,time)
if isCreature(uid) == TRUE then
local rand = (2*math.random(0,1))-1
local rand2 = math.random(-1,0)
if direction == 0 then
signal = {0,rand,-rand,rand,-rand,0,-1,-1,-1,0,0,0}
elseif direction == 1 then
signal = {1,1,1,0,0,0,0,rand,-rand,rand,-rand,0}
elseif direction == 2 then
signal = {0,rand,-rand,rand,-rand,0,1,1,1,0,0,0}
elseif direction == 3 then
signal = {-1,-1,-1,0,0,0,0,rand,-rand,rand,-rand,0}
elseif direction == 4 then
signal = {-1,rand2,(-rand2)-1,0,1,rand2+1,rand2,0}
elseif direction == 5 then
signal = {1,-rand2,-((-rand2)-1),0,1,rand2+1,rand2,0}
elseif direction == 6 then
signal = {-1,rand2,(-rand2)-1,0,-1,(-rand2)-1,rand2,0}
else
signal = {1,-rand2,-((-rand2)-1),0,-1,(-rand2)-1,rand2,0}
end
local pos = getThingPos(uid)
nsig = #signal
nvar = 0
repeat
nvar = nvar+1
newpos = {x=pos.x+(signal[nvar]),y=pos.y+(signal[(nsig/2)+nvar]),z=pos.z}
newtile = {x=newpos.x,y=newpos.y,z=newpos.z,stackpos=0}
until getTileThingByPos(newtile).uid ~= 0 and hasProperty(getTileThingByPos(newtile).uid,3) == FALSE and queryTileAddThing(uid,newpos) == 1 or nvar == (nsig/2)
if distance == nil or distance == 1 then
doTeleportThing(uid,newpos,TRUE)
else
distance = distance-1
doTeleportThing(uid,newpos,TRUE)
if time ~= nil then
addEvent(doPushCreature,time,uid,direction,distance,time)
else
addEvent(doPushCreature,500,uid,direction,distance,500)
end
end
end
end
function doPushCreature(uid,direction,distance,time)
if isCreature(uid) == TRUE then
local rand = (2*math.random(0,1))-1
local rand2 = math.random(-1,0)
if direction == 0 then
signal = {0,rand,-rand,rand,-rand,0,-1,-1,-1,0,0,0}
elseif direction == 1 then
signal = {1,1,1,0,0,0,0,rand,-rand,rand,-rand,0}
elseif direction == 2 then
signal = {0,rand,-rand,rand,-rand,0,1,1,1,0,0,0}
elseif direction == 3 then
signal = {-1,-1,-1,0,0,0,0,rand,-rand,rand,-rand,0}
elseif direction == 4 then
signal = {-1,rand2,(-rand2)-1,0,1,rand2+1,rand2,0}
elseif direction == 5 then
signal = {1,-rand2,-((-rand2)-1),0,1,rand2+1,rand2,0}
elseif direction == 6 then
signal = {-1,rand2,(-rand2)-1,0,-1,(-rand2)-1,rand2,0}
else
signal = {1,-rand2,-((-rand2)-1),0,-1,(-rand2)-1,rand2,0}
end
local pos = getThingPos(uid)
nsig = #signal
nvar = 0
repeat
nvar = nvar+1
newpos = {x=pos.x+(signal[nvar]),y=pos.y+(signal[(nsig/2)+nvar]),z=pos.z}
newtile = {x=newpos.x,y=newpos.y,z=newpos.z,stackpos=0}
until getTileThingByPos(newtile).uid ~= 0 and hasProperty(getTileThingByPos(newtile).uid,3) == FALSE and queryTileAddThing(uid,newpos) == 1 or nvar == (nsig/2)
if distance == nil or distance == 1 then
doTeleportThing(uid,newpos,TRUE)
else
distance = distance-1
doTeleportThing(uid,newpos,TRUE)
if time ~= nil then
addEvent(doPushCreature,time,uid,direction,distance,time)
else
addEvent(doPushCreature,500,uid,direction,distance,500)
end
end
end
end
function walkTo(cid, direction, finalpos, skill)
if not isCreature(cid) then return false end
--if getDistanceBetween(getThingPos(cid), finalpos) <= 1 and getDirectionTo(getThingPos(cid), finalpos) <= 3 and getThingPos(getCreatureMaster(cid)).x == finalpos.x and getThingPos(getCreatureMaster(cid)).y == finalpos.y and (skill == "ride" or skill == "fly") then
--doTeleportThing(cid, finalpos, true)
--return true
--end
if isWalkable(getPosByDir(getThingPos(cid), direction), 0, 0, 0) and direction <= 3 then
doPushCreature(cid, direction, 1, 0)
return true
end
if direction >= 4 then
if direction == 4 then
if math.random(1,2) == 1 then
if isWalkable(getPosByDir(getThingPos(cid), 3), 0, 0, 0) then
newdir = 3
else
newdir = 2
end
else
if isWalkable(getPosByDir(getThingPos(cid), 2), 0, 0, 0) then
newdir = 2
else
newdir = 3
end
end
elseif direction == 5 then
if math.random(1,2) == 1 then
if isWalkable(getPosByDir(getThingPos(cid), 2), 0, 0, 0) then
newdir = 2
else
newdir = 1
end
else
if isWalkable(getPosByDir(getThingPos(cid), 1), 0, 0, 0) then
newdir = 1
else
newdir = 2
end
end
elseif direction == 6 then
if math.random(1,2) == 1 then
if isWalkable(getPosByDir(getThingPos(cid), 0), 0, 0, 0) then
newdir = 0
else
newdir = 3
end
else
if isWalkable(getPosByDir(getThingPos(cid), 3), 0, 0, 0) then
newdir = 3
else
newdir = 0
end
end
elseif direction == 7 then
if math.random(1,2) == 1 then
if isWalkable(getPosByDir(getThingPos(cid), 1), 0, 0, 0) then
newdir = 1
else
newdir = 0
end
else
if isWalkable(getPosByDir(getThingPos(cid), 0), 0, 0, 0) then
newdir = 0
else
newdir = 1
end
end
end
doPushCreature(cid, newdir, 1, 0)
return true
end
if direction <= 3 and not isWalkable(getPosByDir(getThingPos(cid), direction), 0, 0, 0) then
if direction == 0 then
if getDirectionTo(getThingPos(cid), finalpos) == 6 then
if isWalkable(getPosByDir(getThingPos(cid), 3), 0, 0, 0) then
newdir = 3
else
newdir = 6
end
elseif getDirectionTo(getThingPos(cid), finalpos) == 7 then
if isWalkable(getPosByDir(getThingPos(cid), 1), 0, 0, 0) then
newdir = 1
else
newdir = 7
end
end
elseif direction == 1 then
if getDirectionTo(getThingPos(cid), finalpos) == 7 then
if isWalkable(getPosByDir(getThingPos(cid), 0), 0, 0, 0) then
newdir = 0
else
newdir = 7
end
elseif getDirectionTo(getThingPos(cid), finalpos) == 5 then
if isWalkable(getPosByDir(getThingPos(cid), 2), 0, 0, 0) then
newdir = 2
else
newdir = 5
end
end
elseif direction == 2 then
if getDirectionTo(getThingPos(cid), finalpos) == 4 then
if isWalkable(getPosByDir(getThingPos(cid), 3), 0, 0, 0) then
newdir = 3
else
newdir = 4
end
elseif getDirectionTo(getThingPos(cid), finalpos) == 5 then
if isWalkable(getPosByDir(getThingPos(cid), 1), 0, 0, 0) then
newdir = 1
else
newdir = 5
end
end
elseif direction == 3 then
if getDirectionTo(getThingPos(cid), finalpos) == 4 then
if isWalkable(getPosByDir(getThingPos(cid), 2), 0, 0, 0) then
newdir = 2
else
newdir = 4
end
elseif getDirectionTo(getThingPos(cid), finalpos) == 6 then
if isWalkable(getPosByDir(getThingPos(cid), 0), 0, 0, 0) then
newdir = 0
else
newdir = 6
end
end
end
doPushCreature(cid, newdir, 1, 0)
return true
end
doPushCreature(cid, direction, 1, 0)
end
function markPos(sid, pos)
if not isCreature(sid) then return end
setPlayerStorageValue(sid, 145, pos.x)
setPlayerStorageValue(sid, 146, pos.y)
setPlayerStorageValue(sid, 147, pos.z)
end
function getMarkedPos(sid)
if not isCreature(sid) then return end
local xx = getPlayerStorageValue(sid, 145)
local yy = getPlayerStorageValue(sid, 146)
local zz = getPlayerStorageValue(sid, 147)
return {x = xx, y = yy, z = zz}
end
function getOwnerPos(sid)
if not isCreature(sid) then return end
local xx = getPlayerStorageValue(sid, 148)
local yy = getPlayerStorageValue(sid, 149)
local zz = getPlayerStorageValue(sid, 150)
return {x = xx, y = yy, z = zz}
end
function markOwnerPos(sid, pos)
if not isCreature(sid) then return end
setPlayerStorageValue(sid, 148, pos.x)
setPlayerStorageValue(sid, 149, pos.y)
setPlayerStorageValue(sid, 150, pos.z)
end
function doFaceCreature(sid, pos)
if getDirectionTo(getThingPos(sid), pos) == 4 then
return doCreatureSetLookDir(sid, math.random(2, 3))
elseif getDirectionTo(getThingPos(sid), pos) == 5 then
return doCreatureSetLookDir(sid, math.random(1, 2))
elseif getDirectionTo(getThingPos(sid), pos) == 6 then
local dirs = {0, 3}
return doCreatureSetLookDir(sid, dirs[math.random(1, 2)])
elseif getDirectionTo(getThingPos(sid), pos) == 7 then
return doCreatureSetLookDir(sid, math.random(0, 1))
end
return doCreatureSetLookDir(sid, getDirectionTo(getThingPos(sid), pos))
end
function recheck(sid, skill, pos)
if not isCreature(sid) then return end
local cid = getCreatureMaster(sid)
if skill == "cut" then
local item = getTileItemById(pos, 2767)
doCreatureSay(sid, "CUT!", TALKTYPE_MONSTER)
markPos(sid, {x=1,y=1,z=7})
doFaceCreature(sid, pos)
doSendMagicEffect(getThingPos(item.uid), 141)
doTransformItem(item.uid, 6216)
local function growBush()
doTransformItem(getTileItemById(pos, 6216).uid, 2767)
end
addEvent(growBush, 5000)
elseif skill == "rock smash" then
local item = getTileItemById(pos, 1285)
doCreatureSay(sid, "ROCK SMASH!", TALKTYPE_MONSTER)
markPos(sid, {x=1,y=1,z=7})
doFaceCreature(sid, pos)
doSendMagicEffect(getThingPos(item.uid), 118)
doTransformItem(item.uid, 3610)
local function growRock()
doTransformItem(getTileItemById(pos, 3610).uid, 1285)
end
addEvent(growRock, 5000)
elseif skill == "dig" then
local item = getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0})
doCreatureSay(sid, "DIG!", TALKTYPE_MONSTER)
markPos(sid, {x=1,y=1,z=7})
doFaceCreature(sid, pos)
doSendMagicEffect(getThingPos(item.uid), 3)
doTransformItem(item.uid, item.itemid+1)
local function closeHole()
doTransformItem(getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).uid, item.itemid)
end
addEvent(closeHole, 5000)
elseif skill == "fly" or skill == "ride" then
if skill == "fly" then
local pokemon = flys[getCreatureName(getCreatureSummons(cid)[1])]
doPlayerSendTextMessage(cid, 27, "Type \"up\" or \"h1\" to fly higher and \"down\" or \"h2\" to fly lower.")
doChangeSpeed(cid, -getCreatureSpeed(cid))
doChangeSpeed(cid, pokemon[2])
doSetCreatureOutfit(cid, {lookType = pokemon[1]}, -1)
doItemSetAttribute(getPlayerSlotItem(cid, 8).uid, "hp", getCreatureHealth(getCreatureSummons(cid)[1]) / getCreatureMaxHealth(getCreatureSummons(cid)[1]))
doRemoveCreature(getCreatureSummons(cid)[1])
return true
end
if skill == "ride" then
local pokemon = rides[getCreatureName(getCreatureSummons(cid)[1])]
doChangeSpeed(cid, -getCreatureSpeed(cid))
doChangeSpeed(cid, pokemon[2])
doSetCreatureOutfit(cid, {lookType = pokemon[1]}, -1)
doItemSetAttribute(getPlayerSlotItem(cid, 8).uid, "hp", getCreatureHealth(getCreatureSummons(cid)[1]) / getCreatureMaxHealth(getCreatureSummons(cid)[1]))
doRemoveCreature(getCreatureSummons(cid)[1])
return true
end
end
if not isCreature(sid) then return end
if getOwnerPos(sid).x ~= getThingPos(getCreatureMaster(sid)).x or getOwnerPos(sid).y ~= getThingPos(getCreatureMaster(sid)).y or isCreature(getCreatureTarget(getCreatureMaster(sid))) then
doChangeSpeed(sid, -getCreatureSpeed(sid))
doChangeSpeed(sid, getCreatureBaseSpeed(sid))
markPos(sid, {x=1,y=1,z=7})
return true
end
addEvent(recheck, 120, sid)
end
function goThere(sid, thepos, skill, target)
if not isCreature(sid) then return true end
if thepos.x ~= getMarkedPos(sid).x or thepos.y ~= getMarkedPos(sid).y then return true end
if isCreature(getCreatureTarget(getCreatureMaster(sid))) and target == false then
doChangeSpeed(sid, -getCreatureSpeed(sid))
doChangeSpeed(sid, getCreatureBaseSpeed(sid))
markPos(sid, {x=1,y=1,z=7})
return true
end
if skill ~= "move" then
if getDistanceBetween(getThingPos(sid), getMarkedPos(sid)) <= 1 then
if skill == "ride" or skill == "fly" then
if getThingPos(sid).x == getThingPos(getCreatureMaster(sid)).x and getThingPos(sid).y == getThingPos(getCreatureMaster(sid)).y then
recheck(sid, skill, thepos)
return true
end
if getThingPos(getCreatureMaster(sid)).x == thepos.x and getThingPos(getCreatureMaster(sid)).y == thepos.y then
if getDirectionTo(getThingPos(sid), getThingPos(getCreatureMaster(sid))) <= 3 then
doChangeSpeed(sid, getCreatureBaseSpeed(sid))
doTeleportThing(sid, thepos, true)
doChangeSpeed(sid, -getCreatureSpeed(sid))
markPos(sid, getThingPos(getCreatureMaster(sid)))
addEvent(goThere, 1030 - (2.2 * (getCreatureBaseSpeed(sid))), sid, getMarkedPos(sid), skill, target)
else
doChangeSpeed(sid, - getCreatureSpeed(sid))
doChangeSpeed(sid, getCreatureBaseSpeed(sid))
markPos(sid, getThingPos(getCreatureMaster(sid)))
walkTo(sid, getDirectionTo(getThingPos(sid), getMarkedPos(sid)), getMarkedPos(sid))
doChangeSpeed(sid, - getCreatureSpeed(sid))
addEvent(goThere, 1030 - (2.2 * (getCreatureBaseSpeed(sid))), sid, getMarkedPos(sid), skill, target)
end
else
markPos(sid, getThingPos(getCreatureMaster(sid)))
doChangeSpeed(sid, - getCreatureSpeed(sid))
doChangeSpeed(sid, getCreatureBaseSpeed(sid))
if getDirectionTo(getThingPos(sid), getMarkedPos(sid)) >= 4 then
walkTo(sid, getDirectionTo(getThingPos(sid), getMarkedPos(sid)), getMarkedPos(sid))
else
doTeleportThing(sid, getPosByDir(getThingPos(sid), getDirectionTo(getThingPos(sid), getMarkedPos(sid))))
end
doChangeSpeed(sid, - getCreatureSpeed(sid))
addEvent(goThere, 1030 - (2.2 * (getCreatureBaseSpeed(sid))), sid, getMarkedPos(sid), skill, target)
end
return true
end
addEvent(recheck, 350, sid, skill, thepos)
return true
end
end
if getThingPos(sid).x == getMarkedPos(sid).x and getThingPos(sid).y == getMarkedPos(sid).y then
addEvent(recheck, 350, sid, skill, thepos)
return true
end
if (getOwnerPos(sid).x ~= getThingPos(getCreatureMaster(sid)).x or getOwnerPos(sid).y ~= getThingPos(getCreatureMaster(sid)).y) and isCreature(getCreatureTarget(getCreatureMaster(sid))) == false and skill == "move" then
doChangeSpeed(sid, -getCreatureSpeed(sid))
doChangeSpeed(sid, getCreatureBaseSpeed(sid))
markPos(sid, {x=1,y=1,z=7})
return true
end
doChangeSpeed(sid, - getCreatureSpeed(sid))
doChangeSpeed(sid, getCreatureBaseSpeed(sid))
if getDistanceBetween(getThingPos(sid), getMarkedPos(sid)) <= 1 and not isWalkable(getPosByDir(getThingPos(sid), getDirectionTo(getThingPos(sid), getMarkedPos(sid))), 1, 0, 0) then
if isInArray({"Misdreavus", "Gengar", "Gastly", "Haunter"}, getCreatureName(sid)) then
doTeleportThing(sid, getMarkedPos(sid), true)
end
addEvent(recheck, 350, sid, skill, thepos)
doChangeSpeed(sid, - getCreatureSpeed(sid))
return true
end
walkTo(sid, getDirectionTo(getThingPos(sid), getMarkedPos(sid)), getMarkedPos(sid))
doChangeSpeed(sid, - getCreatureSpeed(sid))
addEvent(goThere, 1030 - (2.2 * (getCreatureBaseSpeed(sid))), sid, getMarkedPos(sid), skill, target)
end
Editado Abril 17 por nociam
info
Grupo: Príncipe
Registrado: 19/08/10
Posts: 4k
Reputação: +1.1k
Gênero: Masculino

kydrai
o problema acontece quando alguma criatura, pode ser player tb, fica com velocidade baixa... dai quando tu tenta mover ele com doTeleportThing ele vai se 'teleportando' ms estando true na funçao... ;x antes a outfit bugava, dai o edu arrumo... mas ainda fico acontecendo isso ae do video ;/
info
Grupo: Visconde
Registrado: 20/08/06
Posts: 250
Reputação: +146

Isso de andar lento é problema do script que não movimenta a creature no tempo certo.
Sobre o problema de ir teleportando vejo 2 formas de resolver, pelo que testei a velocidade de uma creature com 0 de speed fica em média 150 no cliente, então precisa fazer algo assim:
No src/client/creature.cpp:
1ª forma é trocar quando pega a velocidade do passo:
Troque:
int Creature::getStepDuration(bool ignoreDiagonal, Otc::Direction dir)
{
int speed = m_speed;
if(speed < 1)
return 0;
Por:
int Creature::getStepDuration(bool ignoreDiagonal, Otc::Direction dir)
{
int speed = m_speed;
if(speed < 1)
speed = 150;
2ª forma é colocar um speed mínimo quando coloca speed 0:
Troque:
void Creature::setSpeed(uint16 speed)
{
uint16 oldSpeed = m_speed;
m_speed = speed;
// speed can change while walking (utani hur, paralyze, etc..)
if(m_walking)
nextWalkUpdate();
callLuaField("onSpeedChange", m_speed, oldSpeed);
}
Por:
void Creature::setSpeed(uint16 speed)
{
if(speed < 1)
speed = 150;
uint16 oldSpeed = m_speed;
m_speed = speed;
// speed can change while walking (utani hur, paralyze, etc..)
if(m_walking)
nextWalkUpdate();
callLuaField("onSpeedChange", m_speed, oldSpeed);
}
info
Grupo: Príncipe
Registrado: 19/08/10
Posts: 4k
Reputação: +1.1k
Gênero: Masculino

na real o andar lento eh do script ms... ele seta a velo pra 0 e depois aumenta pra 30, eu achu, e depois seta pra 0 denovo.. ;x
irei testar oq vc postou '--'
edit: fazendo a 1* opçao q vc deu, o poke n vai mais teleprotando, aparece ele se movendo, mas ele se move rapido e ainda da uma 'paradas'...
achu q a 2* vai dar quase na ms coisa n? ;x
edit²: colocando 300, segundo a 1* opçao, fica ate q com velo 'normal'... mas ainda da umas travadas de um tile pro outro...
Editado Abril 17 por Slicer
info
Grupo: Artesão
Registrado: 30/03/13
Posts: 124
Reputação: +21
Char no Tibia: Two One Two

Da primeiro forma, o teleport continua no mesmo, só que teleporta mais rapido.
info
Grupo: Visconde
Registrado: 20/08/06
Posts: 250
Reputação: +146

As duas sugestões dão o mesmo resultado, eu só alterei a velocidade da passada pra fazer o efeito dele andando.
150 foi uma sugestão que aparentemente deu na mesma do cliente do Tibia aqui, e quanto maior esse valor mais rápido vai ser o efeito pra ele andar até o tile.
Vocês vão precisar de alguma forma pra calcular o tempo das passadas e sincronizar o cliente com o servidor, isso varia pra cada tile e speed de monstro. O melhor mesmo é pelas sources que já tem tudo isso pronto.
Editado Abril 17 por kydrai
info
Grupo: Príncipe
Registrado: 19/08/10
Posts: 4k
Reputação: +1.1k
Gênero: Masculino

if(speed < 1)
speed = 150;
deixando assim n trava mais... ;p mas ele anda um pouco rapido... vo continuar os testes ^^
info
Grupo: Artesão
Registrado: 30/03/13
Posts: 124
Reputação: +21
Char no Tibia: Two One Two

Tem como me passa o Creature.cpp já pronto? eu adicionei as 2 formas mais mesmo assim continua teleportando.
info
Grupo: Príncipe
Registrado: 19/08/10
Posts: 4k
Reputação: +1.1k
Gênero: Masculino

adiciona soh a 1* forma mano ;x e dai deixa q nem botei ali emcima...
pelo menos testes, o melhor eh deixar como coloquei... mas ainda fica meio estranhu... o unico jeito seria fazer q nem o kydrai flo... calcular o tempo dde cada passe... mas isso vai ser bem complicado kkkk -cade o edu agora ;/ -
info
Grupo: Infante
Registrado: 25/01/12
Posts: 1.6k
Reputação: +330
Bom pessoal, eu e o slicer estamos com poblemas chato ao dar move com pokémon no otclient v6.2
Creio eu, após o edu ter arrumado o bug de andar ao diagonal 'lento', ele arrumo e apareçeu esse bug do order..se alguem poder ajuda, agradeço