• 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,408
Solutions
154
Reaction score
1,958
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:
all damage that the boss on the second floor receives the boss on the first floor will receive the same damage
Hi @alcapone

data/scripts/yourscriptname.lua
Lua:
local config = {
    {
        bossName = "Demon",
        bossPosition = Position(3151, 1857, 7)
    }
}

local function doCombat(cid, boss, combatType, damage)
    doTargetCombatHealth(cid, boss, combatType, -damage, -damage, CONST_ME_NONE, ORIGIN_SPELL)
end

local bossEvent = CreatureEvent("BossEventReceiveDmg")
function bossEvent.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    for _, info in pairs(config) do
        local foundBoss = Monster(info.foundBoss)
        if foundBoss then
            doCombat(attacker:getId(), foundBoss, primaryType, primaryDamage)
        else
            local spectators = Game.getSpectators(info.bossPosition, false, false, 7, 7, 7, 7)
            for __, spectator in pairs(spectators) do
                if spectator ~= creature then
                    if spectator:getName() == info.bossName then
                        doCombat(attacker:getId(), spectator, primaryType, primaryDamage)
                        info.foundBoss = spectator:getId()
                        break
                    end
                end
            end
        end
    end
    return primaryDamage, primaryType, secondaryDamage, secondaryType
end
bossEvent:register()
GIF 08-02-2021 06-14-27 a. m..gif
Make sure you configure the script correctly, the boss cannot be very close to each other, at least 7 sqm apart or failing that, on another floor z
Remember to register the event in the main boss, since this is the one that will be in charge of distributing the damage to the other bosses configured in the list
 
What about upgrade script that will affect spell formula? Ex.
  • using cmd open modal window like !spellupg
  • then in modal window You will have configured spell's that can add depend on vocation Like mage will have Exura Vita, pally Exura San and etc.
  • every upgrade level will have stages and upgrade level's like Stage 1 [0/100] then after reach 100 upgrade levels it hit Stage 2 and need other item to upgrade.
  • Need it to affect only spell formula.
 
Hey there, how about a daily chest that gives x item on Monday, x item on Tuesday etc with possibility to choose from item/exp :)
 
Hi,

Could you make a spell that changes casters outfit to a panda, and also set the vocation id from 1 to 2 while the panda outfit is active, and restore vocation id to 1 after x seconds?

If possible, it would be great to have increased HP/MANA Regeneration or Movement Speed increase while in panda form!


I hope you can achieve this :)

Yours,
SRO
 
Hi @S p i d i

I'm sorry I didn't answer you, what happens is that what you ask requires a modification in the sources, if it is as I am thinking, and if it is otherwise, it would even require code on the client side, for know where the position of mouse.

and assuming you ask for it is something like the command /cliport, changes are also required in the fonts, if you don't mind you can write something else that meets the requirements and I will gladly help you.

maybe for TFS 1.4 version if we can make /cliport programmed from lua, with the implementation of onParsePacket() in creaturescripts.
No worries Sarah , sorry i didnt know it was that much of a hussle, i hope my next request will be acceptable: I would like a spell that makes the player not miss any melee hits for 30 seconds after its use , also each 3 hits the third hit should be critical (for example 100% damage bonus)
 
No worries Sarah , sorry i didnt know it was that much of a hussle, i hope my next request will be acceptable: I would like a spell that makes the player not miss any melee hits for 30 seconds after its use , also each 3 hits the third hit should be critical (for example 100% damage bonus)
You are again requesting source changes.
 
hello, could you make me a boss points system? killing a boss (configurable) earns one point, when the player has 20 points he gains 10% exp for 12 hours. thanks
 
Hello everyone, I no longer accept any more applications, because I do not have more time for this.
however I will accept the previous publications. dont worry ;)
Note: if at any other time I am available for this again, I will inform you right here.
Post automatically merged:

Perhaps i have something in my opinion more challenging? idk so i need a spell(exevo vis hur range) but each consecutive third hit on the target will add a bonus damage of 50%, so you hit player once , then second time and then miss and then hit the target there is no bonus damage. I also think this needs to be related to the player? because if he runs out of screen and come back the spell still needs to count those hits? Also its up to you if u want to incorporate this with monsters as well.
Hi @Arthasek

data/scripts/yourscriptname.lua
Lua:
local combats = {}
local spellConfig = {
    combat = COMBAT_DEATHDAMAGE,
    distanceEffect = CONST_ANI_SUDDENDEATH,
    effect = CONST_ME_MORTAREA,
    increment = {
        hits = 3,
        bonus = 50
    },
    players = {}
}

