AL
pedido

Spell que teleporta o target

Por Allangod, 27 de dez. de 2012 em Scripts

10
1.3k
AllangodA
27 de dezembro de 2012 às 22:16

Gostaria de pedir uma spell que teleportasse eu e o target para um lugar do mapa (que eu possa configurar) durante 30 segundos.

Quando acabar os 30 segundos eu e ele voltassemos ao lugar.

Vlw

Editado Dezembro 27 por Allangod

SlicerS
27 de dezembro de 2012 às 22:45

tenta assim..

 

local newPos = {x = 1000, y = 1000, z = 7} --pos pra onde serao levados

local time = 30 --tempo pra teleporta devolta, em segs

local function teleport(cid, pid, pos, pos2)

if isCreature(cid) then

doTeleportThing(cid, getClosestFreeTile(cid, pos))

doSendMagicEffect(getPlayerPosition(cid), 21)

end

if isCreature(pid) then

doTeleportThing(pid, getClosestFreeTile(pid, pos2 or pos))

doSendMagicEffect(getPlayerPosition(pid), 21)

end

end

 

function onCastSpell(cid, var)

local target = getCreatureTarget(cid)

if not isCreature(target) then

return doPlayerSendTextMessage(cid, 27, "You need a target to do this!")

end

local posCid = getPlayerPosition(cid)

local posTarget = getPlayerPosition(target)

teleport(cid, target, newPos)

addEvent(teleport, time*1000, cid, target, posCid, posTarget)

return true

end

 

coloque piso anti-logout no lugar.. se n teria q fazer um onLogin tb..

AllangodA
27 de dezembro de 2012 às 22:58

Alias, pegou slicer mas tipo...

Ele manda eu e o target pro mesmo lugar.

Teria como ele mandar eu pra um lugar e ele para outro?

Editado Dezembro 27 por Allangod

SlicerS
27 de dezembro de 2012 às 23:03

 

local newPos1 = {x = 1000, y = 1000, z = 7} --pos pra onde sera levado o caster da spell

local newPos2 = {x = 1000, y = 1000, z = 7} --pos pra onde sera levado o target

local time = 30 --tempo pra teleporta devolta, em segs

local function teleport(cid, pid, pos, pos2)

if isCreature(cid) then

doTeleportThing(cid, getClosestFreeTile(cid, pos))

doSendMagicEffect(getPlayerPosition(cid), 21)

end

if isCreature(pid) then

doTeleportThing(pid, getClosestFreeTile(pid, pos2 or pos))

doSendMagicEffect(getPlayerPosition(pid), 21)

end

end

 

function onCastSpell(cid, var)

local target = getCreatureTarget(cid)

if not isCreature(target) then

return doPlayerSendTextMessage(cid, 27, "You need a target to do this!")

end

local posCid = getPlayerPosition(cid)

local posTarget = getPlayerPosition(target)

teleport(cid, target, newPos1, newPos2)

addEvent(teleport, time*1000, cid, target, posCid, posTarget)

return true

end

 

testa ae

AllangodA
28 de dezembro de 2012 às 08:29

Funcionou perfeitamente slicer, vc sabe fazer uma igualzinha a essa só que tipo... ela só manda o target para o lugar do mapa, ela no caso nao me mandaria pra lugar nenhum. Mas mesmo assim REP+

Editado Dezembro 28 por Allangod

SlicerS
28 de dezembro de 2012 às 10:39
local newPos = {x = 1000, y = 1000, z = 7} --pos pra onde sera levado o target
local time = 30 --tempo pra teleporta devolta, em segs
local function teleport(cid, pos)
if isCreature(cid) then
doTeleportThing(cid, getClosestFreeTile(cid, pos))
doSendMagicEffect(getPlayerPosition(cid), 21)
end
end

function onCastSpell(cid, var)
local target = getCreatureTarget(cid)
if not isCreature(target) then
return doPlayerSendTextMessage(cid, 27, "You need a target to do this!")
end
local posTarget = getPlayerPosition(target)
teleport(target, newPos)
addEvent(teleport, time*1000, target, posTarget)
return true
end

AllangodA
28 de dezembro de 2012 às 10:44

Mas ae eu to indo junto :/

Eu queria que só o target fosse teleportado.

SlicerS
28 de dezembro de 2012 às 10:45

impossivel tu ta indo junto o.O pego oq botei ali emcima?

mas qlqr coisa.. tente usar esse, soh pra garantir kk

 

local newPos = {x = 1000, y = 1000, z = 7} --pos pra onde sera levado o target

local time = 30 --tempo pra teleporta devolta, em segs

local function teleport(target, pos)

if isCreature(target) then

doTeleportThing(target, getClosestFreeTile(target, pos))

doSendMagicEffect(getPlayerPosition(target), 21)

end

end

 

function onCastSpell(cid, var)

local target = getCreatureTarget(cid)

if not isCreature(target) then

return doPlayerSendTextMessage(cid, 27, "You need a target to do this!")

end

local posTarget = getPlayerPosition(target)

teleport(target, newPos)

addEvent(teleport, time*1000, target, posTarget)

return true

end

 

Editado Dezembro 28 por Slicer

AllangodA
28 de dezembro de 2012 às 10:51

Puts cara foi mal, eu tinha editado errado.

Muito obrigado ae :D

Funfo. Podem mover o topico.

SlicerS
28 de dezembro de 2012 às 10:54

sanado, movido ^^