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

Lua [TFS 1.3] Free Scripting Service 📝

Status
Not open for further replies.

Sarah Wesker

ƐƖєgαηт Sуηтαx ❤
Staff member
TFS Developer
Support Team
Joined
Mar 16, 2017
Messages
1,407
Solutions
154
Reaction score
1,957
Location
London
GitHub
MillhioreBT
Twitch
millhiorebt
I am bored, and I have some days in which I will not have much to do, if you need a script you can post here what you want and if it meets the requirements below, I will do it for you

🗒 Requirements:
🔶 TFS engine 1.3+
🔶 That does not include changes in the sources (if you don't know what this is, you can still ask💬)
🔶 I'll only do one script per person so don't spam🔇too much, until a second chance ...
🔶 It depends on what you ask, I will make the decision to accept or not to do it👀
🔶 I know that several people have posted threads similar to this one, but to add more variety, also not all can be available at the same time👌

Don't be afraid to ask 🤗

👍 If I like your post it means that I have taken the task! 👍
 
Last edited:
Sara I need a script that when killing a monster near the boss takes life away or rather reduces life to the boss as long as it is close to or in range

thk sara
 
Hi Sara, Can u make a script if there's 3 players step in 3 different SQM positions X,Y,Z they open a gate like stone and the gate wait for 4 second then it goes gone.
 
local players = #Game.getPlayers() for range, bonus in pairs(expOnlineBonus) do if players >= range[1] and (players <= (range[2] or math.huge)) then exp = exp * (1 + (bonus / 100)) break end end
how would it be to put a mc check, check ip ... ?
 
I need boss room script you can join every x hours with x mins time to kill boss.
example click lever teleport you to boss room u have 20 mins to kill boss otherwise tp player outside.
u can join solo or multiple players like oberon
 
Hi

I would like to request a spell which is based mostly on random direction

The spell will cast 4 distance effect in a row with small delays with random direction

View attachment 54510

Hi @Levi999x

data/scripts/yourscriptname.lua
Lua:
local config = {
    combatType = COMBAT_DEATHDAMAGE,
    effect = CONST_ME_MORTAREA,
    distanceEffect = CONST_ANI_DEATH,
    minDmg = 1.20,
    maxDmg = 1.45,
    attackCounts = 6
}

local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, config.combatType)
combat:setParameter(COMBAT_PARAM_EFFECT, config.effect)
function onGetFormulaValues(player, level, magicLevel)
    local min = ((level / 5) + (magicLevel * 3)) * config.minDmg
    local max = ((level / 5) + (magicLevel * 3)) * config.maxDmg
    return -min, -max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local function castSpellTo(cid, variant)
    local player = Player(cid)
    if player then
        local target = Creature(variant:getNumber())
        if target then
            local pos = target:getPosition()
            local newpos = target:getPosition() + Position(math.random(-2, 2), math.random(-2, 2), 0)
            newpos:sendDistanceEffect(pos, config.distanceEffect)
            combat:execute(player, variant)
        end
    end
end

local spell = Spell(SPELL_INSTANT)

function spell.onCastSpell(creature, variant)
    local cid = creature:getId()
    for i = 1, config.attackCounts do
        addEvent(castSpellTo, 200 * (i -1), cid, variant)
    end
    return true
end

spell:name("Spectral Spell")
spell:words("exuna spectral")
spell:group("attack")
spell:vocation("sorcerer", "master sorecerer")
spell:id(1)
spell:cooldown(1000)
spell:level(200)
spell:range(6)
spell:manaPercent(13)
spell:needTarget(true)
spell:blockWalls(true)
spell:isPremium(true)
spell:register()

GIF 05-02-2021 03-11-07 a. m..gif
Post automatically merged:

I'd like to request a auto broadcast script that will broadcast every 15 minutes:

top 5 lvl players (online/all time)
top 5 skills (online/all time)

😁

great work btw sarah

Hi @Evil Puncker

data/scripts/yourscriptname.lua
Lua:
local config = {
    topCount = 5,
    messageType = MESSAGE_EVENT_ADVANCE,
    interval = 15 * 60 * 1000, -- 15 minutes for each
    hideAccessPlayers = false
}

local currentTopType = 1
local topTypes = {
    { 'Level', Player.getLevel },
    { 'Magic Level', Player.getMagicLevel },
    { 'Sword', Player.getSkillLevel, SKILL_SWORD },
    { 'Axe', Player.getSkillLevel, SKILL_AXE },
    { 'Club', Player.getSkillLevel, SKILL_CLUB },
    { 'Distance', Player.getSkillLevel, SKILL_DISTANCE },
    { 'Shield', Player.getSkillLevel, SKILL_SHIELD }
    --{ 'Fish', Player.getSkillLevel },
    --{ 'Fist', Player.getSkillLevel }
}

