FL

[Resolvido] [Pedido] Heavy Slam e Passiva Iron Body

Por FlamesAdmin, 25 de jun. de 2015 em Resolvidos

resolvido
19
3.9k
zipter98Z
29 de junho de 2015 às 19:43
Melhor resposta

Já terminei faz tempo, só estou esperando você avisar que criou o item.

Certamente não ficou igual a PxG, porque, caso tenham usado esse método, deve ter demorado um bom tempo para achar o tempo ideal para representar um pulo "perfeito" (como o da gif). E, sinceramente, não estava com paciência de ficar procurando tal tempo.

Função de pulo:

function jump(cid, rounds)
    doChangeSpeed(cid, -getCreatureSpeed(cid))
    doCreatureSetNoMove(cid, true)
    for i = 1, rounds do
        addEvent(function()
            if isCreature(cid) then
                local pos = getThingPos(cid)
                local item = doCreateItem(ITEM_INVISIVEL, 1, pos)
                addEvent(function()
                    local it = getTileItemById(pos, ITEM_INVISIVEL).uid
                    if it > 0 then
                        doRemoveItem(it)
                    end
                    if i == rounds then
                        doRegainSpeed(cid)
                        doCreatureSetNoMove(cid, false)
                    end
                end, rounds == 1 and 200 or (i + 2) * 100)
            end
        end, i * (rounds == 1 and 200 or 100))
    end
end
Use jump(cid, 1) para um pulo de altura "1" (como o causado pelo Earthquake), e jump(cid, 2) para pulos como do Heavy Slam.
Código do Heavy Slam:
local config = {
    areas = {area1, area2},        --Áreas, em ordem de execução.
    effect = 160,                  --Efeito.
    combat = NORMALDAMAGE,         --Elemento.
}
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
jump(cid, 2)
addEvent(function()
    for i = 0, #config.areas - 1 do
        addEvent(function()
            local pos = getPosfromArea(cid, config.areas[i + 1])
            doMoveInArea2(cid, config.effect, config.areas[i + 1], config.combat, min, max)
            for j = 1, #pos do
                local pid = getTopCreature(pos[j]).uid
                if ehMonstro(pid) then
                    doPushCreature(pid, cid)
                elseif isSummon(pid) then
                    local master = getCreatureMaster(pid)
                    if isSummon(cid) then
                        if getPlayerStorageValue(master, 52480) >= 1 and getPlayerStorageValue(master, 52481) >= 0 then
                            local masterCid = getCreatureMaster(cid)
                            if isDuelingAgainst(masterCid, master) then
                                doPushCreature(pid, cid)
                            end
                        end
                    else
                        doPushCreature(pid, cid)
                    end
                end
            end
        end, i * 230)
    end
end, 650)

Editado Junho 29 por zipter98

30 de junho de 2015 às 05:23

Zipter, na boa, tenho que muito a agradecer a tu pelo trabalho que tu faz, e pela tao boa vontade em ajudar.

Funcionou perfeitamente o Heavy Slam.

Muito obrigado pela ajuda.

 

Sobre o pulo do Earthquake:

Quem sofre esse pulo é o oponente, e fica pulando até que o Earthquake acabe.

Editado Junho 30 por FlamesAdmin

1 mês depois...
BrunoB
14 de julho de 2015 às 17:56

Tópico movido para dúvidas / pedidos resolvidos.

2 anos depois...
FrenviusF
29 de novembro de 2017 às 14:22
A questão neste tópico de suporte foi respondida e/ou o autor do tópico resolveu o problema. Este tópico está fechado e foi movido para Suporte - Resolvidos. Se você tiver outras dúvidas, crie um novo tópico.