• 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.3] [Revscriptsys] Free Lua scripting service - Post your requests! Let's learn it together!

Lua:
monster.events = {
    "nameofevent1",
    "nameofevent2"
}
this will register the event to the monster or use MonsterType("name"):registerEvent("eventName")
I'd rather not try to include the event itself into the monster file as the loading order of script systems might be a problem, you can however try to confirm that aswell if you want to.

thanks, I just used a onKill event attached to the player so I didn't need to change monster file and it worked, thanks again
 
Not much of a request for a specific script but is there a quick and easy way to learn how to create dynamic spells with revscripts?

Example: A spell that deals damage around the player that casts it for 20 seconds in .5 second intervals.

Example 2: A spell that places a buff on you that heals you for 50% of your damage.

Example 3: A spell that converts all your basic attack damage into another random element each second for 10 seconds.
 
I'd like to request this script to be converted into revscriptsys and made a PR so we can close one more issue one tfs :p (is there a way to make toggle-able in config.lua? I'm open to ideas 😁
 
hello id like to request SCRIPT! i don't have idea if its work on 1.3 tho but it would cool to have it on revscriptsys :p
 
[TFS 1.2] Teleport Scroll by @Stigma

Converted to Revscriptsys, 3 XML file changes and 3 file additions into 1 file:

Teleports player to default town position, creates a teleport near the player (that only the player can see).
The player has 30 seconds to enter the teleport to get back to their previous position.
Also added a 30 seconds cooldown, and tons of comments to explain the code.

Lua:
-- TP Scroll by Stigma: https://otland.net/threads/tfs-1-2-teleport-scroll.245184/
-- Converted to TFS 1.3 Revscriptsys by Znote.

-- Part 1 = Action (scroll item)
-- Part 2 = Movement (step in teleport positions)
-- Part 3 = Creaturescript (disable/cleanup if the player decides to log out while system is active)


------------------------------------
-- Begin code of Part 1 = Action: --
tpScroll = Action() -- Create a new action that we call "tpScroll"
tpScroll:id(1953) -- Item id of the scroll we want to attach this action to.

-- Create an internal storage object to keep track of positions
local savePos = {}

-- Supplementary function to this particular action.
-- (apply and re-apply effect as a pulse while the effect position is stored in internal object)
local function sendEffects(position, effect, pid)
    if savePos[pid] then
        if savePos[pid].Enabled then
            local player = Player(pid)
            if isPlayer(player) then
                position:sendMagicEffect(effect, player)
                addEvent(sendEffects, 400, position, effect, pid, CS)
            end
        end
    end
end

-- Attach an "onUse" functionality to this tpScroll action.
-- When you use the id associated to the action, this function will trigger.
function tpScroll.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    -- Store player id, we will use this as a logical reference in our internal storage
    -- and to re-create the player object in our SendEffects function
    local pid = player:getId()

    -- Don't allow players to use this scroll if they have engaged aggressively in PvP
    if not player:isPzLocked() then

        -- If player (pid) is not added to internal storage yet
        -- Add it to internal storage and execute this action
        if not savePos[pid] then
            -- Save the players position in his own internal storage (pid)
            savePos[pid] = {
                ScrollActivatedPosition = player:getPosition(),
                RandomTemplePosition = nil, -- We will save this a bit further down
                Enabled = true,
                Cooldown = os.time() + 31
            }

            -- Teleport player to his temple
            player:teleportTo(player:getTown():getTemplePosition())
        
            -- Get and store the position of the temple
            local pos = player:getPosition()

            -- Calculate a close nearby random position to this temple and save it
            savePos[pid].RandomTemplePosition = Position(pos.x+math.random(3), pos.y+math.random(2), pos.z)

            -- Execute the function that creates a pulse effect while this action is running
            -- On both positions, but with different effect type. (12 and 35)
            sendEffects(savePos[pid].RandomTemplePosition, 12, pid)
            sendEffects(savePos[pid].ScrollActivatedPosition, 35, pid)

            -- Find the ground item at the random temple position, and give it an action Id
            -- (For the movement script/PART 2)
            local item = Item(Tile(savePos[pid].RandomTemplePosition):getGround().uid)
            item:setActionId(3006)

            -- Also, execute a function in 30 seconds that will remove this added action id.
            addEvent(
                function()
                    if item:getActionId(3006) then
                        item:removeAttribute('aid')
                        savePos[pid] = nil
                    end
                end
            ,30 * 1000) -- 30 * 1000 ms = 30 seconds until this internal function executes.

        else -- This action is already executed, the teleport is already spawned.
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
            -- If the system is still enabled, they havent entered the teleport yet
            if savePos[pid].Enabled then
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'You must enter your teleport first before you use this again. The teleport will exist for ' .. savePos[pid].Cooldown - os.time() .. ' more seconds.')
            else -- They have entered the teleport, but there is a lingering addevent we have to wait for to complete before they can use it again
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Remaining cooldown: ' .. savePos[pid].Cooldown - os.time() .. ' seconds.')
            end
        end
    else -- If the player IS pz locked. (has attacked another player)
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'You may not use this while you are in battle.')
    end
    return true
