• 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!

[TFS 1.4] Advanced tile requeriment for exclusive zones

beenii

Well-Known Member
Joined
Jul 26, 2010
Messages
580
Solutions
1
Reaction score
57
Hello, I took the liberty of making a system to give access to exclusive areas.
It is very easy to configure, if you have any idea to improve it, comment it

Features
  1. minimum level to enter
  2. maximum level to enter
  3. you can combine minimun and max level to tile
  4. Storage (if you want give access with quest) (can combine with min and max level)
  5. customize text, zone name and required quest name
  6. teleport if you want the tile tp you to another position


data/lib/lib.lua
Lua:
dofile('data/lib/tileRequeriments.lua')


data/lib/tileRequeriments.lua
Lua:
tileRequerimentsConfig = {
    ---------------------------------------------------------
   -- Tile Requeriment example 1
   ---------------------------------------------------------
   [36000] = {
       minLevel = 250, -- level req to enter
       maxLevel = 300, -- set 0 to disable (set level max to enter)
       storageReq = 0, -- set 0 to disable (if player need storage to enter)
       storageName = "", -- if you want show quest need to enter (example: you need >demon quest< to join this area)
       zoneName = "this area", -- name of your zone or use default
       teleport = Position(32346, 32222, 7) -- if you want teleport player put 0 to disable
    
       },
     ---------------------------------------------------------
   -- Example Tiles
   ---------------------------------------------------------
   [36001] = {
       minLevel = 500, -- level req to enter
       maxLevel = 0, -- set 0 to disable (set level max to enter)
       storageReq = 36001, -- set 0 to disable (if player need storage to enter)
       storageName = "Quest Retro", -- if you want show quest need to enter (example: you need >demon quest< to join this area)
       zoneName = "this area", -- name of your zone or use default
       teleport = Position(0, 0, 0) -- if you want teleport player put 0 to disable
       },

    [36002] = {
       minLevel = 50, -- level req to enter
       maxLevel = 0, -- set 0 to disable (set level max to enter)
       storageReq = 0, -- set 0 to disable (if player need storage to enter)
       storageName = "", -- if you want show quest need to enter (example: you need >demon quest< to join this area)
       zoneName = "this area", -- name of your zone or use default
       teleport = Position(0, 0, 0) -- if you want teleport player put 0 to disable
       }
 
 
}

data/scripts/tileRequeriments.lua
Lua:
local tileRequeriments = MoveEvent()

function tileRequeriments.onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return true
    end
  

   local tileRequeriment = item.actionid
   local tileReq = tileRequerimentsConfig[tileRequeriment]

 
   -----------------------------------------------------------------------------------
   -- Check if player need storage --
   -----------------------------------------------------------------------------------
 
   if  tileReq.storageReq > 1 and player:getStorageValue(tileReq.storageReq) < 1 then
       player:teleportTo(fromPosition)
       player:getPosition():sendMagicEffect(CONST_ME_POFF)
       player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need "..tileReq.storageName.." to join "..tileReq.zoneName..".")
       return true
   end   

   -----------------------------------------------------------------------------------
   -- Check if player Max Level --
   -----------------------------------------------------------------------------------
    if  tileReq.maxLevel > 1 and player:getLevel() > tileReq.maxLevel then 
        player:teleportTo(fromPosition)
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Only players below of level "..tileReq.maxLevel.." to join "..tileReq.zoneName..".")
       return true
   end   
  
   -----------------------------------------------------------------------------------
   -- Check if player Min Level --
   ----------------------------------------------------------------------------------- 
    if  player:getLevel() < tileReq.minLevel then 
        player:teleportTo(fromPosition)
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need level "..tileReq.minLevel.." to join "..tileReq.zoneName..".")
       return true
   end   
   -----------------------------------------------------------------------------------
   -- Check if player Teleport --
   ----------------------------------------------------------------------------------- 
    if  tileReq.teleport.x > 0 then
        player:teleportTo(tileReq.teleport)
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    end

player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Welcome to "..tileReq.zoneName..".")
        return true
end



tileRequeriments:type("stepin")
for i = 36000, 36100 do
tileRequeriments:aid(i)
end
tileRequeriments:register()
 
Last edited:
Fine! It would be nice to add restrictions on vocation. distinction boy girl. and VIP status. 😁😁😀
 
Above the scripts he lists directories. Put the scripts in the directories of your data folder and they will function.
 
Fine! It would be nice to add restrictions on vocation. distinction boy girl. and VIP status. 😁😁😀

