• 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.1 Frozen Starlight portal

Yes i did '!set' then tried using the item, and did nothing. With no errors.
When you say "!set" does it tell you your pos as been set?

If it does make sure you register the action script to your frozen starlight.
 
Code:
function Player.setExhaustion(self, value, time)
    return self:setStorageValue(value, time + os.time())
end

function Player.getExhaustion(self, value)
    local storage = self:getStorageValue(value)
    if storage <= 0 then
        return 0
    end

    return storage - os.time()
end

local groundIds = {
    294, 369, 370, 383, 392, 408, 409, 410, 427, 428, 430, 462, 469, 470, 482,
    484, 485, 489, 924, 3135, 3136, 7933, 7938, 8170, 8286, 8285, 8284, 8281,
    8280, 8279, 8277, 8276, 8567, 8585, 8596, 8595, 8249, 8250, 8251,
    8252, 8253, 8254, 8255, 8256, 8592, 8972, 9606, 9625, 13190, 14461, 19519, 21536
}

local storages = {82001, 82002, 82003}

local function doRemoveTeleport(pos)
    local tp = Tile(pos):getItemById(1387)
    if tp then
        tp:remove()
    end
    return true
end

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey, player)
    local s, player = {}, Player(cid)
    for x = 1, 3 do
        s[#s + 1] = player:getStorageValue(storages[x])
    end

    if player:getExhaustion(1000) > 0 then
        player:say('Your Starlight is still recharging!', TALKTYPE_MONSTER_SAY)
        return true
    end

    if player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT) then
        player:say('You cannot make a Portal whilst in battle!', TALKTYPE_MONSTER_SAY)
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        return true
    end

    player:setExhaustion(1000, 10)

    if s[1] < 0 then
        player:say('You need to set your position!', TALKTYPE_MONSTER_SAY)
        return true
    end

    if toPosition.x == s[1] and toPosition.y == s[2] and toPosition.z == s[3] then
        player:say('You cannot create a portal here.', TALKTYPE_MONSTER_SAY)
        return true
    end

    local tile = Tile(toPosition)
    local ground = tile:getGround()
    if ground and isInArray(groundIds, ground:getId())
            or tile:getItemById(14435)
            or tile:getItemById(1387)
            or tile:hasProperty(CONST_PROP_IMMOVABLEBLOCKSOLID)
            or tile:hasProperty(CONST_PROP_NOFIELDBLOCKPATH) then
        player:say('You cannot make a Portal here..', TALKTYPE_MONSTER_SAY)
        return true
    end

local teleport = Game.createItem(1387, 1, toPosition)
if teleport then
teleport:setActionId(2361)
teleport:setAttribute('description', 'Only ' .. player:getName():lower() .. ' can use this teleport.')
end

    addEvent(doRemoveTeleport, 5 * 1000, toPosition)
    player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_BLUE)
    player:say('Your Frozen Starlight shimmers and creates a portal', TALKTYPE_MONSTER_SAY)
    return true
end
 
hello I noticed that you are online and wanted to ask a few things first of
Im not a scripter :/ but I kind of understand +/- XD i have edited it a lil"

theres an issue when players set pos on depot they can set pos infront of them while a player drops an item
and they can use tp to block players and/or crash server

would there be a way to modify this to not be able to set pos infront of depot boxes( I do understand that for this e have to edit talkaction)

Code:
function Player.setExhaustion(self, value, time)
    return self:setStorageValue(value, time + os.time())
end

function Player.getExhaustion(self, value)
    local storage = self:getStorageValue(value)
    if storage <= 0 then
        return 0
    end

    return storage - os.time()
end

local groundIds = {
    294, 369, 370, 383, 392, 408, 409, 410, 427, 428, 430, 462, 469, 470, 482,
    484, 485, 489, 924, 3135, 3136, 7933, 7938, 8170, 8286, 8285, 8284, 8281,
    8280, 8279, 8277, 8276, 8567, 8585, 8596, 8595, 8249, 8250, 8251,
    8252, 8253, 8254, 8255, 8256, 8592, 8972, 9606, 9625, 13190, 14461, 19519, 21536
}

local storages = {82001, 82002, 82003}

local function doRemoveTeleport(pos)
    local tp = Tile(pos):getItemById(1387)
    if tp then
        tp:remove()
    end
    return true
end

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey, player)
    local s, player = {}, Player(cid)
    for x = 1, 3 do
        s[#s + 1] = player:getStorageValue(storages[x])
    end

    if player:getExhaustion(36000) > 0 then
        player:say('Your Starlight is still recharging!', TALKTYPE_MONSTER_SAY)
        return true
    end

    if player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT) then
        player:say('You cannot make a Portal whilst in battle!', TALKTYPE_MONSTER_SAY)
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        return true
    end

    player:setExhaustion(1000, 10)

    if s[1] < 0 then
        player:say('You need to set your position!', TALKTYPE_MONSTER_SAY)
        return true
    end

    if toPosition.x == s[1] and toPosition.y == s[2] and toPosition.z == s[3] then
        player:say('You cannot create a portal here.', TALKTYPE_MONSTER_SAY)
        return true
    end

    local tile = Tile(toPosition)
    local ground = tile:getGround()
    if ground and isInArray(groundIds, ground:getId())
            or tile:getItemById(11062)
            or tile:getItemById(424)
            or tile:getItemById(14435)
            or tile:getItemById(424)
            or tile:getItemById(1387)
            or tile:hasProperty(CONST_PROP_IMMOVABLEBLOCKSOLID)
            or tile:hasProperty(CONST_PROP_NOFIELDBLOCKPATH) then
        player:say('You cannot make a Portal here..', TALKTYPE_MONSTER_SAY)
        return true
    end

