Poderia adaptar ele pros servidores de poketibia, pra andar com fly nos andares acima
- Fórum
- OTServ
- Recursos
- Scripting
- Actions e Talkactions
- !walk - Sistema para andar sozinho.
!walk - Sistema para andar sozinho.
Por Testing111, 08 de set. de 2016 em Actions e Talkactions
info
Grupo: Infante
Registrado: 28/01/12
Posts: 1.6k
Reputação: +262
Gênero: Masculino

info
Grupo: Campones
Registrado: 21/02/11
Posts: 10
Reputação: +15
Char no Tibia: Test

12 horas atrás, FlamesAdmin disse:Poderia adaptar ele pros servidores de poketibia, pra andar com fly nos andares acima
Então, testei no DxP V3 e funcionou no fly, pros servidor que não funcionam talvez o sistema de fly esteja diferente.
Editado: Versão 2 do script funcionando em outros servidores de pokemon.
Vou deixar o código que provavelmente irá funcionar em todas versões.
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 doMoveCreature(cid, getPlayerLookDir(cid)) addEvent(walk, speed, cid) else setPlayerStorageValue(cid, 43221, 0) doPlayerSetNoMove(cid, false) 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
Porem, com esse código, você precisa adicionar todas as ID's de objetos que ele não poderá atravessar em data/movements/movements.xml:
<movevent type="StepIn" itemid="ID1;ID2-ID10;ID15..." event="script" value="blockwall.lua"/>
Onde está ID1,ID2,etc... Você tem que adicionar as ID's das paredes e outros tipos de itens que você não quer q ele passe por cima. Se o seu servidor não tiver esse script "blockwall.lua" procure pelo script "walkback.lua".
Editado Setembro 9 por Testing111
Em 08/09/2016 em 19:34, Testing111 disse: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 trueendUsei 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.
Em 08/09/2016 em 19:34, Testing111 disse: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 trueendUsei 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.
[21/02/2021 07:56:22] [Error - LuaScriptInterface::loadFile] data/talkactions/scripts/walk.lua:5: 'end' expected (to close 'function' at line 1) near 'function'
[21/02/2021 07:56:22] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/walk.lua)
[21/02/2021 07:56:22] data/talkactions/scripts/walk.lua:5: 'end' expected (to close 'function' at line 1) near 'function'




info
Grupo: Campones
Registrado: 21/02/11
Posts: 10
Reputação: +15
Char no Tibia: Test
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:
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 trueendV2: 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 trueendUsei 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.
Editado Setembro 9 por Testing111