end

-- Register/enable this action!
tpScroll:register()


--------------------------------------
-- Begin code of Part 2 = Movement: --
randomTemplePosition = MoveEvent()

-- In step 1 we added action id 3006 on this tile. Now lets register the "functionality" of it.
randomTemplePosition:aid(3006)

-- When you step on this actionid, the MoveEvent executes.
function randomTemplePosition.onStepIn(creature, item, position, fromPosition)
    -- Load the player id that moved on this randomTemplePosition, using that, find the relevant internal storage for him
    local pid = creature:getId()
    local pos = savePos[pid]

    -- If we found this players positions in the internal storage, proceed
    if pos and pos.RandomTemplePosition then

        -- Teleport him back to the position where he activated the tp scroll
        creature:teleportTo(pos.ScrollActivatedPosition)

        -- Send the stun effect on both positions (random temple + scroll)
        pos.ScrollActivatedPosition:sendMagicEffect(CONST_ME_STUN)
        pos.RandomTemplePosition:sendMagicEffect(CONST_ME_STUN)

        -- Remove the added action id. (Which will stop this event from happening until next time)
        item:removeAttribute('aid')

        -- Remove the player from the internal storage, so the pulse effects in step 1 stop pulsing.
        savePos[pid].Enabled = false
    end
    return true
end

-- Register/activate this onstepin effect.
randomTemplePosition:register()

----------------------------------------------------------------------------------------------
---------------------------- Begin code of Part 3 = Movement: --------------------------------
-- Creaturescript (disable/cleanup if the player decides to log out while system is active) --
local tpscroll_player = CreatureEvent("tpscroll_player")

-- onLogin and onLogout CreatureEvent function declarations should automatically be registered to every player
function tpscroll_player.onLogout(player)
    local pid = player:getId()
    -- If we have any internal storage on this player, remove it. Also remove the actionid on the floor
    if savePos[pid] then
        Item(Tile(savePos[pid].RandomTemplePosition):getGround().uid):removeAttribute('aid')
        savePos[pid].Enabled = false
    end
    return true
end

-- Enable/activate this Creature Event
tpscroll_player:register()

hi @Znote, what im doing wrong with this?
error tp scroll.png

