eu pelo menos não sei como fazer pra verificar se o player está parado a cada segundo ou não, e acho que não existe isso. A não ser que você coloque um actionid em cada santo tile do seu mapa
- Forums
- xTibia - Notícias e Suporte
- Soluções
- Archived
- Preciso De 1 Script Que Mande Magic Effect A Cada X Segundos
Preciso De 1 Script Que Mande Magic Effect A Cada X Segundos
By SirGuigo, 26 de jan. de 2009 in Archived
info
Group: Conde
Joined: 23/12/07
Posts: 566
Reputation: +5
Tibia Character: Tprocheira soldier

Só é possível fazer isso com C++.
Não existe função que cheque à quanto tempo o jogador não se meche.
\\
info
Group: Campones
Joined: 29/11/07
Posts: 81
Reputation: +4
Tibia Character: Dokmos

Bom, existe uma maneira de fazer em lua porém não é aconselhável por ser um addEvent() que poderá lagar o servidor, além de bugs, mas mesmo assim é simples e uma boa idéia.
Vai na pasta data\creaturescripts\scripts e substitua o login.lua por este:
local function isPlayerMoving(cid, fromPos) if (isPlayer(cid) == TRUE) then toPos = getThingPos(cid) if (fromPos.x == toPos.x) and (fromPos.y == toPos.y) and (fromPos.z == toPos.z) then doSendMagicEffect(toPos, CONST_ME_SLEEP) addEvent(isPlayerMoving, 10*1000, cid, toPos) else addEvent(isPlayerMoving, 30*1000, cid, toPos) end end end function onLogin(cid) registerCreatureEvent(cid, "PlayerDeath") addEvent(isPlayerMoving, 30*1000, cid, getThingPos(cid)) return TRUE end
Espero ter ajudado! :positive:
info
Group: Herói
Joined: 25/02/07
Posts: 859
Reputation: +331
Gender: Masculino

Bom, existe uma maneira de fazer em lua porém não é aconselhável por ser um addEvent() que poderá lagar o servidor, além de bugs, mas mesmo assim é simples e uma boa idéia.
Vai na pasta data\creaturescripts\scripts e substitua o login.lua por este:
local function isPlayerMoving(cid, fromPos) if (isPlayer(cid) == TRUE) then toPos = getThingPos(cid) if (fromPos.x == toPos.x) and (fromPos.y == toPos.y) and (fromPos.z == toPos.z) then doSendMagicEffect(toPos, CONST_ME_SLEEP) addEvent(isPlayerMoving, 10*1000, cid, toPos) else addEvent(isPlayerMoving, 30*1000, cid, toPos) end end end function onLogin(cid) registerCreatureEvent(cid, "PlayerDeath") addEvent(isPlayerMoving, 30*1000, cid, getThingPos(cid)) return TRUE end
Espero ter ajudado! :positive:
Dokmos, o script esta certinho.
A questao do addevent gerar lag e bugs é bem simples de ser contornada.
Como o addevent eh uma funcao que realmente gera alguns lags ao invez de você executar todo o script dentro do evento voce pode usar o evento como um simples "timer". Ou seja... você tem a variavel timer=0, quando aciona o evento timer = 1, e no onLogin você tem if timer == 1 then.
Ficaria mais ou menos assim:
local timer = 0 local function isPlayerMoving(cid, fromPos) timer = 1 end function onLogin(cid) registerCreatureEvent(cid, "PlayerDeath") a = 1 addEvent(isPlayerMoving, 30*1000, cid, getThingPos(cid)) while a == 1 do if timer = 1 then if (isPlayer(cid) == TRUE) then toPos = getThingPos(cid) if (fromPos.x == toPos.x) and (fromPos.y == toPos.y) and (fromPos.z == toPos.z) then doSendMagicEffect(toPos, CONST_ME_SLEEP) timer = 0 addEvent(isPlayerMoving, 10*1000, cid, toPos) else timer = 0 addEvent(isPlayerMoving, 30*1000, cid, toPos) end end end end return TRUE end
não sei se esta totalmente certo, afinal estou meio enferrujado
.
Mas creio que funciona.
abraços
//skulls
Edited Fevereiro 1 by Skulls
info
Group: Visconde
Joined: 10/06/06
Posts: 338
Reputation: +6
Tibia Character: Setyte Berseker

Usando onThink daria pra fazer sem modificações nas sources sim.
info
Group: Herói
Joined: 25/02/07
Posts: 859
Reputation: +331
Gender: Masculino

Nostradamos, seu comentario foi relativamente inutil levando em consideração que ja postamos a resposta da duvida, o cara so nao veio aqui ver ainda e ja foi falado que dava pra fazer sem mecher na source ;D.
nao precisa postar so pra mostrar que voce sabe alguma mer##.
ok?
abraçs
//skulls




info
Group: Artesão
Joined: 27/05/08
Posts: 101
Reputation: +1
Tibia Character: Sephyrus Kirelohn-não jogo
oi gente preciso de um script que assim: se um char ficar parado por 30 segundos ele manda o magic effect do zzZZzZz.. a cada 10 segundos e se o player se movimentar para de mandar o magic effect.
entemderam?
exemplo: no templo, tem 1 player afk, se ele fica +d 30 segundos sem se mecher é mandada um magic effect do zzZZzZz.. se depois d 10 segundos ele nao se movimentar fica mandando esse magic effect a cada 10 seg. e se o player se movimentar para de mandar.
alguem pode me fazer esse script??????
agradeço desde jah!
para 8.22