• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

TFS 0.X Dugeon System

zabuzo

Well-Known Member
Joined
Jun 10, 2016
Messages
238
Reaction score
54
I want to make a full server based in dugeons but idk how to do, so i need some help

I made this scripts by searching and coppy from others scripts, i need 5 things that i asked in comments -- how to
So just ctrl+f in scripts "-- how to" in scripts

Even help with 1 would help a lot

dungeon_lever.lua
Code:
-- positions and where go
local p = {
    [1] = {
        player = {
            position = {x = 952, y = 1039, z = 7},
            toPos = {x = 953, y = 1047, z = 6}
        }
    },
    [2] = {
        player = {
            position = {x = 953, y = 1039, z = 7},
            toPos = {x = 954, y = 1047, z = 6}
        }
    },
    [3] = {
        player = {
            position = {x = 954, y = 1039, z = 7},
            toPos = {x = 955, y = 1047, z = 6}
        }
    },
    [4] = {
        player = {
            position = {x = 955, y = 1039, z = 7},
            toPos = {x = 956, y = 1047, z = 6}
        }
    }
}

-- min lvl
local minLevel = 10
local maxLevel = 20

-- get a vocation's base vocation
function getBaseVocation(vocation)
    if vocation >= 5 and vocation <= 8 then
        return vocation - 4
    elseif vocation >= 9 and vocation <= 12 then
        return vocation - 8
    end
    return vocation
end

-- after enter have 15 min to do a quest, if dont teleport to 956/1039/7


function onUse(cid)
    -- 1 how to: if there is a team doing players cant go in
    -- 2 how to: only accept different IPs
    local questPlayers = {}
    for i = 1, #p do
        local pid = getTopCreature(p[i].player.position).uid
        if isPlayer(pid) then
            if getPlayerLevel(pid) >= minLevel and getPlayerLevel(pid) <= maxLevel then
                if getBaseVocation( getPlayerVocation(pid) ) == i then
                    -- 3 how to: remove tile per vocation, only accept if have 4 vocation, but dosent matter the position
                else
                    doPlayerSendCancel(cid, "A vocation is on the wrong spot.")
                    return false
                end
            else
                doPlayerSendCancel(cid, getCreatureName(pid) .. ", is not high enough in level, the level to enter have to be between " .. minLevel .. "~ " .. maxLevel .. ". ")
                return false
            end
        else
            doPlayerSendCancel(cid, "A player is missing.")
            return false
        end
    end
    for x = 1, #questPlayers do
        -- 4 how to: after go in have a exausted of 24 hours to go again
        doPlayerSendTextMessage(questPlayers[x], MESSAGE_INFO_DESCR, "Good luck!")
        doTeleportThing(questPlayers[x], p[x].player.toPos)
    end
    return true
end


dungeon_chest.lua
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    -- STORAGE
    local storage = 9603
    -- 5 how to: check if player is in a dugeon (to avoid abuses)
    -- ITEMS
    local itemid = 2525
    if getPlayerFreeCap(cid) >= getItemWeightById(itemid, 1) then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a '..getItemNameById(itemid)..'. It weighs '..getItemWeightById(itemid, 1)..'.00 and it is too heavy.')
        return false
    end
    doPlayerAddItem(cid, itemid, 1)
    -- teleport to exit
    local exit_pos = {x= 956, y=1039, z=7}
    doTeleportThing(cid, exit_pos)
    doSendMagicEffect(getPlayerPosition(cid), 10)
    return true
end

Code:
    <action actionid="9602" script="dungeon_lever.lua"/>
    <action actionid="9603" script="dungeon_chest.lua"/>
 
Last edited:
My questions are in the code
-- 1 how to: if there is a team doing players cant go in
-- 2 how to: only accept different IPs
-- after enter have 15 min to do a quest, if dont teleport to 956/1039/7
-- 4 how to: after go in have a exausted of 24 hours to go again
-- 5 how to: check if player is in a dugeon (to avoid abuses)
 
Back
Top