and also, where i should install this one?
Lua:
local foods = {
    [2362] = {5, "Crunch."}, -- carrot
    [2666] = {15, "Munch."}, -- meat
    [2667] = {12, "Munch."}, -- fish
    [2668] = {10, "Mmmm."}, -- salmon
    [2669] = {17, "Munch."}, -- northern pike
    [2670] = {4, "Gulp."}, -- shrimp
    [2671] = {30, "Chomp."}, -- ham
    [2672] = {60, "Chomp."}, -- dragon ham
    [2673] = {5, "Yum."}, -- pear
    [2674] = {6, "Yum."}, -- red apple
    [2675] = {13, "Yum."}, -- orange
    [2676] = {8, "Yum."}, -- banana
    [2677] = {1, "Yum."}, -- blueberry
    [2678] = {18, "Slurp."}, -- coconut
    [2679] = {1, "Yum."}, -- cherry
    [2680] = {2, "Yum."}, -- strawberry
    [2681] = {9, "Yum."}, -- grapes
    [2682] = {20, "Yum."}, -- melon
    [2683] = {17, "Munch."}, -- pumpkin
    [2684] = {5, "Crunch."}, -- carrot
    [2685] = {6, "Munch."}, -- tomato
    [2686] = {9, "Crunch."}, -- corncob
    [2687] = {2, "Crunch."}, -- cookie
    [2688] = {2, "Munch."}, -- candy cane
    [2689] = {10, "Crunch."}, -- bread
    [2690] = {3, "Crunch."}, -- roll
    [2691] = {8, "Crunch."}, -- brown bread
    [2695] = {6, "Gulp."}, -- egg
    [2696] = {9, "Smack."}, -- cheese
    [2787] = {9, "Munch."}, -- white mushroom
    [2788] = {4, "Munch."}, -- red mushroom
    [2789] = {22, "Munch."}, -- brown mushroom
    [2790] = {30, "Munch."}, -- orange mushroom
    [2791] = {9, "Munch."}, -- wood mushroom
    [2792] = {6, "Munch."}, -- dark mushroom
    [2793] = {12, "Munch."}, -- some mushrooms
    [2794] = {3, "Munch."}, -- some mushrooms
    [2795] = {36, "Munch."}, -- fire mushroom
    [2796] = {5, "Munch."}, -- green mushroom
    [5097] = {4, "Yum."}, -- mango
    [6125] = {8, "Gulp."}, -- tortoise egg
    [6278] = {10, "Mmmm."}, -- cake
    [6279] = {15, "Mmmm."}, -- decorated cake
    [6393] = {12, "Mmmm."}, -- valentine's cake
    [6394] = {15, "Mmmm."}, -- cream cake
    [6501] = {20, "Mmmm."}, -- gingerbread man
    [6541] = {6, "Gulp."}, -- coloured egg (yellow)
    [6542] = {6, "Gulp."}, -- coloured egg (red)
    [6543] = {6, "Gulp."}, -- coloured egg (blue)
    [6544] = {6, "Gulp."}, -- coloured egg (green)
    [6545] = {6, "Gulp."}, -- coloured egg (purple)
    [6569] = {1, "Mmmm."}, -- candy
    [6574] = {5, "Mmmm."}, -- bar of chocolate
    [7158] = {15, "Munch."}, -- rainbow trout
    [7159] = {13, "Munch."}, -- green perch
    [7372] = {2, "Yum."}, -- ice cream cone (crispy chocolate chips)
    [7373] = {2, "Yum."}, -- ice cream cone (velvet vanilla)
    [7374] = {2, "Yum."}, -- ice cream cone (sweet strawberry)
    [7375] = {2, "Yum."}, -- ice cream cone (chilly cherry)
    [7376] = {2, "Yum."}, -- ice cream cone (mellow melon)
    [7377] = {2, "Yum."}, -- ice cream cone (blue-barian)
    [7909] = {4, "Crunch."}, -- walnut
    [7910] = {4, "Crunch."}, -- peanut
    [7963] = {60, "Munch."}, -- marlin
    [8112] = {9, "Urgh."}, -- scarab cheese
    [8838] = {10, "Gulp."}, -- potato
    [8839] = {5, "Yum."}, -- plum
    [8840] = {1, "Yum."}, -- raspberry
    [8841] = {1, "Urgh."}, -- lemon
    [8842] = {7, "Munch."}, -- cucumber
    [8843] = {5, "Crunch."}, -- onion
    [8844] = {1, "Gulp."}, -- jalapeño pepper
    [8845] = {5, "Munch."}, -- beetroot
    [8847] = {11, "Yum."}, -- chocolate cake
    [9005] = {7, "Slurp."}, -- yummy gummy worm
    [9114] = {5, "Crunch."}, -- bulb of garlic
    [9996] = {0, "Slurp."}, -- banana chocolate shake
    [10454] = {0, "Your head begins to feel better."}, -- headache pill
    [11246] = {15, "Yum."}, -- rice ball
    [11370] = {3, "Urgh."}, -- terramite eggs
    [11429] = {10, "Mmmm."}, -- crocodile steak
    [12415] = {20, "Yum."}, -- pineapple
    [12416] = {10, "Munch."}, -- aubergine
    [12417] = {8, "Crunch."}, -- broccoli
    [12418] = {9, "Crunch."}, -- cauliflower
    [12637] = {55, "Gulp."}, -- ectoplasmic sushi
    [12638] = {18, "Yum."}, -- dragonfruit
    [12639] = {2, "Munch."}, -- peas
    [13297] = {20, "Crunch."}, -- haunch of boar
    [15405] = {55, "Munch."}, -- sandfish
    [15487] = {14, "Urgh."}, -- larvae
    [15488] = {15, "Munch."}, -- deepling filet
    [16014] = {60, "Mmmm."}, -- anniversary cake
    [18397] = {33, "Munch."}, -- mushroom pie
    [19737] = {10, "Urgh."}, -- insectoid eggs
    [20100] = {15, "Smack."}, -- soft cheese
    [20101] = {12, "Smack."} -- rat cheese
}

