NE
pedido

[Spell] Stop Time

Por Newtonnotwen, 09 de ago. de 2012 em Scripts

spell
stop
time
tibia
script
otserv
11
1.5k
NewtonnotwenN
09 de agosto de 2012 às 16:20

Tipo do script: Spell

Protocolo (versão do Tibia): 8.6

Servidor utilizado: TFS

Nível de experiência: 200

Adicionais/Informações: Nenhuma

 

Gostaria de uma spell que funcionasse da seguinte forma:

 

Ao ser utilizada todo mundo no campo de visão do player (monstro,player,tudo) ficasse imóvel por x tempo, inclusive quem entrar depois da magia ser executada (porem durante x tempo).

 

A unica pessoa que não ficaria imóvel seria o utilizador da magia.

 

-------------------Segunda versão (caso não consiga a primeira)

 

O mesmo esquema citado acima, porem com uma diferença, caso o player entre depois da execução ele não ficaria imóvel.

 

---------------------Terceira versão (caso não consiga a segunda)

 

Ao ser utilizada apenas os players ficariam imoveis durante x tempo, MENOS o player que utilizou a magia.

 

----------------------------------

 

Obrigado pela atenção e pelo tempo.

 

Att: Newtonnotwen

LuckOakeL
09 de agosto de 2012 às 19:22

Talkactions.xml:

 

<talkaction words="stop time" event="script" filter="word-spaced" value="stoptime.lua"/>

 

stoptime.lua:

 

-- Script by Luck Oake

function onSay(cid, words, param)

local waittime = 10 -- Tempo de exhaustion

local storage = 6853

ppos = getCreaturePosition(cid)

parea1 = {x=ppos.x-7, y=ppos.y-5, z=ppos.z}

parea2 = {x=ppos.x+7, y=ppos.y+5, z=ppos.z}

tarea = {fromx = ppos.x-7, fromy = ppos.y-5, tox = ppos.x+7, toy = ppos.y+5, z = ppos.z}

 

if exhaustion.check(cid, storage) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar a spell novamente.")

end

 

for _, pid in ipairs(getPlayersOnline()) do

if isInArea(getCreaturePosition(pid), parea1, parea2) then

doCreatureSetNoMove(pid, true)

doSendMagicEffect(getCreaturePosition(pid), 30)

addEvent(doCreatureSetNoMove, 10000, pid, false)

end

end

doCreatureSetNoMove(cid, false)

exhaustion.set(cid, storage, waittime)

return true

end

 

Editado Agosto 9 por LuckOake

NewtonnotwenN
09 de agosto de 2012 às 19:22

Vou testar e edito aqui.

 

-------------------Editado

 

Exausted não funciona.

 

Teria como fazer pra mostrar o player falando?

 

Ex: Player say: stop time

 

Funciona em GM (isso pode deixar mas de preferência não)

 

Teria como funcionar em bixo?

 

-------------------Editado

 

Tem como o player falar algo quando receber a magia?

Editado Agosto 9 por Newtonnotwen

LuckOakeL
09 de agosto de 2012 às 19:34

 

-- Script by Luck Oake

function onSay(cid, words, param)

local waittime = 10 -- Tempo de exhaustion

local storage = 6853

ppos = getCreaturePosition(cid)

parea1 = {x=ppos.x-7, y=ppos.y-5, z=ppos.z}

parea2 = {x=ppos.x+7, y=ppos.y+5, z=ppos.z}

tarea = {fromx = ppos.x-7, fromy = ppos.y-5, tox = ppos.x+7, toy = ppos.y+5, z = ppos.z}

 

if exhaustion.check(cid, storage) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar a spell novamente.")

end

 

for _, pid in ipairs(getPlayersOnline()) do

if isInArea(getCreaturePosition(pid), parea1, parea2) then

if getPlayerAccess(pid) <= 2 then

doCreatureSetNoMove(pid, true)

doSendMagicEffect(getCreaturePosition(pid), 30)

doCreatureSay(pid, "*time stopped*", TALKTYPE_MONSTER)

addEvent(doCreatureSetNoMove, 10000, pid, false)

else

end

end

end

doCreatureSetNoMove(cid, false)

exhaustion.set(cid, storage, waittime)

doCreatureSay(cid, "stop time", TALKTYPE_MONSTER)

return true

end

 

 

Prontim. (PS: Tentei ajustar pra não funcionar com GM, mas não garanto que vai funcionar)

Editado Agosto 9 por LuckOake

NewtonnotwenN
09 de agosto de 2012 às 19:46

Funcionou tudo certinho.

 

Menos uma coisa:

 

Ta sem exausted.

 

Se puder acrescentar level para usar também.

LuckOakeL
09 de agosto de 2012 às 19:48

 

-- Script by Luck Oake

function onSay(cid, words, param)

local waittime = 10 -- Tempo de exhaustion

local storage = 6853

ppos = getCreaturePosition(cid)

parea1 = {x=ppos.x-7, y=ppos.y-5, z=ppos.z}

parea2 = {x=ppos.x+7, y=ppos.y+5, z=ppos.z}

tarea = {fromx = ppos.x-7, fromy = ppos.y-5, tox = ppos.x+7, toy = ppos.y+5, z = ppos.z}

 

if exhaustion.check(cid, storage) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar a spell novamente.")

return true

end

 

for _, pid in ipairs(getPlayersOnline()) do

