Ir para conteúdo

Zelda Like Bridge - Fiery Death


Administrador

Posts Recomendados

  • Administrador
Feito por Codex NG. Esse script vai criar uma ponte em direção x e, em seguida, irá destruir-se e enviar o jogador para o andar de baixo.

Zelda Like Bridge

--[[
    Zelda like bridge by Breed
]]

c = { -- config
        b =
            { -- this is your starting point, depending on the direction you choose is the direction your bridge will form
                x=124, y=125, z=6, -- every tile after this location will form a bridge for the value of bridgeLength
            },
        sp = 0, -- do not edit
        actionid = 803, -- action id of the tile which activates the bridge
        -- these are the normal switch id's but you can use any tiles you like 
        tileStepIn = 426, -- the switch or item you want to use to click on
        tileStepOut = 425, -- the it will be transformed to
        bridgeLength = 13, -- the length of the bridge in tiles
        bridgeItem = 406, -- 406 is black, 407 is white
        direction = {"north", "east", "south", "west"},
        timer = 2, -- time in seconds, 1 equals 1 second
        itemid  = {}, -- table to hold the items that are removed
        oldLoc = {},
        tile_id = 459, -- stairs
        create = CONST_ME_GROUNDSHAKER, -- this is the effect when creating the bridge
        destroy = CONST_ME_FIREAREA, -- this is the effect when destroying the bridge
        exhaust = true,
        exhaust_time = 1, -- this is the
        monster = "Demon"
    }
 
local choice = "east"

-- Do not edit anything below
function onStepIn(cid, item, pos, fromPos)
    if item.itemid == c.tileStepIn and item.actionid == c.actionid and isPlayer(cid) then
        if c.exhaust then
            c.exhaust = false
            if choice == c.direction[1] then -- north
                for i = 1, c.bridgeLength do
                    c.oldLoc[i] = {x = c.b.x, y = c.b.y - i, z = c.b.z, stackpos = c.sp}
                end
            elseif choice == c.direction[2] then -- east
                for i = 1, c.bridgeLength do
                    c.oldLoc[i] = {x = c.b.x + i, y = c.b.y, z = c.b.z, stackpos = c.sp}
                end
            elseif choice == c.direction[3] then -- south
                for i = 1, c.bridgeLength do
                    c.oldLoc[i] = {x = c.b.x, y = c.b.y + i, z = c.b.z, stackpos = c.sp}
                end
            elseif choice == c.direction[4] then -- west
                for i = 1, c.bridgeLength do
                    c.oldLoc[i] = {x = c.b.x - i, y = c.b.y, z = c.b.z, stackpos = c.sp}
                end
            end
            for i = 1, c.bridgeLength do
                local l = c.oldLoc[i]
                c.itemid[i] = getThingfromPos(c.oldLoc[i]).itemid
                local bridge = (i % 2 == 0) and c.bridgeItem or c.bridgeItem + 1 -- this will swap between 2 different tiles
                addEvent(makeBridge, i * 1000, c.oldLoc[i], bridge, c.create)
            end
            doTransformItem(item.uid, c.tileStepOut)
            addEvent(removeBridge, (c.bridgeLength + c.timer) * 1000, c)
            return true
        else
            doTransformItem(item.uid, c.tileStepOut)
        end
    end
    return true
end

function makeBridge(pos, item, effect)
    local newpos = {x = pos.x, y = pos.y, z = pos.z + 1}
    doSendMagicEffect(pos, effect)
    doTransformItem(getThingfromPos(pos).uid, item)
    if getTopCreature(pos).uid > 1 then
        local player = Tile(pos):getTopCreature()
        if player ~= nil or player:isPlayer() then
            player:getPosition():sendMagicEffect(CONST_ME_ENERGYAREA)
            player:teleportTo(newpos, false)
        end
    end
end

function resetExhaust(c, val)
    c.exhaust = val
end

function removeBridge(c)
    for n = 1, c.bridgeLength do
        addEvent(makeBridge, n * 1000, c.oldLoc[n], c.tile_id, c.destroy)
        if (n * 1000) == (c.bridgeLength * 1000) then
            addEvent(resetExhaust, (c.bridgeLength + c.exhaust_time) * 1000, c, true)
            doSummonCreature(c.monster, c.oldLoc[#c.oldLoc])
        end
    end
end

function onStepOut(cid, item, pos)
    doTransformItem(item.uid, c.tileStepIn)
end

Fiery Death

local lava = {598, 599, 600, 601, 1509, 9883} -- lava tile id, 1509 is walkable
local health = 1 -- percentage of hp to take, .1 is 10%, .2 is 20%, 1 is 100%
function onStepIn(cid, item, pos, fromPos)
    if isInArray(lava, getThingfromPos(pos).itemid) then
        doCreatureAddHealth(cid, -(getCreatureMaxHealth(cid) * health))
    end
end

 

 

Link para o comentário
Compartilhar em outros sites

  • 11 months later...
×
×
  • Criar Novo...