local autoFeed = CreatureEvent("AutoFeed")

function autoFeed.onThink(player, interval)
    local foundFood, removeFood
    for itemid, food in pairs(foods) do
        if player:getItemCount(itemid) > 0 then
            foundFood, removeFood = food, itemid
            break
        end
    end
    if not foundFood then
        return true
    end
    local condition = player:getCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)
    if condition and math.floor(condition:getTicks() / 1000 + foundFood[1] * 12) < 1200 then
        player:feed(foundFood[1] * 12)
        player:say(foundFood[2], TALKTYPE_MONSTER_SAY)
        player:removeItem(removeFood, 1)
    end
    return true
end

autoFeed:register()

local login = CreatureEvent("RegisterAutoFeed")

function login.onLogin(player)
    player:registerEvent("AutoFeed")
    return true
end

login:register()

thanks in advance!
 
hi again ^^, i would like to request this script converted to tfs 1.3 revscript sys (8.6) if is possible, thanks in advance!
can you check if this works?
 
can you check if this works?

sure, its strange i installed and registered on login.lua, no errors on console, but it doesnt work, when i level up it doesnt show anything...

test_image.png

creaturescript.xml
XML:
    <event type="advance" name="SpellNotifier" script="others/spellnotifier.lua"/>

login.lua
Lua:
    player:registerEvent("SpellNotifier")
 
Request: Configurable boss script

Lua:
bossConfig = {
    [39500] = {  -- ActionID
        requiredLevel = 200, -- Required level of all the players that are standing on the tiles
        minPlayersRequired = 1, -- Minimum players required to be able to use the lever (that are standing on the tiles)
        boss = "Lokathmor", -- Boss name (maybe make it possible to add multiple monsters)
        bossGlobalStorage = 39600,
        playerStorage = 39700,
        teleportPosition = Position(178, 1540, 11), -- Where the team gets teleported to
        centerRoomPosition = Position(178, 1544, 11), -- Center of the boss room position
        northRange = 10, eastRange = 10, southRange = 10, westRange = 10, -- Room sqm config
        exit = Position(287, 1585, 11), -- Where the team gets kicked to if they take to long to kill the boss.
        bossPosition = Position(178, 1544, 11), -- Position where the boss spawns
        time = 15, -- How much time they have to kill the boss before they get kicked (in minutes)

        playerPositions = { -- this should be configurable for example if I want 1 I just use 1 if I want 15 I'd add more.
            [1] = Position(148, 1604, 11),
            [2] = Position(149, 1604, 11),
            [3] = Position(150, 1604, 11),
            [4] = Position(151, 1604, 11),
            [5] = Position(152, 1604, 11)
        }
    },
        [39501] = {
        requiredLevel = 200,
        minPlayersRequired = 1,

        boss = "Ghulosh",
        bossGlobalStorage = 39601,
        playerStorage = 39701,
        teleportPosition = Position(858, 1374, 14),
        centerRoomPosition = Position(860, 1370, 14),
        northRange = 10, eastRange = 10, southRange = 10, westRange = 10,
        exit = Position(893, 1377, 14), 
        bossPosition = Position(862, 1367, 14),
        time = 15,

        playerPositions = {
            [1] = Position(892, 1367, 14),
            [2] = Position(892, 1368, 14)
        }
    }
}