for i = 1, 2 do
    combats[i] = Combat()
    combats[i]:setParameter(COMBAT_PARAM_TYPE, spellConfig.combat)
    combats[i]:setParameter(COMBAT_PARAM_EFFECT, spellConfig.effect)
    combats[i]:setParameter(COMBAT_PARAM_DISTANCEEFFECT, spellConfig.distanceEffect)

    function onGetFormulaValues(player, level, magicLevel)
        local multiplier = (100 + (spellConfig.increment.bonus * i-1)) / 100
        local min = ((level / 5) + (magicLevel * 3.2)) * multiplier
        local max = ((level / 5) + (magicLevel * 3.5)) * multiplier
        return -min, -max
    end
    combats[i]:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
end

local spell = Spell(SPELL_INSTANT)

function spell.onCastSpell(creature, variant)
    local target = Creature(variant:getNumber())
    if target then
        local cid = creature:getId()
        local tid = target:getId()
        local list = spellConfig.players[cid]
        if not spellConfig.players[cid] or not spellConfig.players[cid][tid] then
            spellConfig.players[cid] = {[tid] = 1}
            return combats[1]:execute(creature, variant)
        end
        if spellConfig.players[cid][tid] < spellConfig.increment.hits-1 then
            spellConfig.players[cid][tid] = spellConfig.players[cid][tid] +1
            return combats[1]:execute(creature, variant)
        else
            spellConfig.players[cid][tid] = 0
            return combats[2]:execute(creature, variant)
        end
    end
    return false
end

spell:name("Bonus Spell")
spell:words("exuna boom")
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 09-02-2021 02-13-43 a. m..gif

after the second hit the next hit will be bonus with a damage increase
If you change your target the counter resets, therefore you cannot accumulate 2 hits to many targets and then land a third attack on each one
 
Last edited:
Thanks Sarah , just one question cuz in my mind it was exevo vis hur as spell range , not a targetable spell , if i change this to Exevis vis hur and i miss the target (i cast exevo vis hur but not hit the player) will the counter reset then? cuz itwas my initial idea:D thanks a lot anyway!
 
Thanks for your review, the problem is solved!
Post automatically merged:


Hi @robert100

OPTION 1 (eventcallbacks):
open the file: data/scripts/eventcallbacks/player/default_onGainExperience.lua

look for this code: local ev = EventCallback
now above this code you are going to paste the following:
Lua:
local expOnlineBonus = {
    [{5, 19}] = 5,
    [{20, 49}] = 10,
    [{50, 99}] = 15,
    [{100, 249}] = 20,
    [{250, 399}] = 25,
    [{400}] = 30
}
table.sort(expOnlineBonus, function(a, b) return a > b end)

look for this code: return exp is most likely at the end of this file.
now above this code you are going to paste the following:
Lua:
    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

OPTION 2 (classic events):
open the file: data/events/scripts/player.lua
look for this code: function Player:onGainExperience(source, exp, rawExp) is most likely at the end of this file.
now above this code you are going to paste the following:
Lua:
local expOnlineBonus = {
    [{5, 19}] = 5,
    [{20, 49}] = 10,
    [{50, 99}] = 15,
    [{100, 249}] = 20,
    [{250, 399}] = 25,
    [{400}] = 30
}
table.sort(expOnlineBonus, function(a, b) return a > b end)
look for this code: return exp is most likely at the end of this file.
View attachment 54536
now above this code you are going to paste the following:
Lua:
    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

View attachment 54537
Post automatically merged:


Hi @jacqen

data/scripts/yourscriptname.lua
Lua:
local outfitBonus = {
    [137] = { -- Hunter
        addons = 3, -- Require Addon
        [370] = {
            hp = 1,
            mp = 1,
            skill = {CONDITION_PARAM_SKILL_AXE, 1}
        },
        [368] = {
            hp = 2,
            mp = 2,
            skill = {CONDITION_PARAM_SKILL_AXE, 2}
        }
    },
    [138] = { -- Mage
        addons = 3, -- Require Addon
        [368] = {
            hp = 1, -- in %
            mp = 1, -- in %
            skill = {CONDITION_PARAM_SKILL_SWORD, 1}
        }
    }
}

local ev = EventCallback
function ev.onChangeOutfit(creature, outfit)
    local currentOutfit = creature:getOutfit()
    local bonus = outfitBonus[currentOutfit.lookType]
    if bonus and currentOutfit.lookAddons >= bonus.addons then
        local mount = bonus[currentOutfit.lookMount]
        if mount then
            creature:removeCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, 500 + currentOutfit.lookMount, true)
            creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
        end
    end
    local bonus = outfitBonus[outfit.lookType]
    if bonus and outfit.lookAddons >= bonus.addons then
        local mount = bonus[outfit.lookMount]
        if mount then
            local condition = Condition(CONDITION_ATTRIBUTES)
            condition:setParameter(CONDITION_PARAM_TICKS, -1)
            condition:setParameter(CONDITION_PARAM_SUBID, 500 + outfit.lookMount)
            if mount.hp then
                condition:setParameter(CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, 100 + mount.hp)
            end
            if mount.mp then
                condition:setParameter(CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT, 100 + mount.mp)
            end
            if mount.skill then
                condition:setParameter(mount.skill[1], mount.skill[2])
            end
            creature:addCondition(condition)
            creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
    end
    return true
