Ir para conteúdo

Featured Replies

Postado

Bom, primeiramente perdão se eu estiver na área errada, é meu primeiro tópico nesse fórum.

Seguinte, eu peguei um script de uma spell de kamui in, e eu queria usar no meu DBO.
A skill funcionou normalmente (Ela funciona da seguinte forma: quando o jogador X usa a spell em um jogador Y, ambos os jogadores são teleportados para certa position)

Eu queria saber se alguém consegue fazer com que ao usar a spell, o caster (conjurador) demore 1 ou 2 segundos para se teleportar (se puder ser configurável tb é ótimo)

(Exemplo: o caster usa a spell no target, o target se teleporta para o local configurado imediatamente e depois de 2 segundos o caster também se teleporta para o local configurado)

Caso tenham alguma dúvida, avisem!

Edit: Percebi que eu estava na área errada, se alguém puder mover meu tópico fico agradecido.

Agradeço desde já.


Lua da spell -

Spoiler

local config = {
tempo = 20, -- tempo pra voltar
}
local newPos1 = {x = 0, y = 0, z = 0} --pos pra onde sera levado o caster da spell
local newPos2 = {x = 0, y = 0, z = 0} --pos pra onde sera levado o target

local function teleport(cid, pid, pos, pos2)
if isCreature(cid) then
doTeleportThing(cid, getClosestFreeTile(cid, pos))
doSendMagicEffect(getPlayerPosition(cid), 30)
end
if isCreature(pid) then
doTeleportThing(pid, getClosestFreeTile(pid, pos2 or pos))
doSendMagicEffect(getPlayerPosition(pid), 30)
end
end

function onCastSpell(cid, var)
local pos = getPlayerPosition(cid)


local target = getCreatureTarget(cid)
if not isCreature(target) or not isPlayer(target) then
return doPlayerSendTextMessage(cid, 27, "Voce só pode levar jogadores...")
end

if isInRange(pos, config.from, config.to) then
doPlayerSendCancel(cid, "Voce nao pode ir para sua dimensao agora!")
return false
end


if os.time() - getPlayerStorageValue(cid, config.storage) >= config.cooldown then
doPlayerSetStorageValue(cid, config.storage, os.time())
if isCreature(getCreatureTarget(cid)) then
target = getCreatureTarget(cid)
for i = 1, #exceptions do
if getCreatureName(target):lower() == exceptions then
doPlayerSendCancel(cid, "Voce nao consegue levar ".. getCreatureName(target) .." para a dimensao.")
return false
end
end
--------------- PLAYER-----------
addEvent(doTeleportThing, 1000*config.tempo, cid, pos, true)
addEvent(doCreatureSay, 1000*config.tempo, cid, config.msg, 20, false)
addEvent(doSendMagicEffect, 1000*config.tempo, pos, config.effect2)
doSendMagicEffect(pos, config.effect1)
doTeleportThing(cid, config.pos)
-------------------- OPONENTE ----------------
addEvent(doTeleportThing, 1000*config.tempo, target, getThingPos(target), true)
addEvent(doSendMagicEffect, 1000*config.tempo, getThingPos(target), config.effect2)
doSendMagicEffect(getThingPos(target), config.effect1)
doTeleportThing(target, config.pos)
-------------------------------------
if isPlayer(target) and isCreature(cid) then
doPlayerSendTextMessage(target, 27, "Voce foi levado por ".. getCreatureName(cid) ..".")
end
if isPlayer(cid) and isCreature(target) then
doPlayerSendTextMessage(cid, 27, "Voce teleportou o(a) ".. getCreatureName(target) .."!")
end
for i = 1,config.tempo  do
addEvent(function()
if isPlayer(target) then
doPlayerSendTextMessage(target,25,"O poder para manter a dimensao ira acabar em " .. config.tempo -i +1 .. " segundo(s)")
end
if isPlayer(cid) then
doPlayerSendTextMessage(cid,25,"O poder para manter a dimensao ira acabar em " .. config.tempo -i +1 .. " segundo(s)")
end
end, 1000*i)
end
else
---------- levar quem tá em volta do player ---------------
local teleportPosition = {
{x = pos.x, y = pos.y - 1, z = pos.z},
{x = pos.x, y = pos.y + 1, z = pos.z},
{x = pos.x - 1, y = pos.y, z = pos.z},
{x = pos.x + 1, y = pos.y, z = pos.z},
{x = pos.x - 1, y = pos.y + 1, z = pos.z},
{x = pos.x - 1, y = pos.y - 1, z = pos.z},
{x = pos.x + 1, y = pos.y - 1, z = pos.z},
{x = pos.x + 1, y = pos.y + 1, z = pos.z}
}