local teleport = Game.createItem(1387, 1, toPosition)
if teleport then
teleport:setActionId(2361)
teleport:setAttribute('description', 'Only ' .. player:getName():lower() .. ' can use this teleport.')
end

    addEvent(doRemoveTeleport, 10 * 100, toPosition)
    player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_BLUE)
    player:say('Your Frozen Starlight shimmers and creates a portal', TALKTYPE_MONSTER_SAY)
    return true
end
 
Last edited:
hello I noticed that you are online and wanted to ask a few things first of
Im not a scripter :/ but I kind of understand +/- XD i have edited it a lil"

theres an issue when players set pos on depot they can set pos infront of them while a player drops an item
and they can use tp to block players and/or crash server

would there be a way to modify this to not be able to set pos infront of depot boxes( I do understand that for this e have to edit talkaction)

Code:
function Player.setExhaustion(self, value, time)
    return self:setStorageValue(value, time + os.time())
end

function Player.getExhaustion(self, value)
    local storage = self:getStorageValue(value)
    if storage <= 0 then
        return 0
    end

    return storage - os.time()
end

local groundIds = {
    294, 369, 370, 383, 392, 408, 409, 410, 427, 428, 430, 462, 469, 470, 482,
    484, 485, 489, 924, 3135, 3136, 7933, 7938, 8170, 8286, 8285, 8284, 8281,
    8280, 8279, 8277, 8276, 8567, 8585, 8596, 8595, 8249, 8250, 8251,
    8252, 8253, 8254, 8255, 8256, 8592, 8972, 9606, 9625, 13190, 14461, 19519, 21536
}

local storages = {82001, 82002, 82003}

local function doRemoveTeleport(pos)
    local tp = Tile(pos):getItemById(1387)
    if tp then
        tp:remove()
    end
    return true
end

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey, player)
    local s, player = {}, Player(cid)
    for x = 1, 3 do
        s[#s + 1] = player:getStorageValue(storages[x])
    end

    if player:getExhaustion(36000) > 0 then
        player:say('Your Starlight is still recharging!', TALKTYPE_MONSTER_SAY)
        return true
    end

    if player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT) then
        player:say('You cannot make a Portal whilst in battle!', TALKTYPE_MONSTER_SAY)
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        return true
    end

    player:setExhaustion(1000, 10)

    if s[1] < 0 then
        player:say('You need to set your position!', TALKTYPE_MONSTER_SAY)
        return true
    end

    if toPosition.x == s[1] and toPosition.y == s[2] and toPosition.z == s[3] then
        player:say('You cannot create a portal here.', TALKTYPE_MONSTER_SAY)
        return true
    end

    local tile = Tile(toPosition)
    local ground = tile:getGround()
    if ground and isInArray(groundIds, ground:getId())
            or tile:getItemById(11062)
            or tile:getItemById(424)
            or tile:getItemById(14435)
            or tile:getItemById(424)
            or tile:getItemById(1387)
            or tile:hasProperty(CONST_PROP_IMMOVABLEBLOCKSOLID)
            or tile:hasProperty(CONST_PROP_NOFIELDBLOCKPATH) then
        player:say('You cannot make a Portal here..', TALKTYPE_MONSTER_SAY)
        return true
    end

local teleport = Game.createItem(1387, 1, toPosition)
if teleport then
teleport:setActionId(2361)
teleport:setAttribute('description', 'Only ' .. player:getName():lower() .. ' can use this teleport.')
end

    addEvent(doRemoveTeleport, 10 * 100, toPosition)
    player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_BLUE)
    player:say('Your Frozen Starlight shimmers and creates a portal', TALKTYPE_MONSTER_SAY)
    return true
end

just add the depot tile id to the list of disallowed IDS.
 
I got that part but if you go to depot box and say !set you save that pos
Code:
local storages = {82001, 82002, 82003}

local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

function onSay(cid, words, param)
     local player = Player(cid)
     local pos = player:getPosition()
     local p = {pos.x, pos.y, pos.z}
     for x = 1, 3 do
         player:setStorageValue(storages[x], p[x])
     end
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Position set!")
     player:say('Your position has been set!', TALKTYPE_MONSTER_SAY)
     player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
     return false
end
 
I got that part but if you go to depot box and say !set you save that pos
jsut add a check in the talkaction

Code:
if playerGetPosTile == depottile then
    return true
end
 
I tryed something like this but dont seem to work
Code:
local storages = {82001, 82002, 82003}

function onSay(cid, words, param)
  local ground = tile:getGround()
   if ground tile:getItemById(11062)
  player:say('You cannot set Position here..', TALKTYPE_MONSTER_SAY)
  return true
  end
   local player = Player(cid)
  local pos = player:getPosition()
  local p = {pos.x, pos.y, pos.z}
  for x = 1, 3 do
  player:setStorageValue(storages[x], p[x])
  end
  player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Position set!")
  player:say('Your position has been set!', TALKTYPE_MONSTER_SAY)
  player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
  return false
end
 
Back
Top