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

House teleport scroll?

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
921
Location
Chile
Hello guys, does anyone have a house teleport scroll for tfs 1.3??
like the player uses the scroll, it disapears and he gets teleported to his front door of his house, wich some magic spell? :D
 
Solution
Hi @Thorn look i maked this:
Code:
local useInProtectionZone = false
local useWithoutPzLocked = false
local useWithoutConditionFight = false
local successMessage = 'You have teleported to your house.'

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local okayTeleport = successMessage
    if useInProtectionZone and not Tile.hasFlag(Creature.getTile(player), TILESTATE_PROTECTIONZONE) then
        okayTeleport = 'Sorry, this parchment used in protection zone only.'
    end
    if useWithoutPzLocked and Player.isPzLocked(player) then
        okayTeleport = 'Sorry, this parchment used without PZ.'
    end
    if useWithoutConditionFight and Creature.getCondition(player, CONDITION_INFIGHT...
Hi @Thorn look i maked this:
Code:
local useInProtectionZone = false
local useWithoutPzLocked = false
local useWithoutConditionFight = false
local successMessage = 'You have teleported to your house.'

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local okayTeleport = successMessage
    if useInProtectionZone and not Tile.hasFlag(Creature.getTile(player), TILESTATE_PROTECTIONZONE) then
        okayTeleport = 'Sorry, this parchment used in protection zone only.'
    end
    if useWithoutPzLocked and Player.isPzLocked(player) then
        okayTeleport = 'Sorry, this parchment used without PZ.'
    end
    if useWithoutConditionFight and Creature.getCondition(player, CONDITION_INFIGHT, CONDITIONID_DEFAULT) then
        okayTeleport = 'Sorry, this parchment used without fight condition.'
    end
    if okayTeleport == successMessage then
        if Player.getHouse(player) then
            local doorPosition = House.getExitPosition(Player.getHouse(player))
            Position.sendMagicEffect(Creature.getPosition(player), CONST_ME_POFF)
            Creature.teleportTo(player, doorPosition, false)
            Position.sendMagicEffect(doorPosition, CONST_ME_TELEPORT)
            Item.remove(item, 1)
            Player.sendTextMessage(player, MESSAGE_STATUS_CONSOLE_BLUE, okayTeleport)
        else
            okayTeleport = 'You not have a house.'
            Player.sendCancelMessage(player, okayTeleport)
            Position.sendMagicEffect(Creature.getPosition(player), CONST_ME_POFF)
        end
    else
        Player.sendCancelMessage(player, okayTeleport)
        Position.sendMagicEffect(Creature.getPosition(player), CONST_ME_POFF)
    end
    return true
end

I hope you like it.
 
Solution
Hi @Thorn look i maked this:
Code:
local useInProtectionZone = false
local useWithoutPzLocked = false
local useWithoutConditionFight = false
local successMessage = 'You have teleported to your house.'

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local okayTeleport = successMessage
    if useInProtectionZone and not Tile.hasFlag(Creature.getTile(player), TILESTATE_PROTECTIONZONE) then
        okayTeleport = 'Sorry, this parchment used in protection zone only.'
    end
    if useWithoutPzLocked and Player.isPzLocked(player) then
        okayTeleport = 'Sorry, this parchment used without PZ.'
    end
    if useWithoutConditionFight and Creature.getCondition(player, CONDITION_INFIGHT, CONDITIONID_DEFAULT) then
        okayTeleport = 'Sorry, this parchment used without fight condition.'
    end
    if okayTeleport == successMessage then
        if Player.getHouse(player) then
            local doorPosition = House.getExitPosition(Player.getHouse(player))
            Position.sendMagicEffect(Creature.getPosition(player), CONST_ME_POFF)
            Creature.teleportTo(player, doorPosition, false)
            Position.sendMagicEffect(doorPosition, CONST_ME_TELEPORT)
            Item.remove(item, 1)
            Player.sendTextMessage(player, MESSAGE_STATUS_CONSOLE_BLUE, okayTeleport)
        else
            okayTeleport = 'You not have a house.'
            Player.sendCancelMessage(player, okayTeleport)
            Position.sendMagicEffect(Creature.getPosition(player), CONST_ME_POFF)
        end
    else
        Player.sendCancelMessage(player, okayTeleport)
        Position.sendMagicEffect(Creature.getPosition(player), CONST_ME_POFF)
    end
    return true
end

I hope you like it.
wow man that's awesome!! thanks for taking time to help me! :D
 
Hi @Thorn look i maked this:
Code:
local useInProtectionZone = false
local useWithoutPzLocked = false
local useWithoutConditionFight = false
local successMessage = 'You have teleported to your house.'

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local okayTeleport = successMessage
    if useInProtectionZone and not Tile.hasFlag(Creature.getTile(player), TILESTATE_PROTECTIONZONE) then
        okayTeleport = 'Sorry, this parchment used in protection zone only.'
    end
    if useWithoutPzLocked and Player.isPzLocked(player) then
        okayTeleport = 'Sorry, this parchment used without PZ.'
    end
    if useWithoutConditionFight and Creature.getCondition(player, CONDITION_INFIGHT, CONDITIONID_DEFAULT) then
        okayTeleport = 'Sorry, this parchment used without fight condition.'
    end
    if okayTeleport == successMessage then
        if Player.getHouse(player) then
            local doorPosition = House.getExitPosition(Player.getHouse(player))
            Position.sendMagicEffect(Creature.getPosition(player), CONST_ME_POFF)
            Creature.teleportTo(player, doorPosition, false)
            Position.sendMagicEffect(doorPosition, CONST_ME_TELEPORT)
            Item.remove(item, 1)
            Player.sendTextMessage(player, MESSAGE_STATUS_CONSOLE_BLUE, okayTeleport)
        else
            okayTeleport = 'You not have a house.'
            Player.sendCancelMessage(player, okayTeleport)
            Position.sendMagicEffect(Creature.getPosition(player), CONST_ME_POFF)
        end
    else
        Player.sendCancelMessage(player, okayTeleport)
        Position.sendMagicEffect(Creature.getPosition(player), CONST_ME_POFF)
    end
    return true
end

I hope you like it.
i can use it anytime, even when im not in pz or attacking.. what should i change?
 
i can use it anytime, even when im not in pz or attacking.. what should i change?
Not sure which version of ots you are using, but this works for me in forgotten 1.3. I used the script that @Sarah Wesker but modified some lines to fit in my ots. I hope it helps!

Lua:
local homeScroll = Action()

function homeScroll.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local cooldown = 166001 --Cooldown storage value
    local cooldownTime = 3 -- cd in seconds
   
    if player:getStorageValue(cooldown) > os.time() then --Timed Cooldown
    local remainingTime = player:getStorageValue(cooldown) - os.time()
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Cooldown: '..player:getStorageValue(cooldown) - os.time()..' seconds.')
    return true
    end  
   
    if getTileInfo(player:getPosition()).nologout then --Using in a nologout zone
        player:sendCancelMessage("You can't use this when you are inside a boss room.")
        player:getPosition():sendMagicEffect(3)
        return true
    end
   
    if not player:isPremium() then --check if player has premium time
        player:sendCancelMessage("You need active premium time to use this item.")
        Position.sendMagicEffect(Creature.getPosition(player), CONST_ME_POFF)
        return true
    end  
    if not player:isPzLocked() and not player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT) then --check if player is not in combat
            if Player.getHouse(player) then -- check if player has house
            local doorPosition = House.getExitPosition(Player.getHouse(player))
            Position.sendMagicEffect(Creature.getPosition(player), CONST_ME_POFF)
            Creature.teleportTo(player, doorPosition, false)
            Position.sendMagicEffect(doorPosition, CONST_ME_TELEPORT)
            player:setStorageValue(cooldown, os.time() + cooldownTime)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have been teleported to your house. This item will be in cooldown for '..cooldownTime..' seconds.')
        else
            player:sendCancelMessage("You do not have a house.")
            Position.sendMagicEffect(Creature.getPosition(player), CONST_ME_POFF)
        end
    else
        player:sendCancelMessage("You can't use this shortly after being in combat.")
        Position.sendMagicEffect(Creature.getPosition(player), CONST_ME_POFF)      
    end
    return true
end
homeScroll:id(22182) --I am using teleportation rod from ferumbras ascendant change if you need another item
homeScroll:register()
 
Back
Top