local mobas = {}
local checker = 0


 for _, tPos in ipairs(teleportPosition) do
doSendMagicEffect(tPos, config.effect2)
local mob = getTopCreature(tPos).uid
    if canEffect (tPos) and mob ~= 0 and (isMonster(mob) or isPlayer(mob)) then
for i = 1, #exceptions do
if getCreatureName(mob):lower() == exceptions then
checker = 1
break
end
end
if checker ~= 1 then
table.insert(mobas, mob) 
end
end
end


if #mobas > 0 then
for _, pid in ipairs(mobas) do
addEvent(doTeleportThing, 1000*config.tempo, pid, getThingPos(pid), true)
addEvent(doSendMagicEffect, 1000*config.tempo, getThingPos(pid), config.effect2)
doSendMagicEffect(getThingPos(pid), config.effect1)
doTeleportThing(pid, config.pos)
if isPlayer(pid) and isCreature(cid) then
doPlayerSendTextMessage(pid, 27, "Voce foi levado por ".. getCreatureName(cid) ..".")
end
for i = 1,config.tempo  do
addEvent(function()
if isPlayer(pid) then
doPlayerSendTextMessage(pid,25,"O poder para manter a dimensao ira acabar em " .. config.tempo -i +1 .. " segundo(s)")
end
end, 1000*i)
end
end
end
----------------------------
addEvent(doTeleportThing, 1000*config.tempo, cid, pos, true)
addEvent(doCreatureSay, 1000*config.tempo, cid, config.msg, 20, false)
addEvent(doSendMagicEffect, 1000*config.tempo, pos, config.effect2)
doSendMagicEffect(pos, config.effect1)
doTeleportThing(cid, config.pos)
if isPlayer(cid) then
doPlayerSendTextMessage(cid, 27, "Voce foi para sua dimensao.")
end
for i = 1,config.tempo do
addEvent(function()
if isPlayer(cid) then
doPlayerSendTextMessage(cid,25,"O poder para manter a dimensao ira acabar em " .. config.tempo -i +1 .. " segundo(s)")
end
end, 1000*i)
end
end
else
doPlayerSendCancel(cid, "Voce precisa reunir poder durante "..(config.cooldown - (os.time() - getPlayerStorageValue(cid, config.storage))).." segundos.")
end
return true
end


Xml da Spell
 

Spoiler

<instant name="Dimension In" words="dimension in" lvl="650" mana="15000" maglv="140" prem="0" range="10" needtarget="1" blockwalls="1" exhaustion="1000" needlearn="0" event="script" value="LvL600/dimension in.lua">
        <vocation id="292"/>
        <vocation id="293"/>
        <vocation id="294"/>
        <vocation id="295"/>
        <vocation id="296"/>
        <vocation id="297"/>
        <vocation id="298"/>
        <vocation id="299"/>
        <vocation id="300"/>
        <vocation id="301"/>
        <vocation id="302"/>
        <vocation id="303"/>
        <vocation id="491"/>
        <vocation id="845"/>
    </instant>

 

Editado por Yamili (veja o histórico de edições)

  • Respostas 6
  • Visualizações 1.3k
  • Created
  • Última resposta

Top Posters In This Topic

