• 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:
OP is not taking more requests.

 
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 I have question to u, can u add me on discord? Zakrzew#5411
 
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()

View attachment 54604

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.
Congratulations, very good and simple.
How would it look if when there was a failure, you went back one level?
 
Last edited:
if you keep helping, I'll be grateful if you change calculating method in this:
Lua:
local runeTest = Spell(SPELL_RUNE)
function runeTest.onCastSpell(creature, variant)
local target = Tile(variant:getPosition()):getTopVisibleCreature(creature)
if not target or not target:isPlayer() then
creature:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end
local maxMana = creature:getMaxMana() / 100
target:addMana(math.random(maxMana * 10, maxMana * 15))
target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
target:say("MR Aaahh!")
return true
end
runeTest:name("ManaRune#1")
runeTest:isAggressive(false)
runeTest:runeId(2280)
runeTest:blockWalls(true)
runeTest:magicLevel(0)
runeTest:level(1)
runeTest:group("support")
runeTest:vocation("sorcerer", "master sorcerer")
runeTest:id(24)
runeTest:cooldown(1 * 1000)
runeTest:groupCooldown(1 * 1000)
runeTest:isPremium(true)


to:
Lua:
function onGetFormulaValues(player, level, magicLevel)
local min = (level / 5) + (magicLevel * 3.2) + 20
local max = (level / 5) + (magicLevel * 5.4) + 40
return min, max
end
 
if you keep helping, I'll be grateful if you change calculating method in this:
Lua:
local runeTest = Spell(SPELL_RUNE)
function runeTest.onCastSpell(creature, variant)
local target = Tile(variant:getPosition()):getTopVisibleCreature(creature)
if not target or not target:isPlayer() then
creature:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end
local maxMana = creature:getMaxMana() / 100
target:addMana(math.random(maxMana * 10, maxMana * 15))
target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
target:say("MR Aaahh!")
return true
end
runeTest:name("ManaRune#1")
runeTest:isAggressive(false)
runeTest:runeId(2280)
runeTest:blockWalls(true)
runeTest:magicLevel(0)
runeTest:level(1)
runeTest:group("support")
runeTest:vocation("sorcerer", "master sorcerer")
runeTest:id(24)
runeTest:cooldown(1 * 1000)
runeTest:groupCooldown(1 * 1000)
runeTest:isPremium(true)


to:
Lua:
function onGetFormulaValues(player, level, magicLevel)
local min = (level / 5) + (magicLevel * 3.2) + 20
local max = (level / 5) + (magicLevel * 5.4) + 40
return min, max
end
replace that:
Lua:
local maxMana = creature:getMaxMana() / 100
target:addMana(math.random(maxMana * 10, maxMana * 15))

for this:
Lua:
local minMana = (level / 5) + (magicLevel * 3.2) + 20
local maxMana = (level / 5) + (magicLevel * 5.4) + 40
target:addMana(math.random(minMana, maxMana))
 
replace that:
Lua:
local maxMana = creature:getMaxMana() / 100
target:addMana(math.random(maxMana * 10, maxMana * 15))

for this:
Lua:
local minMana = (level / 5) + (magicLevel * 3.2) + 20
local maxMana = (level / 5) + (magicLevel * 5.4) + 40
target:addMana(math.random(minMana, maxMana))

I get error:
Lua:
:callback
lua:8: attempt to perform arithmetic on global 'level' (a nil value)
stack traceback:
        [C]: in function '__div'
        lua:8: in function lua:2>

Code:
local runeTest = Spell(SPELL_RUNE)
function runeTest.onCastSpell(creature, variant)
    local target = Tile(variant:getPosition()):getTopVisibleCreature(creature)
    if not target or not target:isPlayer() then
        creature:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end
    local minMana = (level / 5) + (magicLevel * 3.2) + 20
    local maxMana = (level / 5) + (magicLevel * 5.4) + 40
    target:addMana(math.random(minMana, maxMana))
    target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    target:say("MR Aaahh!")
    return true