end

Next I will show you a visual example of how it looks when you get the bonus and when you lose it due to lack of requirements
View attachment 54538

In the configuration table you can configure bonuses for each outfit, and each outfit can have its combination with a different mount, in such a way that each mount in conjunction with your outfit can give you different bonuses
how would it look for classic event?
 
can you create curses for one quest? ex: have 30% chance to curse the player with one curse below:

1: -5% hp each 10sec;

2: if you kill one creature in one area with corners(X, Y) has a chance to spawn one creature closer you.

3: if you attack one creature, has a chance in the last hit, the creature heal himself complete.

4: if you kill one certain number of creature, you have a 50% chance to kill himself

if the player stay more long time wich 30min with one curse, he will killed.

thank you <3

it's equal to curse of Soul War? or adapted? your choice
 
can you create curses for one quest? ex: have 30% chance to curse the player with one curse below:

1: -5% hp each 10sec;

2: if you kill one creature in one area with corners(X, Y) has a chance to spawn one creature closer you.

3: if you attack one creature, has a chance in the last hit, the creature heal himself complete.

4: if you kill one certain number of creature, you have a 50% chance to kill himself

if the player stay more long time wich 30min with one curse, he will killed.

thank you <3

it's equal to curse of Soul War? or adapted? your choice
Hello everyone, I no longer accept any more applications, because I do not have more time for this.
however I will accept the previous publications. dont worry ;)
Note: if at any other time I am available for this again, I will inform you right here.
See quote above
 
Last edited:
Thanks for your review, the problem is solved!
Post automatically merged:


Hi @robert100

OPTION 1 (eventcallbacks):
open the file: data/scripts/eventcallbacks/player/default_onGainExperience.lua

look for this code: local ev = EventCallback
now above this code you are going to paste the following:
Lua:
local expOnlineBonus = {
    [{5, 19}] = 5,
    [{20, 49}] = 10,
    [{50, 99}] = 15,
    [{100, 249}] = 20,
    [{250, 399}] = 25,
    [{400}] = 30
}
table.sort(expOnlineBonus, function(a, b) return a > b end)

look for this code: return exp is most likely at the end of this file.
now above this code you are going to paste the following:
Lua:
    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

OPTION 2 (classic events):
open the file: data/events/scripts/player.lua
look for this code: function Player:onGainExperience(source, exp, rawExp) is most likely at the end of this file.
now above this code you are going to paste the following:
Lua:
local expOnlineBonus = {
    [{5, 19}] = 5,
    [{20, 49}] = 10,
    [{50, 99}] = 15,
    [{100, 249}] = 20,
    [{250, 399}] = 25,
    [{400}] = 30
}
table.sort(expOnlineBonus, function(a, b) return a > b end)
look for this code: return exp is most likely at the end of this file.
View attachment 54536
now above this code you are going to paste the following:
Lua:
    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

View attachment 54537
Post automatically merged:


Hi @jacqen

data/scripts/yourscriptname.lua
Lua:
local outfitBonus = {
    [137] = { -- Hunter
        addons = 3, -- Require Addon
        [370] = {
            hp = 1,
            mp = 1,
            skill = {CONDITION_PARAM_SKILL_AXE, 1}
        },
        [368] = {
            hp = 2,
            mp = 2,
            skill = {CONDITION_PARAM_SKILL_AXE, 2}
        }
    },
    [138] = { -- Mage
        addons = 3, -- Require Addon
        [368] = {
            hp = 1, -- in %
            mp = 1, -- in %
            skill = {CONDITION_PARAM_SKILL_SWORD, 1}
        }
    }
}

local ev = EventCallback
function ev.onChangeOutfit(creature, outfit)
    local currentOutfit = creature:getOutfit()
    local bonus = outfitBonus[currentOutfit.lookType]
    if bonus and currentOutfit.lookAddons >= bonus.addons then
        local mount = bonus[currentOutfit.lookMount]
        if mount then
            creature:removeCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, 500 + currentOutfit.lookMount, true)
            creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
        end
    end
    local bonus = outfitBonus[outfit.lookType]
    if bonus and outfit.lookAddons >= bonus.addons then
        local mount = bonus[outfit.lookMount]
        if mount then
            local condition = Condition(CONDITION_ATTRIBUTES)
            condition:setParameter(CONDITION_PARAM_TICKS, -1)
            condition:setParameter(CONDITION_PARAM_SUBID, 500 + outfit.lookMount)
            if mount.hp then
                condition:setParameter(CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, 100 + mount.hp)
            end
            if mount.mp then
                condition:setParameter(CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT, 100 + mount.mp)
            end
            if mount.skill then
                condition:setParameter(mount.skill[1], mount.skill[2])
            end
            creature:addCondition(condition)
            creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
    end
    return true