local globalEvent = GlobalEvent("TopLevelOnline")
function globalEvent.onThink(interval)
    local type = topTypes[currentTopType]
    local getSkill = type[2]
    local types = #topTypes
    currentTopType = currentTopType+1
    if currentTopType == types+1 then currentTopType = 1 end
    local players = config.hideAccessPlayers and {} or Game.getPlayers()
    if config.hideAccessPlayers then
        for _, p in pairs(Game.getPlayers()) do
            if not p:getGroup():getAccess() then
                players[#players +1] = p
            end
        end
    end
    local count = math.min(config.topCount, #players)
    if count > 0 then
        if count > 1 then
            table.sort(players, function(a, b) return getSkill(a) > getSkill(b) end)
        end
        local description = string.format("~ Top %d Online / %s ~\n\n", config.topCount, type[1])
        for i = 1, count do
            local p = players[i]
            description = string.format("%s%d) %s - %d%s", description, i, p:getName(), getSkill(p, type[3]), (i == count and "" or "\n"))
        end
        broadcastMessage(description, config.messageType)
    end
    return true
end
globalEvent:interval(config.interval)
globalEvent:register()

GIF 05-02-2021 04-13-55 a. m..gif

Every 15 minutes a message of the best online is transmitted, of each skill, this goes in sequence, starting with the level, then the magic level, and then the following skills, every 15 minutes it changes skill, and when it reaches the end from the list, start again with the level/ml/skills bla bla bla...

Note: I don't think I really understood what you wanted, but I assumed it was something like this ;)
 
Last edited:
I am bored, and I have some days in which I will not have much to do, if you need a script you can post here what you want and if it meets the requirements below, I will do it for you

🗒 Requirements:
🔶 TFS engine 1.3+
🔶 That does not include changes in the sources (if you don't know what this is, you can still ask💬)
🔶 I'll only do one script per person so don't spam🔇too much, until a second chance ...
🔶 It depends on what you ask, I will make the decision to accept or not to do it👀
🔶 I know that several people have posted threads similar to this one, but to add more variety, also not all can be available at the same time👌

Don't be afraid to ask 🤗

👍 If I like your post it means that I have taken the task! 👍
Hey Sarah, thank you for this great contribution.
If i may i would like to ask for spell that teleports user where his mouse is , and is triggered by using right click anywhere on the map (game window range , not minimap). Spell has some exhaust ofcourse and player cannot tp thru walls and on objects/players/monsters. Once more , thank you!
 
Hi @Levi999x

data/scripts/yourscriptname.lua
Lua:
local config = {
    combatType = COMBAT_DEATHDAMAGE,
    effect = CONST_ME_MORTAREA,
    distanceEffect = CONST_ANI_DEATH,
    minDmg = 1.20,
    maxDmg = 1.45,
    attackCounts = 6
}

local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, config.combatType)
combat:setParameter(COMBAT_PARAM_EFFECT, config.effect)
function onGetFormulaValues(player, level, magicLevel)
    local min = ((level / 5) + (magicLevel * 3)) * config.minDmg
    local max = ((level / 5) + (magicLevel * 3)) * config.maxDmg
    return -min, -max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local function castSpellTo(cid, variant)
    local player = Player(cid)
    if player then
        local target = Creature(variant:getNumber())
        if target then
            local pos = target:getPosition()
            local newpos = target:getPosition() + Position(math.random(-2, 2), math.random(-2, 2), 0)
            newpos:sendDistanceEffect(pos, config.distanceEffect)
            combat:execute(player, variant)
        end
    end
end

local spell = Spell(SPELL_INSTANT)

function spell.onCastSpell(creature, variant)
    local cid = creature:getId()
    for i = 1, config.attackCounts do
        addEvent(castSpellTo, 200 * (i -1), cid, variant)
    end
    return true
end

spell:name("Spectral Spell")
spell:words("exuna spectral")
spell:group("attack")
spell:vocation("sorcerer", "master sorecerer")
spell:id(1)
spell:cooldown(1000)
spell:level(200)
spell:range(6)
spell:manaPercent(13)
spell:needTarget(true)
spell:blockWalls(true)
spell:isPremium(true)
spell:register()

View attachment 54564
Post automatically merged:



Hi @Evil Puncker

data/scripts/yourscriptname.lua
Lua:
local config = {
    topCount = 5,
    messageType = MESSAGE_EVENT_ADVANCE,
    interval = 15 * 60 * 1000 -- 15 minutes for each
}

local currentTopType = 1
local topTypes = {
    { 'Level', Player.getLevel },
    { 'Magic Level', Player.getMagicLevel },
    { 'Sword', Player.getSkillLevel },
    { 'Axe', Player.getSkillLevel },
    { 'Club', Player.getSkillLevel },
    { 'Distance', Player.getSkillLevel },
    { 'Shield', Player.getSkillLevel }
    --{ 'Fish', Player.getSkillLevel },
    --{ 'Fist', Player.getSkillLevel }
}

local globalEvent = GlobalEvent("TopLevelOnline")
function globalEvent.onThink(interval)
    local type = topTypes[currentTopType]
    local getSkill = type[2]
    local types = #topTypes
    currentTopType = math.min(types, currentTopType +1)
    if currentTopType == types then
        currentTopType = 1
    end
    local players = Game.getPlayers()
    local count = math.min(config.topCount, #players)
    if count > 0 then
        if count > 1 then
            table.sort(players, function(a, b) return getSkill(a) > getSkill(b) end)
        end
        local description = string.format("~ Top %d Online / %s ~\n\n", config.topCount, type[1])
        for i = 1, count do
            local p = players[i]
            description = string.format("%s%d) %s - %d%s", description, i, p:getName(), getSkill(p), (i == count and "" or "\n"))
        end
        broadcastMessage(description, config.messageType)
    end
    return true
end
globalEvent:interval(config.interval)
globalEvent:register()

View attachment 54565

Every 15 minutes a message of the best online is transmitted, of each skill, this goes in sequence, starting with the level, then the magic level, and then the following skills, every 15 minutes it changes skill, and when it reaches the end from the list, start again with the level/ml/skills bla bla bla...

Note: I don't think I really understood what you wanted, but I assumed it was something like this ;)

Well done

thanks :D
 
hi Sarah sorry but I don't know if you can create a script ..
I would like you to create 2 mosters as you pass through the floor, but to have time. For example, when passing over it, it will create the 2 mosters and when it happens again, it does not create anything since you have to wait 1 hour for you to pass again .. I don't know if you understand me

it's for a quest

yes no then at least answer me with a (no, or a yes)
since you are ignoring me now to know and not bother if it is too much to ask thanks
Hi @Kabo Flow

data/scripts/yourscriptname.lua
Lua:
local config = {
    actionId = 800,
    delay = 60 * 60, -- 1 hour
    delayPersistent = false,
    bosses = {
        { name = "Demon", pos = Position(2593, 1802, 8) },
        { name = "Dragon", pos = Position(2595, 1802, 8) }
    }
}

local movIn = MoveEvent()

function movIn.onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return true
    end
    local playerId = player:getId()
    local ground = Tile(position):getGround()
    if ground then
        local now = os.time()
        local delay = config.delayPersistent and ground:getCustomAttribute("delay") or config.time
        if not delay or delay <= now then
            position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
            for _, info in pairs(config.bosses) do
                Game.createMonster(info.name, info.pos)
            end
            if not config.delayPersistent then
                config.time = now + config.delay
            else
                ground:setCustomAttribute("delay", now + config.delay)
            end
        else
            position:sendMagicEffect(CONST_ME_POFF)
            player:sendTextMessage(MESSAGE_STATUS_DEFAULT, string.format("You must wait %d seconds to summon the bosses again.", delay - now))
        end
    end
    return true
end

movIn:aid(config.actionId)
movIn:register()

GIF 05-02-2021 04-09-30 p. m..gif

In the configuration you can find a variable called: delayPersistent if this variable is true, the delay persists even if it does script reloads, while if it is false, it will be able to invoke monsters every time it reloads the script, You can add more monsters if you wish, you can also modify the delay time
 
Hi Sarah , can u make this script if it's possible let's say we have 4 vocations I need these vocations 3 of them disable their losing items and 1 single vocation could lose his items. If this vocation have no amulet and he died he must lose all of his items like if he have a red skull losing his items oncely I'm just highlighting the idea I mean losing all the items at the same time if you can do this with another thing it's okay becaus i'v tried but I've failed. And this vocation can only use this amulets {2138,2141,2201} to save their items from dropping and the other vocations can use those amulets too but when they are going to die it remove their aol and not dropping anything.
 
Last edited:
Hello @Sarah Wesker I need script that will upgrade item's with atk/def/arm in percent but not like normal one from OTland. Lets call it "Multi Upgrade System"
Example: I have magic sword that wanna to upgrade so I use itemid 1111 on it and upgrade it one by one up to +15 then when I have +15 magic sword I use itemid 2222 on it to upgrade it further up to +30 and then next itemid 3333 upgrade it up to +50.

Awesome work btw, most of those scripts bring me some new content already :)

Hi @killer990

data/scripts/yourscriptname.lua
Lua:
local stones = {
      [21402] = {
              minLevel = 0, -- minimum level to use
              maxLevel = 15, -- maximum level to you can use
            chance = 75, -- probability of leveling up
            extraPercent = 0 -- extra attribute increase percentage
      },
      [21403] = {
              minLevel = 15,
            maxLevel = 30,
            chance = 50,
            extraPercent = 1
      },
      [6666] = {
              minLevel = 30,
            maxLevel = 50,
            chance = 25,
            extraPercent = 2
      }
}

local attributes = {
    [ITEM_ATTRIBUTE_ATTACK] = {
        getValue = ItemType.getAttack,
        percent = 5 -- attribute increase percentage in this case for attack
    },
    [ITEM_ATTRIBUTE_DEFENSE] = {
        getValue = ItemType.getDefense,
        percent = 5 -- attribute increase percentage in this case for defense
    },
    [ITEM_ATTRIBUTE_EXTRADEFENSE] = {
        getValue = ItemType.getExtraDefense,
        percent = 5 -- attribute increase percentage in this case for extraDefense
    },
    [ITEM_ATTRIBUTE_ARMOR] = {
        getValue = ItemType.getArmor,
        percent = 5 -- attribute increase percentage in this case for armor
    },
    [ITEM_ATTRIBUTE_HITCHANCE] = {
        getValue = ItemType.getHitChance,
        percent = 5 -- attribute increase percentage in this case for hitChance
    }
}

local function onUpgradeLvl(level, chance, config)
    local nextLevel = math.min(config.maxLevel, level +1)
    if math.random(1, chance) <= config.chance then
        return nextLevel
    end
    return level
end

local function isUpgradeable(item)
    local it = item:getType()
    return it:getAttack() > 0 or it:getDefense() > 0 or it:getArmor() > 0 or it:getExtraDefense() > 0
end

local function getItemLevel(item)
    return item:getCustomAttribute("upgradeLevel") or 0
end

local function setItemLevel(item, level)
    return item:setCustomAttribute("upgradeLevel", level)
end

local function upgradeValue(value, level, info, stone)
    return value * ((1.0 + ((info.percent + stone.extraPercent) / 100)) * level)
end

local function doUpgrade(item, level, stone)
    local itemType = item:getType()
    if level <= 0 then
        setItemLevel(item, level)
        item:setAttribute(ITEM_ATTRIBUTE_NAME, itemType:getName())
        for attribute, info in pairs(attributes) do
            item:setAttribute(attribute, info.getValue(itemType))
        end
        return true
    end
    setItemLevel(item, level)
    item:setAttribute(ITEM_ATTRIBUTE_NAME, string.format("%s +%u", itemType:getName(), level))
    for attribute, info in pairs(attributes) do
        local value = info.getValue(itemType)
        if value ~= 0 then
            item:setAttribute(attribute, upgradeValue(value, level, info, stone))
        end
    end
    return true
end

local upgrade = Action()
function upgrade.onUse(player, item, fromPos, target, toPos, isHotkey)
    if not target or not target:isItem() then
        player:sendCancelMessage("You cannot use this object.")
        return true
    end
    local stone = stones[item:getId()]
    if not stone then
        return false
    end
    if not isUpgradeable(target) then
        player:sendCancelMessage("This item cannot be upgrade.")
        return true
    end
    local level = getItemLevel(target)
    if level < stone.minLevel then
        player:sendCancelMessage(string.format("The minimum level to use is %d.", stone.minLevel))
        return true
    end
    local newLevel = onUpgradeLvl(level, 100, stone)
    if level >= stone.maxLevel then
        player:getPosition():sendMagicEffect(CONST_ME_POFF, player)
        player:sendCancelMessage("This item is already at its maximum level.")
        return true
    elseif newLevel == level then
        player:say("Failed!", TALKTYPE_MONSTER_SAY)
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
    elseif newLevel > level then
        player:say("Success!", TALKTYPE_MONSTER_SAY)
        player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
    end
    doUpgrade(target, newLevel, stone)
    item:remove(1)
    return true
end
for aid, _ in pairs(stones) do
    upgrade:id(aid)
end
upgrade:register()

GIF 06-02-2021 03-10-10 a. m..gif

Each stone can be configured so that it can only be used in a range of levels, for example: 0 > 15 | 15 > 30 | 30 > 50 ....
You can also configure a custom attribute increment for each stone.

Important note: If you have a system that modifies the names of the articles, then you will have problems using this update system, since this system will overwrite the original name of the article + the corresponding level, the level is not lost, but it will not be show in name in case another system modifies it.

If you have another system that modifies the names, like for example a slot system or something else, you can tell me and I will help you solve the problem quickly with a little trick.
 
Last edited:
A spell for knights. draws the target towards itself the second spell draws 6x6 monsters towards it. Configuration with number of targets, distance, etc.
When pulled, it stops the monster for 2 seconds and the player for 1.
 
Status
Not open for further replies.
Back
Top