Postado
--------------- PLAYER-----------
addEvent(doTeleportThing, 2000*config.tempo, cid, pos, true) -- mude o valor para desejado
addEvent(doCreatureSay, 2000*config.tempo, cid, config.msg, 20, false)
addEvent(doSendMagicEffect, 2000*config.tempo, pos, config.effect2)
doSendMagicEffect(pos, config.effect1)
doTeleportThing(cid, config.pos)

Mude o valor 2000 para outro valor (Antes estava 1000 porem eu mudei para 2000)

 

@Yamili

O rei de seu proprio destino é aquele que luta pela gloria do amanhã!
Discord : ZoR#9373


 

Postado
  • Autor

@ZikaLord Olá meu caro, seguinte, do modo que vc me disse ali, o que aconteceu foi que:

Quando eu uso a spell, ou o target ou o caster irão voltar X segundos mais rápido que o outro da "dimensão".
(exemplo: Usei a spell em X player, nós dois iremos para a pos designada, porém eu irei voltar 1 segundo mais rápido que ele)

Perdão se eu expliquei errado, mas o que eu gostaria é justamente o oposto. No caso o caster da spell iria demorar 1 segundo a mais para IR para a "dimensão".
(exemplo: Usei a spell em X player, o player X irá ser imediatamente teletransportado para a position designada, e o caster ira se teleportar 1 segundo depois de o target ter ido)

Caso tenha alguma dúvida em algo que eu disse me avise ^^

E eu agora estou usando esse script (de Kamui) do White, mas o pedido ainda é o mesmo.

local config = {
pos = {x=42, y=234, z=7}, -- posição que o caster será teleportado
pos2 = {x=46, y=234, z=7}, -- posição que o target será teleportado
tempo = 5, -- tempo pra voltar
effect1 = 66, -- efeito ao ser teleportado
effect2 = 10, -- efeito ao voltar
storage = 19329, -- storage que fica guardado o cooldown
from = {x=35, y=228, z=7}, --- quina do kamui (pra impedir players de usarem o kamui dentro do kamui)
to = {x=49, y=240, z=7}, --- quina do kamui (pra impedir players de usarem o kamui dentro do kamui)
cooldown = 05, --- tempo entre um uso e outro (após usar a spell vc vai ficar X segundos sem poder usar ela novamente)
msg = "DIMENSION OUT!" -- mensagem ao sair do kamui
}


local exceptions = {'trainer', 'aegis', 'god anderson'} --- nome das criaturas que não poderão ser levadas para a dimension (sempre em minúsculo e entre aspas)


function canEffect(pos, pz, proj) -- Night Wolf based on Nord
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
if getTilePzInfo(pos) and not pz then return false end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end




function onCastSpell(cid, var)
local pos = getPlayerPosition(cid)


if isInRange(pos, config.from, config.to) then
doPlayerSendCancel(cid, "You cannot use Dimension spell inside the Dimension!")
return false
end


