A pedido do juan500:
Essa spell consiste em teleportar o player para um local onde seria o sapo que Jiraya sumona para prender seus adversários, tornando-os mais lentos:
Testado em TSF 8.6.
(O vídeo se localiza no final do tópico)
Em data/talkactions/scripts crie um arquivo.lua nomeie para Jiraya e adicione:
function onSay(cid, words, param)
local waittime = 200 -- Tempo de exhaustion
local storage = 5560
local pos = getCreaturePosition(cid)
local from = {x=pos.x, y=pos.y, z=pos.z}
local to = {x = 631, y = 880, z = 15} -- Onde estara o tile do player atingido
local to1 = {x = 635, y = 880, z = 15} -- Onde estara o tile do caster
local to2 = {x = 581, y = 877, z = 15} -- Onde estara o tile com action id
local area1 = {x = 611, y = 850, z = 15} -- Ponta de cima na esquerda
local area2 = {x = 665, y = 909, z = 15} -- Ponta de baixo na direita
local ppos = getCreaturePosition(cid)
local level = 100 -- Level necessário
local pl1 = {x=ppos.x-7, y=ppos.y-5, z=ppos.z}
local pl2 = {x=ppos.x+7, y=ppos.y+5, z=ppos.z}
if getPlayerLevel(cid) < level then
doPlayerSendCancel(cid, "Você precisa de level "..level.." para usar essa magia.")
return true
end
function back(cid)
if isInArea(getCreaturePosition(cid), area1, area2) then
doTeleportThing(cid, from)
end
end
function go(cid)
if isInArea(getCreaturePosition(cid), pl1, pl2) then
doTeleportThing(cid, to2)
end
end
function gos(cid)
if isInArea(getCreaturePosition(cid), from, from) then
doTeleportThing(cid, to1)
end
end
function goback(cid)
if isInArea(getCreaturePosition(cid), to2, to2) then
doTeleportThing(cid, to)
end
end
if exhaustion.check(cid, storage) == false then
for _, pid in ipairs(getPlayersOnline()) do
addEvent(back, 420000, pid) -- Tempo para retornar ao lugar que foi atingido (1000 = 1 segundo)
addEvent(go, 150, pid)
addEvent(gos, 1, pid)
addEvent(goback, 300, pid)
doSendMagicEffect(getCreaturePosition(pid), 63)
doCreatureSay(pid, "FROG TRAP!", TALKTYPE_MONSTER) --- Mensagem
addEvent(setPlayerStorageValue, 10000, pid, 1634, -1)
end
exhaustion.set(cid, storage, waittime)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar a spell novamente.")
end
return true
end
Editando:
-Verde: Variáveis, script auto explicativo
Em talkactions.xml adicione:
<talkaction words="frog" event="script" value="Jiraya.lua"/>
Editando:
-Vermelho: Palavra mágica (palavra que aciona a spell)
Em data/movements/scripts crie um arquivo.lua nomeie para Jiraya e adicione:
local condition = createConditionObject(CONDITION_HASTE)
setConditionParam(condition, CONDITION_PARAM_TICKS, (11 * 60 + 35) * 1000)
setConditionFormula(condition, -0.5, 0, -1.1, 0)
local function myCustomFunction(cid, turn)
if not isCreature(cid) or (turn and turn <= 0) then return true end
local t = turn or 210
doAddCondition(cid, condition)
addEvent(myCustomFunction, 2000, cid, t - 1)
end
function onStepIn(cid, item, pos)
myCustomFunction(cid, 210)
return TRUE
end
Editando:
-Verde: Fórmula
-Vermelho: Tempo que irá durar (no caso 1 = 2 segundos)
-Laranja: Tempo correspondente a 1 t (1000 = 1 segundo)
Em movements.xml adicione:
<movevent type="StepIn" actionid="1651" event="script" value="Jiraya.lua"/>
Adicionando no seu RME:
Vídeo demonstrativo:
Créditos:
Newtonnotwen, pelo script e pelo post
juan500, pela ideia da spell
LuckOake, pelo script inicial
brun123, por algumas funções do tile.