Someone had made this script for me but it isn't working anymore maybe it needs minor changes or maybe it's better to start from scratch. Whatever you think is best :p
Lua:
local function resetBoss(info, bossId)
    local monster = Monster(bossId)
    if monster then
        monster:remove()
    end
    local spectators = Game.getSpectators(info.centerRoomPosition, false, true, info.westRange, info.eastRange, info.northRange, info.southRange)
    for i = 1, #spectators do
        spectators[i]:teleportTo(info.exit)
    end
end
 
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
   
    if item.itemid == 9825 then
        local info = bossConfig[item:getActionId()]
        if not info then
            return false
        end
 
        if (getGlobalStorageValue(info.bossGlobalStorage) > 0) then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "There is already a team inside. Please wait.")
            return true
        end
 
        local errorMsg
        local rPlayers = {}
        for index, ipos in pairs(info.playerPositions) do
            local playerTile = Tile(ipos):getTopCreature()
            if playerTile then
                if playerTile:isPlayer() then
                    if playerTile:getLevel() >= info.requiredLevel then
                        if playerTile:getStorageValue(info.playerStorage) <= os.time() then
                            table.insert(rPlayers, playerTile:getId())
                        else
                            errorMsg = 'One or more players have already entered in the last 20 hours.'
                        end
                    else
                        errorMsg = 'All the players need to be level '.. config.requiredLevel ..' or higher.'
                    end
                end
            end
        end
 
        if (#rPlayers >= info.minPlayersRequired) then
            for _, pid in pairs(rPlayers) do
                local rplayer = Player(pid)
                if rplayer:isPlayer() then
                    rplayer:sendTextMessage(MESSAGE_EVENT_ADVANCE, ('You have %o minutes before you get kicked out.'):format(info.time))
                    info.playerPositions[_]:sendMagicEffect(CONST_ME_POFF)
                    rplayer:teleportTo(info.teleportPosition)
                    rplayer:setStorageValue(info.playerStorage, os.time() + (20 * 60 * 60))
                    info.teleportPosition:sendMagicEffect(CONST_ME_ENERGYAREA)
                    rplayer:setDirection(DIRECTION_NORTH)
                end
            end
            setGlobalStorageValue(info.bossGlobalStorage, 1)
            addEvent(setGlobalStorageValue, info.time * 60 * 1000, info.bossGlobalStorage, 0)
            local monster = Game.createMonster(info.boss, info.bossPosition)
            addEvent(resetBoss, info.time * 60 * 1000, info, monster and monster.uid or 0)
        else
            if not errorMsg then
                player:sendTextMessage(MESSAGE_STATUS_SMALL, ("You need %u players."):format(info.minPlayersRequired))
            else
                player:sendTextMessage(MESSAGE_STATUS_SMALL, errorMsg)
            end
            return true
        end
 
    end
    item:transform(item.itemid == 9826 and 9825 or 9826)
 
    return true
end
 
Could I ask in here for a little help?
I am trying to get the "unlocked=yes/no" attribute value from the Outfits.xml in my 'IF' condition located in my addons.lua from the Addoner.
Is there any way to get it? like I would guess maybe...'getCreatureOutfit(cid).Unlocked?
I am just starting to learn .lua while making my own server, so just need this kind of little helps from time to time, but I would really apreciate it!

Thanks in advance and for the good community OtLand is!
 
Could I ask in here for a little help?
I am trying to get the "unlocked=yes/no" attribute value from the Outfits.xml in my 'IF' condition located in my addons.lua from the Addoner.
Is there any way to get it? like I would guess maybe...'getCreatureOutfit(cid).Unlocked?
I am just starting to learn .lua while making my own server, so just need this kind of little helps from time to time, but I would really apreciate it!

Thanks in advance and for the good community OtLand is!
Hi,
You can use this and modify to return the 'unlocked' value too. I think TFS don't have a function to pass this info by default.
 
Hello,

Version of TFS: 1.3
Version of Client: 12 / 12.15

My resquest - Talkaction / System:

/jail <player name>

How it works?

When i use this command on a player he's lost 15% of all experience and got teleported in a specific zone of the jail. Example: Teleport to the prison cell 1, 2 or other prison cells avaible. (Ex: Teleport to X= 0000 / Y = 0000 / Z = 0000 or other zone to teleport).

But i need an time jail time. Like: one day, two days or seven days.

Can you help me?

Thank you!

Something like this maybe?

/jail PLAYER,ROOMID,DAYS

Ex. /jail Gabriel,5,10
Will teleport player Gabriel to room 5 (JailLocation * (jailOffset*5)) for 10days and lose 15% experience
When player login and jailtime is lower than current time, player will be teleported to temple

Lua:
local jailLocation = Position(527, 1264, 7) -- First jail-room location, offset counts from this location
local jailOffset = 10 -- SQMs between each jail-room
local jailStorage = 300000 -- Storage for jail time in days

local jail = TalkAction("/jail")
function jail.onSay(player,words,param)
    if not player:getGroup():getAccess() then
        return true
    end

    if player:getAccountType() < ACCOUNT_TYPE_GOD then
        return false
    end

    local split = param:splitTrimmed(",")
    if not split[2] or not tonumber(split[2]) then
        player:sendCancelMessage("Jail room not set.")
        return false
    end

    if not split[2] or not tonumber(split[3]) then
        player:sendCancelMessage("Jail time not set.")
        return false
    end

    local target = Player(split[1])
    if not target then
        player:sendCancelMessage("A player with that name is not online.")
        return false
    end
    target:setStorageValue(jailStorage,(60*60*24)*tonumber(split[3]))
    target:removeExperience(target:getExperience()*0.15)
    target:teleportTo(jailLocation+Position(jailOffset*(tonumber(split[2]-1)),0,0))
    return false
end

jail:separator(" ")
jail:register()

local RemoveJail = CreatureEvent("RemoveJail")
function RemoveJail.onLogin(player)
    if player:getStorageValue(jailStorage) <= os.time() then
        player:teleportTo(player:teleportTo(player:getTown():getTemplePosition()))
    end
    return true
end
RemoveJail:register()
 
Hello
how can I add the script ="rewardboss.lua" to the monster? When I put rewardboss="true" in the config a message appears "You are not the owner"
 
Hello
how can I add the script ="rewardboss.lua" to the monster? When I put rewardboss="true" in the config a message appears "You are not the owner"
If you are trying to open with a group account it will not work. The script works only with "normal" accounts, so that the participation of ADMs isn't counted.
 
If you are trying to open with a group account it will not work. The script works only with "normal" accounts, so that the participation of ADMs isn't counted.
I'm using a normal account (without god) and got this erro.
 
I'm using a normal account (without god) and got this erro.
Are you registering the script in the boss tag? ex: script = "rewardboss.lua"

Another thing, are you sure that the flag corresponds to the reward boss is: rewardboss = "true"?
Bcos, in general, "1" is used to set as "TRUE", like: <flag rewardboss = "1" />
 
Back
Top