if os.time() - getPlayerStorageValue(cid, config.storage) >= config.cooldown then
doPlayerSetStorageValue(cid, config.storage, os.time())
if isCreature(getCreatureTarget(cid)) then
target = getCreatureTarget(cid)
for i = 1, #exceptions do
if getCreatureName(target):lower() == exceptions[i] then
doPlayerSendCancel(cid, "You can't take ".. getCreatureName(target) .." to Dimension.")
return false
end
end
--------------- PLAYER-----------
addEvent(doTeleportThing, 1000*config.tempo, cid, pos, true)
addEvent(doCreatureSay, 1000*config.tempo, cid, config.msg, 20, false)
addEvent(doSendMagicEffect, 1000*config.tempo, pos, config.effect2)
doSendMagicEffect(pos, config.effect1)
doTeleportThing(cid, config.pos)
-------------------- OPONENTE ----------------
addEvent(doTeleportThing, 1000*config.tempo, target, getThingPos(target), true)
addEvent(doSendMagicEffect, 1000*config.tempo, getThingPos(target), config.effect2)
doSendMagicEffect(getThingPos(target), config.effect1)
doTeleportThing(target, config.pos2)
-------------------------------------
if isPlayer(target) and isCreature(cid) then
doPlayerSendTextMessage(target, 27, "You were teleported by ".. getCreatureName(cid) ..".")
end
if isPlayer(cid) and isCreature(target) then
doPlayerSendTextMessage(cid, 27, "You teleported ".. getCreatureName(target) .."!")
end
for i = 1,config.tempo  do
addEvent(function()
if isPlayer(target) then
doPlayerSendTextMessage(target,25,"You'll be back in " .. config.tempo -i +1 .. " second(s)")
end
if isPlayer(cid) then
doPlayerSendTextMessage(cid,25,"You'll be back in " .. config.tempo -i +1 .. " second(s)")
end
end, 1000*i)
end
else
---------- levar quem tá em volta do player ---------------
local teleportPosition = {
{x = pos.x, y = pos.y - 1, z = pos.z},
{x = pos.x, y = pos.y + 1, z = pos.z},
{x = pos.x - 1, y = pos.y, z = pos.z},
{x = pos.x + 1, y = pos.y, z = pos.z},
{x = pos.x - 1, y = pos.y + 1, z = pos.z},
{x = pos.x - 1, y = pos.y - 1, z = pos.z},
{x = pos.x + 1, y = pos.y - 1, z = pos.z},
{x = pos.x + 1, y = pos.y + 1, z = pos.z}
}


local mobas = {}
local checker = 0


 for _, tPos in ipairs(teleportPosition) do
doSendMagicEffect(tPos, config.effect2)
local mob = getTopCreature(tPos).uid
    if canEffect (tPos) and mob ~= 0 and (isMonster(mob) or isPlayer(mob)) then
for i = 1, #exceptions do
if getCreatureName(mob):lower() == exceptions[i] then
checker = 1
break
end
end
if checker ~= 1 then
table.insert(mobas, mob) 
end
end
end


if #mobas > 0 then
for _, pid in ipairs(mobas) do
addEvent(doTeleportThing, 1000*config.tempo, pid, getThingPos(pid), true)
addEvent(doSendMagicEffect, 1000*config.tempo, getThingPos(pid), config.effect2)
doSendMagicEffect(getThingPos(pid), config.effect1)
doTeleportThing(pid, config.pos)
if isPlayer(pid) and isCreature(cid) then
doPlayerSendTextMessage(pid, 27, "You were teleported by ".. getCreatureName(cid) ..".")
end
for i = 1,config.tempo  do
addEvent(function()
if isPlayer(pid) then
doPlayerSendTextMessage(pid,25,"You'll be back in " .. config.tempo -i +1 .. " second(s)")
end
end, 1000*i)
end
end
end
----------------------------
addEvent(doTeleportThing, 1000*config.tempo, cid, pos, true)
addEvent(doCreatureSay, 1000*config.tempo, cid, config.msg, 20, false)
addEvent(doSendMagicEffect, 1000*config.tempo, pos, config.effect2)
doSendMagicEffect(pos, config.effect1)
doTeleportThing(cid, config.pos)
if isPlayer(cid) then
doPlayerSendTextMessage(cid, 27, "You teleported yourself.")
end
for i = 1,config.tempo do
addEvent(function()
if isPlayer(cid) then
doPlayerSendTextMessage(cid,25,"You'll be back in " .. config.tempo -i +1 .. " second(s)")
end
end, 1000*i)
end
end
else
doPlayerSendCancel(cid, "Your skill is in cooldown, you must wait "..(config.cooldown - (os.time() - getPlayerStorageValue(cid, config.storage))).." seconds.")
end
return true
end

 

Postado

eu tinha entendido que você queria que o player que usa-se tal tecnica iria demorar para ir para a dimension

O rei de seu proprio destino é aquele que luta pela gloria do amanhã!
Discord : ZoR#9373


 

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo