Jump to content
Close
pokeluma100

Scripting [AJUDA]Spell reta que puxa depois solta area

Recommended Posts

Queria uma spell reta que puxa-se o cara para sua frente, e depois que puxa-se ele tomaria um stun de 8 segundos e o player que conjurou não poderia se mover durante 8 segundos tambem.

Depois de ter puxado e tomado o stun os dois, ele soltaria um area que bateria 8 vezes durante 8 segundos

 

Obs: Vou Postar as duas scripts que tenho, se puderem juntar ja seria de muita ajuda, Obrigado.

 

Spell Que Puxa Reta:

Citar

local function doPushCreature(target, cid)
    if target > 0 then
   if not isNpc(target) then
   local position = getThingPosition(cid)
   local fromPosition = getThingPosition(target)
   local x = ((fromPosition.x - position.x) < 0 and -1 or ((fromPosition.x - position.x) == 0 and 0 or 1))
   local y = ((fromPosition.y - position.y) < 0 and -1 or ((fromPosition.y - position.y) == 0 and 0 or 1))
   local toPosition = {x = fromPosition.x - x, y = fromPosition.y - y, z = fromPosition.z}
   if doTileQueryAdd(target, toPosition) == 1 and getTileInfo(toPosition).house == false then
   doTeleportThing(target, toPosition, true)
   end
   end
    end
end
local spell = {}
spell.config = {
    [1] = {
   damageType = 1,
   areaEffect = 2,
   area = {
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
   }   
    },
    [2] = {
   damageType = 1,
   areaEffect = 2,
   area = {
   {0, 0, 0, 1, 0, 0, 0},
   {0, 0, 0, 1, 0, 0, 0},
   {0, 0, 0, 1, 0, 0, 0},
   {0, 0, 0, 2, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, 0}
   }   
    },
    [3] = {
   damageType = 1,
   areaEffect = 2,
   area = {
   {0, 0, 0, 1, 0, 0, 0},
   {0, 0, 0, 1, 0, 0, 0},
   {0, 0, 0, 1, 0, 0, 0},
   {0, 0, 0, 2, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, 0}
   }   
    }
}

spell.combats = {}
for _, config in ipairs(spell.config) do
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, config.damageType)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, config.areaEffect)
    setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -295.2, 1, -395.2, 1)
    function onTargetCreature(cid, target)
   doPushCreature(target, cid)
    end
    setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
    setCombatArea(combat, createCombatArea(config.area))
    table.insert(spell.combats, combat)
end
function onCastSpell(cid, var)
local p = getCreaturePosition(cid)
local x = {
[0] = {x=p.x+1, y=p.y-1, z=p.z},
[1] = {x=p.x+4, y=p.y+1, z=p.z},
[2] = {x=p.x+1, y=p.y+4, z=p.z},
[3] = {x=p.x-1, y=p.y+1, z=p.z}
}

local y = {
[0] = 473,
[1] = 474,
[2] = 475,
[3] = 476
}

pos = x[getCreatureLookDirection(cid)]
eff = y[getCreatureLookDirection(cid)]
doSendMagicEffect(pos, eff)
exhaustion.set(cid, storage, waittime)
doCombat(cid, combat, var)
    for n = 1, #spell.combats do
   addEvent(doCombat, (n * 120), cid, spell.combats[n], var)
    end
    return true
end

Spell area que solta depois de puxar:

Citar

-- SpellCreator generated.

-- =============== COMBAT VARS ===============
-- Areas/Combat for 0ms
local combat0_Foice = createCombatObject()
setCombatParam(combat0_Foice, COMBAT_PARAM_EFFECT, 492)
setCombatParam(combat0_Foice, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Foice,createCombatArea({{1, 0},
{0, 2}}))
local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush,createCombatArea({{0, 1, 1},
{1, 2, 1},
{1, 1, 1}}))
setCombatFormula(combat0_Brush, COMBAT_FORMULA_SKILL, -190, 2, -190, 2)

-- Areas/Combat for 5600ms
local combat56_Foice = createCombatObject()
setCombatParam(combat56_Foice, COMBAT_PARAM_EFFECT, 492)
setCombatParam(combat56_Foice, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat56_Foice,createCombatArea({{1, 0},
{0, 2}}))


-- Areas/Combat for 5500ms
local combat55_Brush = createCombatObject()
setCombatParam(combat55_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat55_Brush,createCombatArea({{1, 1, 1},
{1, 2, 1},
{1, 1, 1}}))
setCombatFormula(combat55_Brush, COMBAT_FORMULA_SKILL, -190, 2, -190, 2)

-- Areas/Combat for 4900ms
local combat49_Jashin = createCombatObject()
setCombatParam(combat49_Jashin, COMBAT_PARAM_EFFECT, 491)
setCombatParam(combat49_Jashin, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat49_Jashin,createCombatArea({{1, 0},
{0, 2}}))


-- Areas/Combat for 4800ms
local combat48_Foice = createCombatObject()
setCombatParam(combat48_Foice, COMBAT_PARAM_EFFECT, 492)
setCombatParam(combat48_Foice, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat48_Foice,createCombatArea({{1, 0},
{0, 2}}))


-- Areas/Combat for 4700ms
local combat47_Brush = createCombatObject()
setCombatParam(combat47_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat47_Brush,createCombatArea({{1, 1, 1},
{1, 2, 1},
{1, 1, 1}}))
setCombatFormula(combat47_Brush, COMBAT_FORMULA_SKILL, -190, 2, -190, 2)

-- Areas/Combat for 100ms
local combat1_Jashin = createCombatObject()
setCombatParam(combat1_Jashin, COMBAT_PARAM_EFFECT, 491)
setCombatParam(combat1_Jashin, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat1_Jashin,createCombatArea({{1, 0},
{0, 2}}))
local combat1_Brush = createCombatObject()
setCombatParam(combat1_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat1_Brush,createCombatArea({{2}}))
setCombatFormula(combat1_Brush, COMBAT_FORMULA_SKILL, -190, 2, -190, 2)

-- Areas/Combat for 800ms
local combat8_Foice = createCombatObject()
setCombatParam(combat8_Foice, COMBAT_PARAM_EFFECT, 492)
setCombatParam(combat8_Foice, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat8_Foice,createCombatArea({{1, 0},
{0, 2}}))


-- Areas/Combat for 1500ms
local combat15_Brush = createCombatObject()
setCombatParam(combat15_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat15_Brush,createCombatArea({{1, 1, 1},
{1, 2, 1},
{1, 1, 1}}))
setCombatFormula(combat15_Brush, COMBAT_FORMULA_SKILL, -190, 2, -190, 2)

-- Areas/Combat for 2300ms
local combat23_Brush = createCombatObject()
setCombatParam(combat23_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat23_Brush,createCombatArea({{1, 1, 1},
{1, 2, 1},
{1, 1, 1}}))
setCombatFormula(combat23_Brush, COMBAT_FORMULA_SKILL, -190, 2, -190, 2)

-- Areas/Combat for 2400ms
local combat24_Foice = createCombatObject()
setCombatParam(combat24_Foice, COMBAT_PARAM_EFFECT, 492)
setCombatParam(combat24_Foice, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat24_Foice,createCombatArea({{1, 0},
{0, 2}}))


-- Areas/Combat for 3100ms
local combat31_Brush = createCombatObject()
setCombatParam(combat31_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat31_Brush,createCombatArea({{1, 1, 1},
{1, 2, 1},
{1, 1, 1}}))
setCombatFormula(combat31_Brush, COMBAT_FORMULA_SKILL, -190, 2, -190, 2)

-- Areas/Combat for 3200ms
local combat32_Foice = createCombatObject()
setCombatParam(combat32_Foice, COMBAT_PARAM_EFFECT, 492)
setCombatParam(combat32_Foice, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat32_Foice,createCombatArea({{1, 0},
{0, 2}}))