if isInArea(getCreaturePosition(pid), parea1, parea2) then

if getPlayerAccess(pid) <= 2 then

doCreatureSetNoMove(pid, true)

doSendMagicEffect(getCreaturePosition(pid), 30)

doCreatureSay(pid, "*time stopped*", TALKTYPE_MONSTER)

addEvent(doCreatureSetNoMove, 10000, pid, false)

else

end

end

end

doCreatureSetNoMove(cid, false)

exhaustion.set(cid, storage, waittime)

doCreatureSay(cid, "stop time", TALKTYPE_MONSTER)

return true

end

 

 

Agora sim.

NewtonnotwenN
09 de agosto de 2012 às 19:56

Funcionou tudo certinho!

 

Pode ajeitar o level pra usar?

 

Obs: Não precisa ajeitar o bug abaixo.

 

Bugs que não tem concerto (Quando player da follow em outro e ta perto não funciona)

LuckOakeL
09 de agosto de 2012 às 20:01

 

-- Script by Luck Oake

function onSay(cid, words, param)

local waittime = 10 -- Tempo de exhaustion

local storage = 6853

ppos = getCreaturePosition(cid)

parea1 = {x=ppos.x-7, y=ppos.y-5, z=ppos.z}

parea2 = {x=ppos.x+7, y=ppos.y+5, z=ppos.z}

tarea = {fromx = ppos.x-7, fromy = ppos.y-5, tox = ppos.x+7, toy = ppos.y+5, z = ppos.z}

level = 100

 

if getPlayerLevel(cid) < level then

doPlayerSendCancel(cid, "Você precisa de level "..level.." para usar essa magia.")

return true

end

 

if exhaustion.check(cid, storage) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar a spell novamente.")

return true

end

 

for _, pid in ipairs(getPlayersOnline()) do

if isInArea(getCreaturePosition(pid), parea1, parea2) then

if getPlayerAccess(pid) <= 2 then

doCreatureSetNoMove(pid, true)

doSendMagicEffect(getCreaturePosition(pid), 30)

doCreatureSay(pid, "*time stopped*", TALKTYPE_MONSTER)

addEvent(doCreatureSetNoMove, 10000, pid, false)

else

end

end

end

doCreatureSetNoMove(cid, false)

exhaustion.set(cid, storage, waittime)

doCreatureSay(cid, "stop time", TALKTYPE_MONSTER)

return true

end

 

 

Edite o level em vermelho. E eu não entendi o bug. Me explique melhor.

Editado Agosto 9 por LuckOake

NewtonnotwenN
09 de agosto de 2012 às 20:08

Mais um script perfeito, obrigado LuckOake.

 

2 REP+ (fico lhe devendo 1, amanha pago).

 

----------------------------

 

Pedido atendido.

 

By: LuckOake

 

 

-------------------Sobre o bug

 

Assim não funciona (único jeito que não funciona):

stop1.png

Assim funciona:

stop2d.png

Obs: Não precisa concerta-lo

Editado Agosto 9 por Newtonnotwen

LuckOakeL
09 de agosto de 2012 às 20:20

Só corrigir um erro no script.

 

 

-- Script by Luck Oake

function onSay(cid, words, param)

local waittime = 10 -- Tempo de exhaustion

local storage = 6853

ppos = getCreaturePosition(cid)

parea1 = {x=ppos.x-7, y=ppos.y-5, z=ppos.z}

parea2 = {x=ppos.x+7, y=ppos.y+5, z=ppos.z}

tarea = {fromx = ppos.x-7, fromy = ppos.y-5, tox = ppos.x+7, toy = ppos.y+5, z = ppos.z}

level = 100

 

if getPlayerLevel(cid) < level then

doPlayerSendCancel(cid, "Você precisa de level "..level.." para usar essa magia.")

return true

end

 

if exhaustion.check(cid, storage) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar a spell novamente.")

return true

end

 

for _, pid in ipairs(getPlayersOnline()) do

if isInArea(getCreaturePosition(pid), parea1, parea2) then

if getPlayerAccess(pid) <= 2 then

doCreatureSetNoMove(pid, true)

doSendMagicEffect(getCreaturePosition(pid), 30)

setPlayerStorageValue(pid, 1634, 1)

addEvent(setPlayerStorageValue, 10000, pid, 1634, -1)

doCreatureSay(pid, "*time stopped*", TALKTYPE_MONSTER)

addEvent(doCreatureSetNoMove, 10000, pid, false)

else

end

end

end

doCreatureSetNoMove(cid, false)

exhaustion.set(cid, storage, waittime)

doCreatureSay(cid, "stop time", TALKTYPE_MONSTER)

return true

end

 

 

Creaturescripts.xml:

 

<event type="logout" name="StopTime" event="script" value="stoptime.lua"/>

 

stoptime.lua:

 

 

local storage = 1634

function onLogout(cid)

if (getCreatureStorage(cid, storage) == 1) then

doPlayerSendCancel(cid, "You can not log out while the time is stopped.")

return false

end

return true

end

 

 

Esse fix faz com que os players não consigam fazer logout durante o tempo em que a magia está ativa.

Editado Agosto 9 por LuckOake

NewtonnotwenN
09 de agosto de 2012 às 20:28

Obrigado novamente.

 

Pedido atendido.

 

-----------------Editado

 

2 REP+

Editado Agosto 10 por Newtonnotwen