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

Free Scripting. TFS [1.2]

Status
Not open for further replies.

Mkalo

ボーカロイド
Senator
Joined
Jun 1, 2011
Messages
1,118
Solutions
55
Reaction score
946
Location
Japan
Rules:
  1. ONLY TFS 1.2 ONLY TFS 1.2 ONLY TFS 1.2
  2. Don't ask for fix/convert/copy a script.
  3. Provide enough information about your request (you may provide a video as long its made by you). I may not answer you if you don't.
  4. Ask only for advanced and complex scripts/systems. You may ask for simple stuff but the chances of me being interested to do it is low.
  5. If your request require heavy source modification I won't do it.
  6. Anyone can do the requests if you feel like doing it.
  7. Be nice.

I don't have much time to do lots of scripts, so I'll make this work by placing the requests in a list and I'll do them in order of request. I'll try to do 1~3/week.
If I like your post it means I'm going to do it and it will be added to the list. If I don't like or I don't put it in the list, don't ask again because I'm not doing it.
Most likely I will post the requests in a different thread and link the thread here.

I will also stream while doing all requests, so if you feel like "learning"(watching) the process you can check it at http://www.twitch.tv/mkalo

Cya.
 
Last edited:
Watching people code is like watching paint dry...

I have a request... I want a my little pony script!
 
You are the man!
my_little_pony.png
 
