local config = {
storage = 91813, 5981765,
cooldown = 30, --- tempo entre um uso e outro
duration = 15, --- duração
effect1 = 14 -- efeito que sai ao falar a spell
}
local function visible(cid)
if not isPlayer(cid) then return true end
doCreatureSetHideHealth(cid, false)
doChangeSpeed(cid, getCreatureSpeed(cid) - config.speed)
end
local outfit = createConditionObject(CONDITION_INVISIBLE, config.duration * 1000, false)
function onCastSpell(cid, var)
local pos = getCreaturePosition(cid)
local target = getCreatureTarget(cid)
local targetpos = getCreaturePosition(target)
local kokua = {x=1904, y=735, z=7}
local alvo = {x=1904, y=735, z=7}
local from1,to1 = {x=1897, y=731, z=7},{x=1909, y=742, z=7}
local from2,to2 = {x=979, y=911, z=7},{x=994, y=918, z=7}
local from3,to3 = {x=1897, y=731, z=7},{x=1909, y=742, z=7}
local from4,to4 = {x=1019, y=921, z=5},{x=1033, y=924, z=5}
local from5,to5 = {x=663, y=1098, z=7},{x=685, y=1104, z=7}
local from6,to6 = {x=965, y=1483, z=7},{x=979, y=1494, z=7}
local from7,to7 = {x=1161, y=1177, z=7},{x=1167, y=1188, z=7}
local from8,to8 = {x=984, y=578, z=7},{x=1044, y=652, z=7} -- shinobi war
local from9,to9 = {x=1243, y=725, z=6},{x=1255, y=738, z=6}
if os.time() - getPlayerStorageValue(cid, 55611) >= config.cooldown then
if os.time() - getPlayerStorageValue(cid, 55689) >= config.cooldown then
setPlayerStorageValue(cid, 55611, os.time())
setPlayerStorageValue(cid, 55689, os.time())
doSendMagicEffect(getCreaturePosition(cid), config.effect1)
setPlayerStorageValue(cid, config.storage, os.time() + config.duration)
doCreatureSay(cid,"", 19)
doAddCondition(cid, outfit)
doCreatureSetHideHealth(cid, true)
doChangeSpeed(cid, getCreatureSpeed(cid) + config.speed)
setPlayerStorageValue(cid, config.storage , os.time() + config.duration)
addEvent(visible, config.duration*1000, cid)
doPlayerSendTextMessage(cid, 27, "You have now ".. config.duration .." seconds of invulnerability.")
else
doPlayerSendCancel(cid, "Your skill is in cooldown, you must wait "..(config.cooldown - (os.time() - getPlayerStorageValue(cid, 55611))).." seconds.")
doPlayerSendCancel(cid, "Your skill is in cooldown, you must wait "..(config.cooldown - (os.time() - getPlayerStorageValue(cid, 55689))).." seconds.")
return false
end
end
end
if isInRange(pos, from1, to1) then
doPlayerSendCancel(cid, "Você ja esta dentro do Kokuangyou no Jutsu!")
return FALSE
end
if isInRange(pos, from2, to2) or isInRange(pos, from3, to3) or isInRange(pos, from4, to4) or isInRange(pos, from5, to5) or isInRange(pos, from6, to6) or isInRange(pos, from7, to7) or isInRange(pos, from8, to8) or isInRange(pos, from9, to9) then
doPlayerSendCancel(cid, "Você nao pode usar o Kokuangyou no Jutsu aqui!")
return FALSE
end
if getTileInfo(getThingPos(cid)).pvp then
doPlayerSendCancel(cid, "Você nao pode usar o Tsukuyomi World aqui!")
return FALSE
end
if getTileInfo(getThingPos(cid)).pvp then
doPlayerSendCancel(cid, "Você nao pode usar o Kamui no Jutsu aqui!")
return FALSE
end
if exhaustion.check(cid, 13132) == TRUE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, 13132) .. " segundos para usar novamente.")
return FALSE
end
local function Teleport_Player(cid)
doTeleportThing(cid, pos)
end
local function Teleport_Target(target)
doCreatureSetNoMove(target, 0)
doTeleportThing(target, targetpos)
end
local function Teleport_Player_Emergency()
for x = from1.x, to1.x do
for y = from1.y, to1.y do
local mob_player = getTopCreature({x=x, y=y, z=from1.z}).uid
if mob_player ~= 0 and isPlayer(mob_player) then
doTeleportThing(cid, pos)
end
end
end
end
local function Teleport_Target_Emergency()
for x = from1.x, to1.x do
for y = from1.y, to1.y do
local mob_target = getTopCreature({x=x, y=y, z=from1.z}).uid
if mob_target ~= 0 and isPlayer(mob_target) then
doCreatureSetNoMove(target, 0)
doTeleportThing(target, targetpos)
end
end
end
end
if isPlayer(target) then
exhaustion.set(cid, 13132, 40)
doCreatureSetNoMove(target, 1)
doTeleportThing(cid,kokua)
doTeleportThing(target,alvo)
doSendMagicEffect(alvo, 0)
doCreatureSay(cid, "", TALKTYPE_MONSTER)
addEvent(Teleport_Player, 15000, cid)
addEvent(Teleport_Target, 15000, target)
addEvent(Teleport_Player_Emergency, 20000)
addEvent(Teleport_Target_Emergency, 20000)
else
doPlayerSendCancel(cid, "Use apenas em players.")
end
testa assim ae