Editado: Script com a versão 2 testado em outras versões de pokemon.
Fiz o script para o player se movimentar sozinho (!walk). O Script pode conter alguns bugs pois testei pouco.
Vá em data/talkactions/talkactions.xml e adicione:
<talkaction words="!walk" event="script" value="walk.lua"/>
Em data/talkactions/scripts/ crie um arquivo chamado walk.lua e adicione:
V1: Testado apenas no pokemon DxP V3
local function checkSpeed(cid) local playerSpeed = getCreatureSpeed(cid) local speed = 350 - (playerSpeed / 10) -- formula para o movimento. return speedendlocal function walk(cid) if not isPlayer(cid) then return true end local speed = checkSpeed(cid) local poslook = getCreatureLookPosition(cid) if getPlayerStorageValue(cid, 43221) == 1 then if doTileQueryAdd(cid, poslook) == RETURNVALUE_NOERROR then doMoveCreature(cid, getPlayerLookDir(cid)) addEvent(walk, speed, cid) else setPlayerStorageValue(cid, 43221, 0) doPlayerSetNoMove(cid, false) end endendfunction onSay(cid, words, param) if getPlayerStorageValue(cid, 43221) == 1 then setPlayerStorageValue(cid, 43221, -1) doPlayerSetNoMove(cid, false) else setPlayerStorageValue(cid, 43221, 1) doPlayerSetNoMove(cid, true) local speed = checkSpeed(cid) addEvent(walk, speed, cid) endreturn trueend
V2: Testado em outras versões do pokemon.
local function checkSpeed(cid) local playerSpeed = getCreatureSpeed(cid) local speed = 350 - (playerSpeed / 10) return speedendlocal function checkTile(cid, pos) if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return 1 else return doTileQueryAdd(cid, pos) endendlocal function walk(cid) if not isPlayer(cid) then return true end local speed = checkSpeed(cid) local poslook = getCreatureLookPosition(cid) if getPlayerStorageValue(cid, 43221) == 1 then if checkTile(cid, poslook) == 1 then doMoveCreature(cid, getPlayerLookDir(cid)) addEvent(walk, speed, cid) else setPlayerStorageValue(cid, 43221, 0) doPlayerSetNoMove(cid, false) end endendfunction onSay(cid, words, param) if getPlayerStorageValue(cid, 43221) == 1 then setPlayerStorageValue(cid, 43221, -1) doPlayerSetNoMove(cid, false) else setPlayerStorageValue(cid, 43221, 1) doPlayerSetNoMove(cid, true) local speed = checkSpeed(cid) addEvent(walk, speed, cid) endreturn trueend
Usei uma formula que achei parecida com o movimento do player (voando e andando). Como é um script baseado em eventos, ele usa miliseconds e não consegui fazer usar a velocidade do player, caso acharem que a velocidade está baixa, alterem a linha abaixo para a formula desejada.
local speed = 350 - (playerSpeed / 10) -- formula para o movimento.