Code:
** Minigame [Patch 0.1.6+]
Mount racing (don't forget to reward mount for lore boss kill)
Player requires a mount to join a racing minigame.
minimum players required: 2

Road will be randomly generated.
On the main road, buffs are randomly generated and activated on Step In.

Every player will choose buff to start racing with.
Every Mount in game has his own unique effect for racing minigame.

Minigame can be started with fee and without fee.
Payment minigame awards points. With points players can buy buffs to their mounts (what also work outside the minigame)

----
functions:
1. registration for the race.
it should be able to register 5 races at once. (max 4 players per race)
It should have Que system if all 5 races are full.
Registration happens trough NPC modal window.

2. generating race map
Area is prechosen. Tracks are 4 tiles wide.
Map has random obstacles and is circular.
1 race area is 16x16 tiles.
Random obstacles should not block road (so check is required.)
Lapses (how many times players got to pass circles) can be modified.

3. buffs
granted on step in the buff gives temporary bonus. Only 1 bonus can be picked up every 5 seconds.
Buffs are also randomly generated to map. (in row) so 1 line of buffs (aka 4 different ones in same row)

All buffs should have config table to balance them easier and to add new buffs to game.
Buffs:
a. temp boost for x seconds.
b. slowing obstacle (a 1 use spell what drops pool under you to slow down players who step on it)
c. solid block (an item what players can drop whereever and that item cant be stepped on and dissapears in 3seconds after use)
d. hook (replaces positions with the player in front of you (max 3 tiles) activated as spell. and shoots out a distance effect)
e. jump (on spellcast jumps over a 2 tiles in front of you.)
f. stun (stuns player next to you for x seconds)

you can think of more of buffs, for now I guess its enough.
all same buffs can be stacked. also the amount of charges should be able to be modified

4. mechanics
onthink function will check each second player distances between them.
The more behind player is from first place. the more speed one gets.

5. rewards and fee
joining event costs items (for now i think apples.)
as reward you get points. Depending on your place of the event end. (event last place also gets points)
In addition ranking should be added. where half of the players who participated gain rating from the other half who lost. (in 3 player race only 1 wins rating)
With points npc has a minigame shop. Which can update your individual mounts for the minigame or for out of the world (like damage protection or extra speed)
NB! no need to make mount effects. I will deal with it myself. Just make it possible to easily config a npc buy list to upgrade mounts.

Something I wrote down months ago.
Maybe you want to struggle with it?
 
I have a script request.

A room contains 16 basic levers, and a master lever.
It also contains white checker pieces, and coloured stones.
Checker pieces signify 'chances'.

Picture below will show what I describe.

This room is a puzzle.
The puzzle solution is randomized each time the server starts up.

The master switch basically controls the entire puzzle.

Whenever the master switch is used, all of the regulars levers are randomly flopped. _/_ , _\_

Each pillar has it's own 'lock'. The first four pillars use 2-4 levers as it's lock sequence, and none of the levers can be reused in another lock sequence.
The pillars must be unlocked in order of appearance, top to bottom.
If the next pillar's lock combination is incorrect, it will replace a random unlocked pillar.

(for example, if you've unlocked the first 3 pillars, and get the 4th combination wrong, either 1st, 2nd, or 3rd pillar is replaced.)

The 5th pillars lock combination uses the other 4 pillars lock combinations combined, but reversed.

The checker pieces aka 'chances', get removed anytime a mistake is made.
If there are no 'chances' remaining, reset entire puzzle to the static image above.

To re-iterate using another 'awesome picture'.

xHolNGH.png


If your interested in creating it but my explanation is not good enough, feel free to slap me over text.

Cheers!

Xikini
 
I have a script request.

A room contains 16 basic levers, and a master lever.
It also contains white checker pieces, and coloured stones.
Checker pieces signify 'chances'.

Picture below will show what I describe.


This room is a puzzle.
The puzzle solution is randomized each time the server starts up.

The master switch basically controls the entire puzzle.

Whenever the master switch is used, all of the regulars levers are randomly flopped. _/_ , _\_

Each pillar has it's own 'lock'. The first four pillars use 2-4 levers as it's lock sequence, and none of the levers can be reused in another lock sequence.
The pillars must be unlocked in order of appearance, top to bottom.
If the next pillar's lock combination is incorrect, it will replace a random unlocked pillar.

(for example, if you've unlocked the first 3 pillars, and get the 4th combination wrong, either 1st, 2nd, or 3rd pillar is replaced.)

The 5th pillars lock combination uses the other 4 pillars lock combinations combined, but reversed.

The checker pieces aka 'chances', get removed anytime a mistake is made.
If there are no 'chances' remaining, reset entire puzzle to the static image above.

To re-iterate using another 'awesome picture'.

xHolNGH.png


If your interested in creating it but my explanation is not good enough, feel free to slap me over text.

Cheers!

Xikini
:eek:
 
I have a script request.

A room contains 16 basic levers, and a master lever.
It also contains white checker pieces, and coloured stones.
Checker pieces signify 'chances'.

Picture below will show what I describe.


This room is a puzzle.
The puzzle solution is randomized each time the server starts up.

The master switch basically controls the entire puzzle.

Whenever the master switch is used, all of the regulars levers are randomly flopped. _/_ , _\_

Each pillar has it's own 'lock'. The first four pillars use 2-4 levers as it's lock sequence, and none of the levers can be reused in another lock sequence.
The pillars must be unlocked in order of appearance, top to bottom.
If the next pillar's lock combination is incorrect, it will replace a random unlocked pillar.

(for example, if you've unlocked the first 3 pillars, and get the 4th combination wrong, either 1st, 2nd, or 3rd pillar is replaced.)

The 5th pillars lock combination uses the other 4 pillars lock combinations combined, but reversed.

The checker pieces aka 'chances', get removed anytime a mistake is made.
If there are no 'chances' remaining, reset entire puzzle to the static image above.

To re-iterate using another 'awesome picture'.

xHolNGH.png


If your interested in creating it but my explanation is not good enough, feel free to slap me over text.

Cheers!

Xikini
I just didn't get why in that second picture you only have 4-3-3-1 levers, I believe its because each will be assigned with 2-4 levers so thats why you let some of them missing correct me if i'm wrong.
 
I just didn't get why in that second picture you only have 4-3-3-1 levers, I believe its because each will be assigned with 2-4 levers so thats why you let some of them missing correct me if i'm wrong.
Right, I just replaced some of the levers with 'blanks' to get the picture across better.

All the levers would still remain, but some might not be used at all because, like you said, 2-4 levers are chosen for each pillar.

So 16 levers could be used, or as little as 8 levers may be used.
 
Energy down NotLikeThis :(

EDIT: Alright back on, now redo some lines that were lost :/ RIP
 
Last edited:
A script that will set percent of extra experience for all guild members for X time.. Can be used in PvP Events etera.
 
I have a script request.
Code:
-- Lever map and position
local levermap = {
{1,  2,  0, 5,  6},
{3,  4,  0, 7,  8},
{0,  0,  0, 0,  0},
{9,  10, 0, 13, 14},
{11, 12, 0, 15, 16},
}


local mappos = Position(115, 361, 6)
local nlevers = 16

-- Rock pos
local rocks = {
[1] = {id = 1354, pos = Position(124, 359, 6)},
[2] = {id = 1355, pos = Position(124, 361, 6)},
[3] = {id = 1354, pos = Position(124, 363, 6)},
[4] = {id = 1355, pos = Position(124, 365, 6)},
[5] = {id = 1354, pos = Position(124, 367, 6)},
}

-- Lever states
local leverstates = {
[0] = 1945,
[1] = 1946,
}

local transform = {
[9825] = 9826,
[9826] = 9825,
}

-- Tokens pos
local tokens = {
[1] =  Position(126, 360, 6),
[2] =  Position(127, 360, 6),
[3] =  Position(128, 360, 6),
[4] =  Position(127, 361, 6),
[5] =  Position(128, 361, 6),
[6] =  Position(127, 364, 6),
[7] =  Position(128, 364, 6),
[8] =  Position(126, 365, 6),
[9] =  Position(127, 365, 6),
[10] = Position(128, 365, 6),
}

local tokenid = 2625

-- Safe pos
local safepos = Position(124, 358, 6)

-- Time to restore
local restoretime = 30 -- seconds

-- Reset combination after restore
local reset = true

-- Delay between uses
local delay = 2 -- seconds

-- functions
function setLeverStates()
    if not LEVER_STATES then
        LEVER_STATES = {}
        local tmp = {}
        for i = 1, 4 do
            LEVER_STATES[i] = {}
            for x = 1, math.random(2, 4) do
                local rd = math.random(1, 16)
                while tmp[rd] do
                    rd = math.random(1, 16)
                end
                tmp[rd] = true
                LEVER_STATES[i][rd] = math.random(0, 1)
            end
        end
    end
end

function removeToken(tokens)
    for i = 1, #tokens do
        local tile = Tile(tokens[i])
        if tile then
            local token = tile:getItemById(tokenid)
            if token then
                token:getPosition():sendMagicEffect(CONST_ME_POFF)
                token:remove()
                return true
            end
        end
    end

    return false
end

function teleportPlayers(rocks, safepos)
    local startpos = rocks[1].pos
    local endpos = rocks[#rocks].pos
    for y = startpos.y, endpos.y do
        for x = startpos.x, endpos.x do
            local tile = Tile(x, y, startpos.z)
            if tile then
                local creatures = tile:getCreatures()
                if creatures and #creatures > 0 then
                    for i = 1, #creatures do
                        if creatures[i]:isPlayer() then
                            creatures[i]:teleportTo(safepos)
                        end
                    end
                end
            end
        end
    end
end

function getCurrentStone(rocks)
    for i = 1, #rocks do
        local tile = Tile(rocks[i].pos)
        local item = tile:getItemById(rocks[i].id)
        if item then
            return item, i
        end
    end

    return false
end

function getMissingStones(rocks)
    local ret = {}
    for i = 1, #rocks do
        local tile = Tile(rocks[i].pos)
        local item = tile:getItemById(rocks[i].id)
        if not item then
            table.insert(ret, rocks[i])
        end
    end

    return ret
end

function Tile:removeItems()
    local items = self:getItems()
    for i = 1, #items do
        items[i]:remove()
    end
end

function getLeverPosition(map, mappos, id)
    for y = 1, #map do
        for x = 1, #map[1] do
            if map[y][x] == id then
                return Position(mappos.x+x-1, mappos.y+y-1, mappos.z)
            end
        end
    end

    print("Warning - Lever id " .. id .. " not found.")
    return false
end

function restorePuzzle(map, mappos, rocks, tokens, safepos, reset)
    teleportPlayers(rocks, safepos)
    if reset then
        LEVER_STATES = nil
    end

    for i = 1, #rocks do
        local tile = Tile(rocks[i].pos)
        tile:removeItems()
        Game.createItem(rocks[i].id, 1, rocks[i].pos)
    end

    for i = 1, #tokens do
        local tile = Tile(tokens[i])
        if tile then
            tile:removeItems()
            Game.createItem(tokenid, 1, tokens[i])
        end
    end

    for y = 1, #map do
        for x = 1, #map[1] do
            if map[y][x] > 0 then
                local tile = Tile(mappos.x+x-1, mappos.y+y-1, mappos.z)
                local lever = tile:getItemById(1945) or tile:getItemById(1946)
                if lever then
                    lever:transform(leverstates[0])
                else
                    print("Warning - Map or mappos is wrong.")
                end
            end
        end
    end
end

function restoreRandomRock(rocks, safepos)
    local missingstones = getMissingStones(rocks)
    if #missingstones > 0 then
        local rd = math.random(1, #missingstones)
        Game.createItem(missingstones[rd].id, 1, missingstones[rd].pos)
        teleportPlayers(rocks, safepos)
    end
end

function randomizeLevers(map, mappos)
    for y = 1, #map do
        for x = 1, #map[1] do
            if map[y][x] > 0 then
                local tile = Tile(mappos.x+x-1, mappos.y+y-1, mappos.z)
                local lever = tile:getItemById(1945) or tile:getItemById(1946)
                if lever then
                    lever:transform(leverstates[math.random(0, 1)])
                else
                    print("Warning - Map or mappos is wrong.")
                end
            end
        end
    end
end

function combinationStr()
    local ret = ""
    if LEVER_STATES then
        for stoneid, states in ipairs(LEVER_STATES) do
            local str = ""
            for lever, state in pairs(states) do
                str = string.format("%s %d - %d,", str, lever, state)
            end
            str = str:sub(1, #str-1)
            ret = ret .. string.format("Stone %d:%s\n", stoneid, str)
        end
    end

    return "\n" .. ret:sub(1, #ret-1)
end

local lastuse = 0

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local itemid = item:getId()
    if lastuse+delay > os.time() then
        fromPosition:sendMagicEffect(CONST_ME_POFF)
        return player:sendCancelMessage("You are exhausted.")
    end

    if transform[itemid] then
        lastuse = os.time()
        setLeverStates()
        local curstone, stoneid = getCurrentStone(rocks)
        if curstone then

            if player:getGroup():getAccess() and player:getAccountType() >= ACCOUNT_TYPE_GOD then
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, combinationStr())
            end

            if stoneid < 5 then
                local curstates = LEVER_STATES[stoneid]
                local fail = false
                for id, state in pairs(curstates) do
                    local pos = getLeverPosition(levermap, mappos, id)
                    local tile = Tile(pos)
                    if tile then
                        local leveritem = tile:getItemById(leverstates[state])
                        if not leveritem then
                            fail = true
                            break
                        end
                    else
                        return print("Warning - Invalid map or mappos.")
                    end
                end

                if not fail then
                    curstone:remove()
                else
                    curstone:getPosition():sendMagicEffect(CONST_ME_POFF)
                    fromPosition:sendMagicEffect(CONST_ME_POFF)
                    local ret = removeToken(tokens)
                    if not ret then
                        restorePuzzle(levermap, mappos, rocks, tokens, safepos)
                    elseif stoneid > 1 then
                        restoreRandomRock(rocks, safepos)
                    end
                end
            elseif stoneid == 5 then
                local fail = false
                for sid, states in ipairs(LEVER_STATES) do
                    for id, state in pairs(states) do
                        local pos = getLeverPosition(levermap, mappos, id)
                        local tile = Tile(pos)
                        if tile then
                            local leveritem = tile:getItemById(leverstates[state == 0 and 1 or 0])
                            if not leveritem then
                                fail = true
                                break
                            end
                        else
                            return print("Warning - Invalid map or mappos.")
                        end
                    end
                end

                if not fail then
                    curstone:remove()
                    addEvent(restorePuzzle, restoretime*1000, levermap, mappos, rocks, tokens, safepos, reset)
                else
                    curstone:getPosition():sendMagicEffect(CONST_ME_POFF)
                    fromPosition:sendMagicEffect(CONST_ME_POFF)
                    local ret = removeToken(tokens)
                    if not ret then
                        restorePuzzle(levermap, mappos, rocks, tokens, safepos)
                    elseif stoneid > 1 then
                        restoreRandomRock(rocks, safepos)
                    end
                end
            end

            randomizeLevers(levermap, mappos)
        end
        item:transform(transform[itemid])
    end
    return true
end

mappos is the northwest corner position of the levermap.
 
Last edited:
@MatheusMkalo do not use redundant comments.

-- Lever states
local leverstates = {

wtf?

-- Safe pos
local safepos = Position(124, 358, 6)

again..

-- Time to restore
local restoretime = 30 -- seconds

again....

-- Delay between uses
local delay = 2 -- seconds

its called interval

etc..
You get the point.

pairs are easier to read.
for i = 1, #tokens do
-->
for _, pos in ipairs(tokens) do


local tile = Tile(rocks.pos)
local item = tile:getItemById(rocks.id)
if not item then

what if map is moved? what if positions get deleted?
I tell you what if. Possible crash.
 
@MatheusMkalo do not use redundant comments.

-- Lever states
local leverstates = {

wtf?

-- Safe pos
local safepos = Position(124, 358, 6)

again..

-- Time to restore
local restoretime = 30 -- seconds

again....

-- Delay between uses
local delay = 2 -- seconds

its called interval

etc..
You get the point.
Comments are just comments. Lol...
 
Status
Not open for further replies.
Back
Top