end

Next I will show you a visual example of how it looks when you get the bonus and when you lose it due to lack of requirements
View attachment 54538

In the configuration table you can configure bonuses for each outfit, and each outfit can have its combination with a different mount, in such a way that each mount in conjunction with your outfit can give you different bonuses
How would I make this system with only an addition/removal of the mount bonus? Independent of the player outfit?
 
Hello @Kabo Flow you do not cause me any discomfort, if I did not answer the previous messages it is for the simple fact that they did not meet the requirements that I mentioned in the main post.

When I like your post, it will mean that I am working on it, wait your turn patiently
Ok, I'll keep waiting, thank you
Post automatically merged:

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()

View attachment 54585

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
thank you sorry for asking a lot
 
data/scripts/yourscriptname.lua
Lua:
local explosion = {
    ["Demon"] = {
        area = createCombatArea(AREA_CROSS6X6),
        min = -1000,
        max = -1500,
        effect = CONST_ME_FIREAREA,
        combat = COMBAT_FIREDAMAGE
    }
}
local cExplosionWhenDie = CreatureEvent("ExplosionWhenDie")
function cExplosionWhenDie.onDeath(creature, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
    local prop = explosion[creature:getName()]
    if prop then
        doAreaCombatHealth(creature:getId(), prop.combat, creature:getPosition(), prop.area, prop.min, prop.max, prop.effect, ORIGIN_SPELL)
    end
    return true
end
cExplosionWhenDie:register()
local healing = {
    ["Dragon"] = {
        bossName = "Demon",
        radius = 7,
        min = 1000,
        max = 1500,
        distanceEffect = CONST_ANI_HOLY,
        effect = CONST_ME_MAGIC_BLUE
    }
}
local cHealBossWhenDie = CreatureEvent("HealBossWhenDie")
function cHealBossWhenDie.onDeath(creature, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
    local prop = healing[creature:getName()]
    if prop then
        local creaturePos = creature:getPosition()
        local spectators = Game.getSpectators(creaturePos, false, false, prop.radius, prop.radius, prop.radius, prop.radius)
        for _, spectator in pairs(spectators) do
            if spectator:getName() == prop.bossName then
                bossPosition = spectator:getPosition()
                creaturePos:sendDistanceEffect(bossPosition, prop.distanceEffect)
                spectator:addHealth(math.random(prop.min, prop.max))
                bossPosition:sendMagicEffect(prop.effect)
            end
        end
    end
    return true
end
cHealBossWhenDie:register()
local ev = EventCallback
function ev.onTargetCombat(creature, target)
    if creature:isPlayer() and target:isMonster() then
        if explosion[target:getName()] then
            target:registerEvent("ExplosionWhenDie")
        elseif healing[target:getName()] then
            target:registerEvent("HealBossWhenDie")
        end
    end
    return RETURNVALUE_NOERROR
end

The demon throws an explosion when he dies
The dragon heals the demon when he dies

Use the table explosion to add other explosive monsters
Use the table healing to add other monsters that heal a nearby boss or monster
hello sara i have a mistake

Lua:
Lua Script Error: [Scripts Interface]

D:\crditor y carte\global\data\scripts\creaturescripts\lalocota.lua

LuaScriptInterface::luaCreateCombatArea(). Invalid area table.

stack traceback:

        [C]: in function 'createCombatArea'

        ...lobal\data\scripts\creaturescripts\lalocota.lua:3: in main chunk

        [C]: in function 'reload'

        ...global\data\scripts\talkactions\god\reload.lua:64: in function <...global\data\scripts\talkactions\god\reload.lua:50>


Lua Script Error: [Scripts Interface]

D:\crditor y carte\\global\data\scripts\creaturescripts\lalocota.lua

...lobal\data\scripts\creaturescripts\lalocota.lua:48: attempt to index local 'ev' (a nil value)

stack traceback:

        [C]: in function '__newindex'

        ...lobal\data\scripts\creaturescripts\lalocota.lua:48: in main chunk

        [C]: in function 'reload'

        ...r-global\data\scripts\talkactions\god\reload.lua:64: in function <...global\data\scripts\talkactions\god\reload.lua:50>
 
hi i wanted if you could create a script
I have TheRubyServer base
I wanted to know how to add a quest that gives you a pokemon at the end is by actions ,,,
is a TFS 1.3 base
 
Status
Not open for further replies.
Back
Top