Postado Setembro 18, 2012 12 anos queria que quando o player pise no tile, comece a contar e depois de 30 segundos ele seja teleportada, E se o player sair do tile antes de ser teleportado o tempo pare de contar, e se ele entrar de volta no tile comece a contar do 0. Tem como fazer isso? local events ={} local tempo = 30 -- tempo em segundos local pos = {x = 1, y = 1, z = 1} local function doTeleportThingNoError(guid, pos) local cid = getPlayerByGUID(guid) if not isCreature(cid) then return end doTeleportThing(cid, pos) end function onStepIn(cid, item, oldPos) doPlayerSendTextMessage(cid, 27, "Contagem iniciada, daqui " .. tempo .. " segundos você será teleportado") events[getPlayerGUID(cid)] = addEvent(doTeleportThingNoError, tempo * 1000, getPlayerGUID(cid), pos) return true end function onStepOut(cid, item, pos) doPlayerSendTextMessage(cid, 28, "Contagem zerada.") stopEvent(events[getPlayerGUID(cid)]) events[getPlayerGUID(cid)] = nil return true end Editado Setembro 18, 2012 12 anos por NewScripter (veja o histórico de edições)
Postado Setembro 18, 2012 12 anos data/actions/script Teleports.lua local events ={} local tempo = 30 -- tempo em segundos local pos = {x = 1, y = 1, z = 1} = para onde ele será teleportado ? local function doTeleportThingNoError(guid, pos) local cid = getPlayerByGUID(guid) if not isCreature(cid) then return end doTeleportThing(cid, pos) end function onStepIn(cid, item, oldPos) doPlayerSendTextMessage(cid, 27, "Contagem iniciada, daqui " .. tempo .. " segundos você será teleportado") events[getPlayerGUID(cid)] = addEvent(doTeleportThingNoError, tempo * 1000, getPlayerGUID(cid), pos) return true end function onStepOut(cid, item, pos) doPlayerSendTextMessage(cid, 28, "Contagem zerada.") stopEvent(events[getPlayerGUID(cid)]) events[getPlayerGUID(cid)] = nil return true end data/actions/actions.xml TAG : <action itemid="4312" event="script" value="Teleports.lua"/> Coloque esse action ID no piso que o cara pisará e será teleportado ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Assinatura~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Postado Setembro 18, 2012 12 anos Autor Nao ta teleportando mais.. nao tem como deixar nos movements? Editado Setembro 18, 2012 12 anos por NewScripter (veja o histórico de edições)
Postado Setembro 18, 2012 12 anos Coloque então o mesmo script em com o mesmo nome adicione essa tag no movements.xml <movevent type="StepIn" itemid="4439" event="script" value="Teleports.lua"/> Se der erro poste o erro, ficará mais facil para resolver. OBS : NÃO ESQUEÇA DE EDITAR A POS X.Y.Z. SE NÃO DARÁ ERRO ! SCRIPTER EDITADO ... local events ={} local tempo = 30 -- tempo em segundos local pos = {x = 1, y = 1, z = 1} local function doTeleportThingNoError(guid, pos) local cid = getPlayerByGUID(guid) if not isCreature(cid) then return end doTeleportThing(cid, pos) end function onStepIn(cid, item, oldPos) doPlayerSendTextMessage(cid, 27, "Contagem iniciada, daqui " .. tempo .. " segundos você será teleportado") events[getPlayerGUID(cid)] = addEvent(doTeleportThingNoError, tempo * 1000, getPlayerGUID(cid), pos) return true end function onStepOut(cid, item, pos) doPlayerSendTextMessage(cid, 28, "Contagem zerada.") stopEvent(events[getPlayerGUID(cid)]) events[getPlayerGUID(cid)] = nil return true end Editado Setembro 18, 2012 12 anos por karlkalvin (veja o histórico de edições) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Assinatura~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Postado Setembro 18, 2012 12 anos Autor o correto nao seria: <movevent type="StepIn" actionid="4439" event="script" value="Logout.lua"/> Editado Setembro 18, 2012 12 anos por NewScripter (veja o histórico de edições)
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.