Lua:
tileRequerimentsConfig = {
    ---------------------------------------------------------
   -- Tile Requeriment example 1
   ---------------------------------------------------------
   [36000] = {
       vocReq = 3, -- if want to disable then remove this line
       vocReqName = "Druid", -- if you want show name of vocation required ex. Druid.
       sexReq = 2, -- 1 = male, 2 = female, if want to disable then remove this line
       sexReqName = "male", -- write what should be shown as required sex, can be anything written here.
       minLevel = 250, -- level req to enter
       maxLevel = 300, -- set 0 to disable (set level max to enter)
       storageReq = 0, -- set 0 to disable (if player need storage to enter)
       storageName = "", -- if you want show quest need to enter (example: you need >demon quest< to join this area)
       zoneName = "this area", -- name of your zone or use default
       canTeleport = 1, -- enabled, if want to disable just remove this line
       teleport = Position(114, 106, 7) -- if you want teleport player put 0 to disable
 
       },
     ---------------------------------------------------------
   -- Example Tiles
   ---------------------------------------------------------
   [36001] = {
       minLevel = 500, -- level req to enter
       maxLevel = 0, -- set 0 to disable (set level max to enter)
       storageReq = 36001, -- set 0 to disable (if player need storage to enter)
       storageName = "Quest Retro", -- if you want show quest need to enter (example: you need >demon quest< to join this area)
       zoneName = "this area", -- name of your zone or use default
       teleport = Position(114, 106, 7) -- if you want teleport player put 0 to disable
       },

    [36002] = {
       sexReq = 2, -- 1 = male, 2 = female, 0 = both male and female can enter
       sexReqName = "female", -- write what should be shown as required sex, can be anything written here.
       minLevel = 50, -- level req to enter
       maxLevel = 0, -- set 0 to disable (set level max to enter)
       storageReq = 0, -- set 0 to disable (if player need storage to enter)
       storageName = "", -- if you want show quest need to enter (example: you need >demon quest< to join this area)
       zoneName = "this area", -- name of your zone or use default
       teleport = Position(114, 106, 7) -- if you want teleport player put 0 to disable
       }
 
 
}

local tileRequeriments = MoveEvent()

function tileRequeriments.onStepIn(creature, item, position, fromPosition)
local player = creature:getPlayer()
if not player then
return true
end


local tileRequeriment = item.actionid
local tileReq = tileRequerimentsConfig[tileRequeriment]


-----------------------------------------------------------------------------------
-- Check if player need storage --
-----------------------------------------------------------------------------------

if tileReq.storageReq > 1 and player:getStorageValue(tileReq.storageReq) < 1 then
player:teleportTo(fromPosition)
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need "..tileReq.storageName.." to join "..tileReq.zoneName..".")
return true
end

-----------------------------------------------------------------------------------
-- Check if player Max Level --
-----------------------------------------------------------------------------------
if tileReq.maxLevel > 1 and player:getLevel() > tileReq.maxLevel then
player:teleportTo(fromPosition)
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Only players below of level "..tileReq.maxLevel.." to join "..tileReq.zoneName..".")
return true
end

-----------------------------------------------------------------------------------
-- Check if player Min Level --
-----------------------------------------------------------------------------------
if player:getLevel() < tileReq.minLevel then
player:teleportTo(fromPosition)
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need level "..tileReq.minLevel.." to join "..tileReq.zoneName..".")
return true
end

-----------------------------------------------------------------------------------
-- Check if player has required vocation --
-----------------------------------------------------------------------------------
if tileReq.vocReq ~= nil then -- tileReq.vocReq ~= 0 or
if tileReq.vocReq ~= player:getVocation() then
player:teleportTo(fromPosition)
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to be "..tileReq.vocReqName.." to join "..tileReq.zoneName..".")
return true
end
end
-----------------------------------------------------------------------------------
-- Check if player has sex (he doesn't) --
-----------------------------------------------------------------------------------

if tileReq.sexReq ~= nil then
if player:getSex() ~= tileReq.sexReq then
player:teleportTo(fromPosition)
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to be "..tileReq.sexReqName.." to join "..tileReq.zoneName..".")
return true
end
end

-----------------------------------------------------------------------------------
-- Check if player Teleport --
-----------------------------------------------------------------------------------
if tileReq.canTeleport ~= nil then
player:teleportTo(tileReq.teleport)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
end

player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Welcome to "..tileReq.zoneName..".")
return true
end



tileRequeriments:type("stepin")
for i = 36000, 36100 do
tileRequeriments:aid(i)
end
tileRequeriments:register()

Thats a nice script beenii, thanks for uploading this!
I updated it with checks for male/female and vocation.
Also, there was an error about indexing teleport because of "if teleport.x > 0" or smth like that. I just switched it to canTeleport = 1.

edit: spoiler removed my TABS btw from data/scripts/tilereq... ? idk, can send some other way the version with tabs if someone wants.
Btw from the main post is still needed change from lib.lua. And everything will work...
 
Last edited:
Is it possible to add an exhaus upon entering the tile? So ppl dont spam it back n forth
 
Last edited:
Back
Top