-- Areas/Combat for 3300ms
local combat33_Jashin = createCombatObject()
setCombatParam(combat33_Jashin, COMBAT_PARAM_EFFECT, 491)
setCombatParam(combat33_Jashin, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat33_Jashin,createCombatArea({{1, 0},
{0, 2}}))


-- Areas/Combat for 3900ms
local combat39_Brush = createCombatObject()
setCombatParam(combat39_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat39_Brush,createCombatArea({{1, 1, 1},
{1, 2, 1},
{1, 1, 1}}))
setCombatFormula(combat39_Brush, COMBAT_FORMULA_SKILL, -190, 2, -190, 2)

-- Areas/Combat for 4000ms
local combat40_Foice = createCombatObject()
setCombatParam(combat40_Foice, COMBAT_PARAM_EFFECT, 492)
setCombatParam(combat40_Foice, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat40_Foice,createCombatArea({{1, 0},
{0, 2}}))


-- =============== CORE FUNCTIONS ===============
local function RunPart(c,cid,var,dirList,dirEmitPos) -- Part
    if (isCreature(cid)) then
        doCombat(cid, c, var)
        if (dirList ~= nil) then -- Emit distance effects
            local i = 2;
            while (i < #dirList) do
                doSendDistanceShoot(dirEmitPos,{x=dirEmitPos.x-dirList,y=dirEmitPos.y-dirList[i+1],z=dirEmitPos.z},dirList[1])
                i = i + 2
            end        
        end
    end
end

function onCastSpell(cid, var)
    local startPos = getCreaturePosition(cid)
    RunPart(combat0_Foice,cid,var)
    RunPart(combat0_Brush,cid,var)
    addEvent(RunPart,5600,combat56_Foice,cid,var)
    addEvent(RunPart,5500,combat55_Brush,cid,var)
    addEvent(RunPart,4900,combat49_Jashin,cid,var)
    addEvent(RunPart,4800,combat48_Foice,cid,var)
    addEvent(RunPart,4700,combat47_Brush,cid,var)
    addEvent(RunPart,100,combat1_Jashin,cid,var)
    addEvent(RunPart,100,combat1_Brush,cid,var)
    addEvent(RunPart,800,combat8_Foice,cid,var)
    addEvent(RunPart,1500,combat15_Brush,cid,var)
    addEvent(RunPart,2300,combat23_Brush,cid,var)
    addEvent(RunPart,2400,combat24_Foice,cid,var)
    addEvent(RunPart,3100,combat31_Brush,cid,var)
    addEvent(RunPart,3200,combat32_Foice,cid,var)
    addEvent(RunPart,3300,combat33_Jashin,cid,var)
    addEvent(RunPart,3900,combat39_Brush,cid,var)
    addEvent(RunPart,4000,combat40_Foice,cid,var)
    return true
end

Exemplo Abaixo \/

 

Primeiro Ele Solta o Push

image.thumb.png.13e11dcc619f507d1807f0da4baf0b37.png

image.thumb.png.c264724ba1c01a8c626e72efacbcdafc.png

 

Depois de ter puxado o player e dando stun nos dois ele usaria esse area:

image.thumb.png.480d0b9ee75fb9b75a2eb0058fa8b29a.png

 

e bateria 8 vezes


Edited by pokeluma100
tamanho da imagem esta muito grande (see edit history)



Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


Open Tibia Server

Quer aprender a criar seu próprio servidor de Tibia? Então está no lugar certo, aqui você encontrará milhares de tutorias, scripts, códigos, mapas e utilitários para que você possa fazer o seu próprio servidor de Tibia começando do zero.

Redes Sociais

Anuncie no Tibia King

Precisa de mais visibilidade em seus projetos? Quer fazer um plano publicitário para o seu servidor? Anuncie no Tibia King e faça sua divulgação, possuímos centenas de acessos simultâneos e milhares diários, com certeza será a sua solução!

×
×
  • Create New...