Ele ganha quando pisa no tile? Só pode receber uma vez?
9
856
info
Grupo: Conde
Registrado: 29/04/09
Posts: 904
Reputação: +389
Char no Tibia: Jabuti Selvagem

24 de janeiro de 2014 às 01:23
24 de janeiro de 2014 às 11:35
Pode ser...
só uma vez
24 de janeiro de 2014 às 12:29
Adicione essas duas tags no seu movements.xml
<movevent type="StepIn" itemid="103" event="script" value="soundStep.lua"/> <movevent type="StepOut" itemid="103" event="script" value="soundStep.lua"/>
Depois, na pasta movements/scripts, crie um arquivo chamado soundStep.lua e adicione o seguinte código dentro :
local config = {
soundName = "sounds/Centralplains.wav",
tileId = 103,
storage = 55000,
}
function onStepIn(cid, item, pos, fromPos)
if not isPlayer(cid) then return true end
if getPlayerStorageValue(cid, config.storage) < 1 then
doPlayerSendTextMessage(cid, 26, config.soundName)
setPlayerStorageValue(cid,config.storage,1)
end
end
function onStepOut(cid, item, position, fromPosition)
if not isPlayer(cid) then return true end
if getPlayerStorageValue(cid, config.storage) == 1 and getTileItemById(position, config.tileId).uid <= 0 then
setPlayerStorageValue(cid, config.storage, -1)
end
end
end
Não testei, mas creio que vai funcionar, se não funcionar me avise.
Editado Janeiro 24 por Wuva
24 de janeiro de 2014 às 13:44
Deu esse erro
~~
[24/01/2014 12:37:23] [Error - MoveEvents Interface]
[24/01/2014 12:37:23] data/movements/scripts/soundStep.lua:onStepIn
[24/01/2014 12:37:23] Description:
[24/01/2014 12:37:23] (luaDoPlayerSendTextMessage) Player not found
24 de janeiro de 2014 às 14:10
Deu esse erro
~~
[24/01/2014 12:37:23] [Error - MoveEvents Interface][24/01/2014 12:37:23] data/movements/scripts/soundStep.lua:onStepIn[24/01/2014 12:37:23] Description:[24/01/2014 12:37:23] (luaDoPlayerSendTextMessage) Player not found
Alterei o script, veja se funciona
info
Grupo: Conde
Registrado: 29/04/09
Posts: 904
Reputação: +389
Char no Tibia: Jabuti Selvagem

24 de janeiro de 2014 às 14:30
Cria soundMov.lua em data/movements e coloca
local usar_so_uma_vez = yes -- Só vai mandar o som uma vez? yes ou no
local cooldown = 1 -- Tempo em segundos pra mandar o som caso o player saia e passe dnv
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if not isPlayer(cid) then
return false
end
if usar_so_uma_vez == yes and getPlayerStorageValue(cid, 38120) == 1 then
return false
end
if getPlayerStorageValue(cid, 281291) < os.time() then
doPlayerSetStorageValue(cid, 38120, 1)
doPlayerSendTextMessage(cid, 26, "sounds/Centralplains.wav")
doPlayerSetStorageValue(cid, 281291, os.time()+cooldown)
else
return false
end
return true
end
Tag no movements.xml:
<movevent type="StepIn" actionid="4726" event="script" value="soundMov.lua"/>
Daí é só por actionID 4726 nos pisos que vc quiser que mande o som.
PS: leia os comentários no script
24 de janeiro de 2014 às 15:34
Vlw wuva, rep+







info
Grupo: Cavaleiro
Registrado: 21/06/12
Posts: 155
Reputação: +3
Bem que preciso é:
O player fica em cima do chão, o script verificao chão, se o id do chão for = 103
ele manda som pro player... doPlayerSendTextMessage(cid, 26, "sounds/Centralplains.wav")
Editado Janeiro 24 por xmaster0