end

runeTest:name("ManaRune#1")
runeTest:isAggressive(false)
runeTest:runeId(2280)
runeTest:blockWalls(true)
runeTest:magicLevel(0)
runeTest:level(1)
runeTest:group("support")
runeTest:vocation("knight", "elite knight")
runeTest:id(24)
runeTest:cooldown(1 * 1000)
runeTest:groupCooldown(1 * 1000)
runeTest:isPremium(true)
runeTest:register()
 
I request, Rebirth System for TFS 1.3.
  • Shows on the avatar, amount of rebirths.
  • Adds extra % hp/mana & skills for diffrent vocations on each rebirth. If a 10 or 20 amount then it gives an bonus of 5% hp/mana
Love your work, you're amazing Sarah! :3
 
is it possible to create an auction NPC? to use with the item system edited as rarity (rare, epic, legendary) or as the system that you created "upgrade item's" yourself. So that the item is sent to the player with the attributes. the Market(Client 12.xx) delivers the item without any attributes. an auction would be cool because they are rare items or something similar to a market would be cool.

Is there a way to create a gem system for HP, Mana, ML, Magic DMG, etc ... without changing the source? similar to your item upgrade system?

FLP
 
So, i need help to improve my exercise weapons and local trainers, i need the both dont be kicked, the exercise its cool if its gonna be change the color name at the vip list like global, and when in a common trainer monster dont be kicked per about 2 hours its possible to do that?
 
Can u modify exori vis but every time this spell will be casted the creature turns towards monster ? :D
edit:
or player ;p
 
about boss room (12.64)

when 2 guys stand on the tiles
and the first one press the leaver
only the first guy get tped into the room

-- lever to DukeKrule

local config = {
requiredLevel = 0,
daily = true,
roomCenterPosition = Position(33456, 31473, 13),
playerPositions = {
Position(33455, 31493, 13),
Position(33456, 31493, 13),
Position(33457, 31493, 13),
Position(33458, 31493, 13),
Position(33459, 31493, 13)
},
teleportPosition = Position(33456, 31466, 13),
bossPosition = Position(33456, 31473, 13)
}

local leverboss = Action()

function leverboss.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 9825 then
-- Check if the player that pulled the lever is on the correct position
if player:getPosition() ~= config.playerPositions[1] then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can\'t start the battle.")
return true
end

local team, participant = {}

for i = 1, #config.playerPositions do
participant = Tile(config.playerPositions):getTopCreature()

-- Check there is a participant player
if participant and participant:isPlayer() then
-- Check participant level
if participant:getLevel() < config.requiredLevel then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
"All the players need to be level ".. config.requiredLevel .." or higher.")
return true
end

-- Check participant boss timer
if config.daily and participant:getStorageValue(Storage.Kilmaresh.UrmahlulluTimer) > os.time() then
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:sendCancelMessage("Not all players are ready yet from last battle.")
return true
end

team[#team + 1] = participant
end
end

-- Check if a team currently inside the boss room
local specs, spec = Game.getSpectators(config.roomCenterPosition, false, false, 14, 14, 13, 13)
for i = 1, #specs do
spec = specs
if spec:isPlayer() then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "A team is already inside the boss room.")
return true
end

spec:remove()
end

-- Spawn boss
Game.createMonster("Duke krule", config.bossPosition)

-- Teleport team participants
for i = 1, #team do
team:getPosition():sendMagicEffect(CONST_ME_POFF)
team:teleportTo(config.teleportPosition)
-- Assign boss timer
team:setStorageValue(Storage.dark_trails.DukeTimer, os.time() + 4*60*60) -- 4 hours
end

config.teleportPosition:sendMagicEffect(CONST_ME_ENERGYAREA)
end

item:transform(9825)
return true
end

leverboss:aid(65302)
leverboss:register()
 
Status
Not open for further replies.
Back
Top