Yoh Tenho essa akie Mangekyou kamui me:
info
Grupo: Artesão
Registrado: 13/04/13
Posts: 148
Reputação: +14
Gênero: Masculino
Char no Tibia: tempest flower
Yoh Tenho essa akie Mangekyou kamui me:
é +/- isso no caso seria 1 PrepareonDeath e em creaturescripts para só ativar quando o player tve-se usado a magia e na hr de ele morrer n perde nd
Alguem ?
O exausted, você coloca na tag da spell. Fiz rápido ambos os códigos, pois logo estarei saindo.
PS: Suponho que você saiba fazer as tags (não se esqueça de registrar o evento em login.lua).
Spell:
function onCastSpell(cid, var)
local msg = "If you die while Izanagi's effect (%d seconds) is activated, you'll be teleported to an place, then teleported to your death's position."
local time = 30 --Duração do efeito do Izanagi.
local msg_two = "In %d seconds, the Izanagi's effect will end."
local IZANAGI_STORAGE = 91831
if getPlayerStorageValue(cid, IZANAGI_STORAGE) > os.time() then
return doPlayerSendCancel(cid, msg_two:format(getPlayerStorageValue(cid, IZANAGI_STORAGE)))
else
doPlayerSendTextMessage(cid, 27, msg:format(time))
setPlayerStorageValue(cid, IZANAGI_STORAGE, os.time() + time)
end
return true
end
local time = 5 --Depois de quanto tempo o jogador será teleportado para o local da morte (já que quando "morrer" será teleportado para outro local, como você disse no tópico).
local pos = {x = x, y = y, z = z} --Para onde será teleportado.
local IZANAGI_STORAGE = 91831
local function Revive(cid, id)
addEvent(function()
if not isCreature(cid) then
if id then
local pos = db.getResult("SELECT value FROM player_storage WHERE player_id = "..id.." AND key = 91832")
if pos:getID() == -1 then return true end
local x = pos.x
local y = pos.y
local z = pos.z
return db.executeQuery("UPDATE players SET posx = "..x..", posy = "..y..", posz = "..z.." WHERE id = "..id)
end
else
local posis = {}
posis.x = getPlayerStorageValue(cid, 91832).x
posis.y = getPlayerStorageValue(cid, 91832).y
posis.z = getPlayerStorageValue(cid, 91832).z
doTeleportThing(cid, posis)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have been teleported to your death's place.")
end
end, time * 1000)
end
function onPrepareDeath(cid)
if isPlayer(cid) and getPlayerStorageValue(cid, IZANAGI_STORAGE) > os.time() then
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
doCreatureAddMana(cid, getCreatureMaxMana(cid))
setPlayerStorageValue(cid, 91832, getThingPos(cid))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, string.format("You have been revived by Izanagi. In %d, you will be teleported to your death's place.", time)
doTeleportThing(cid, pos)
Revive(cid, getPlayerGUID(cid))
end
return true
endEditado Fevereiro 19 por zipter98
Consegui Fazer a Tecnica.
Segue:
Creaturescripts.
function restore(cid, pos, seconds)
if not isCreature(cid) then return true end
if seconds == 0 then
doTeleportThing(cid, pos)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
end
addEvent(setPlayerStorageValue, 6000, cid, 56982, 0)
addEvent(mayNotMove, 5000, cid, false)
addEvent(restore, 1000, cid, pos, seconds -1)
end
function onPrepareDeath(cid, deathList)
local posArena = {x = 302, y = 45, z = 5} --´posição da area la q vc falo
if getPlayerStorageValue(cid, 56982) == 1 then
restore(cid, getThingPos(cid), 5)
doTeleportThing(cid, posArena)
mayNotMove(cid, true)
return false
end
return true
end
Spell :
function onCastSpell(cid, var)
setPlayerStorageValue(cid, 56982, 1)
return true
end
Simples! Funciona 1 x e depois precisa usa-la dnv ! quando o player morrer ele remove a storage e fica normal !
Tópico movido para a seção de dúvidas e pedidos resolvidos.
info
Grupo: Campones
Registrado: 08/01/07
Posts: 58
Reputação: +3
Bom dia Galera Prcso de 1 Scritp um pouco complexo !
Seguinte o Player Usa 1 magia e se ele dentro de 30 segundo ele morrer, o player não morre ele é teleportado para 1 area e volta pra onde ele tinha morrido e só pode usar 1 x a cada 2 min