• 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,422
Solutions
155
Reaction score
1,985
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:
I would like a script that gives bonus EXP for each connected MC (with a maximum of 4 mcs)
tfs 1.3

OPTION 1 (eventcallbacks):

open the file: data/scripts/eventcallbacks/players/default_onGainExperience.lua
above this code snippet: return exp paste the following code:
Lua:
exp = exp * (1 + (math.min(4, #getPlayersByIPAddress(player:getIp())) -1 * 0.10))

in such a way that it looks like this:
1612343778987.png

OPTION 2 (classic events):

If you don't use event callbacks, then go to this file: data/events/scripts/players.lua
and you do the same procedure mentioned above
If you are following these steps, then look for the function: function Player:onGainExperience(source, exp, rawExp)
and the code you need to paste now is:
Lua:
exp = exp * (1 + (math.min(4, #getPlayersByIPAddress(self:getIp())) -1 * 0.10))
in such a way that it looks like this:
1612343982572.png

-----------------------------------------------------------------------------------------------------------------------
Note: i not add a configuration table, because it is not necessary, it is only a line of code, easy to edit, as you can see, the number 4 is the maximum number of MC, and the number 0.10, is the extra amount of experience for each MC

GIF 03-02-2021 05-23-32 a. m..gif
 
Hi, thanks for doing this! much appreciated!

So i would like to ask for a spell, that does so:
-Summons a creature
-Summon can be killed by players and monsters
-If the summon is killed by player or monster he explodes and doesnt deal any damage to the surrounding players (but does to the monsters)(area of explosion is 1 sqm around the summon)
-Summon upon reaching the target explodes(dies) and deals x amount of dmg (monsters and targeted player(only to targeted player) )
-Summon doesnt deal any other damage than explosion upon dying.
-Damage calculated based on player level and magic lvl.

If you decide to even create this spells, here are some additional, probably more time consuming features of this spell, perhaps u would be so kind to also add them , if not then its all good and im grateful anyway.
-Summons health is the % health of the player that summons it.
-Summons movement speed is 1.5x greater than the player that summons it.
-Summon follows u even if u change floor
-Summon teleports back to the player if he lost the player from the screen.

Thank you in advance.
Hi @Sopago
It's probably not exactly what you wanted, I don't know if I understood you correctly, but here is the script as I could understand it

data/scripts/yourscriptname.lua
Lua:
local summonSpellConfig = {
    ["Rat"] = {
        area = createCombatArea(AREA_CIRCLE2X2),
        formula = {
            level = 3,
            magLvl = 2,
            minDmg = 1.2,
            maxDmg = 1.5,
            speed = 1.5
        },
        effect = CONST_ME_FIREAREA,
        combat = COMBAT_FIREDAMAGE
    },
    ["Rotworm"] = {
        area = createCombatArea(AREA_CIRCLE2X2),
        formula = {
            level = 4,
            magLvl = 4,
            minDmg = 1.2,
            maxDmg = 1.5,
            speed = 1.5
        },
        effect = CONST_ME_FIREAREA,
        combat = COMBAT_FIREDAMAGE
    }
}

local cExplosionSummonDie = CreatureEvent("ExplosionSummonDie")
function cExplosionSummonDie.onDeath(creature, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
    local prop = summonSpellConfig[creature:getName()]
    if prop then
        local master = creature:getMaster()
        if master then
            local min = ((master:getLevel() * prop.formula.level) + (master:getMagicLevel() * prop.formula.magLvl)) * prop.formula.minDmg
            local max = ((master:getLevel() * prop.formula.level) + (master:getMagicLevel() * prop.formula.magLvl)) * prop.formula.maxDmg
            doAreaCombatHealth(master:getId(), prop.combat, creature:getPosition(), prop.area, -min, -max, prop.effect, ORIGIN_SPELL)
        end
    end
    return true
end
cExplosionSummonDie:register()

local cExplosionSummonThink = CreatureEvent("ExplosionSummonThink")
function cExplosionSummonThink.onThink(creature, interval, item, position, lastPosition, fromPosition, toPosition)
    local prop = summonSpellConfig[creature:getName()]
    if prop then
        local master = creature:getMaster()
        if master then
            local target = master:getTarget()
            local masterPos = master:getPosition()
            local creaturePos = creature:getPosition()
            if target and target:getPosition():getDistance(creaturePos) <= 1 then
                local min = ((master:getLevel() * prop.formula.level) + (master:getMagicLevel() * prop.formula.magLvl)) * prop.formula.minDmg
                local max = ((master:getLevel() * prop.formula.level) + (master:getMagicLevel() * prop.formula.magLvl)) * prop.formula.maxDmg
                doAreaCombatHealth(master:getId(), prop.combat, creature:getPosition(), prop.area, -min, -max, prop.effect, ORIGIN_SPELL)
                creature:remove()
            elseif creaturePos:getDistance(masterPos) > 7 or creaturePos.z ~= masterPos.z then
                creaturePos:sendMagicEffect(CONST_ME_POFF)
                creature:teleportTo(masterPos)
                masterPos:sendMagicEffect(CONST_ME_TELEPORT)
            end
        end
    end
    return true
end
cExplosionSummonThink:register()

local spell = Spell(SPELL_INSTANT)

function spell.onCastSpell(creature, variant)
    local summons = creature:getSummons()
    if #summons >= 2 then
        creature:sendCancelMessage("You can only have 2 summons maximum.")
        return false
    end
    local monsterName = variant:getString()
    local prop = summonSpellConfig[monsterName]
    if prop then
        local monster = Game.createMonster(monsterName, creature:getPosition())
        if monster then
            monster:registerEvent("ExplosionSummonDie")
            monster:registerEvent("ExplosionSummonThink")
            monster:changeSpeed(creature:getBaseSpeed() * prop.formula.speed)
            local maxHp = creature:getMaxHealth()
            monster:setMaxHealth(maxHp)
            monster:addHealth(maxHp)
            creature:addSummon(monster)
            return true
        end
        creature:sendCancelMessage(RETURNVALUE_NOTENOUGHROOM)
        return false
    end
    creature:sendCancelMessage("Summon name does not exist.")
    return false
end

spell:name("Summon Bomb Spell")
spell:words("make bomb")
spell:hasParams(true)
spell:group("attack")
spell:vocation("sorcerer", "master sorecerer")
spell:id(1)
spell:cooldown(1000)
spell:level(200)
spell:range(6)
spell:manaPercent(13)
spell:isPremium(true)
spell:register()
In this example I used a Rat and a Rotworm as explosive summons, but you must have your own custom monsters which will use this script.
You can try executing the spell make bomb" Rat or make bomb" Rotworm, in the configuration each one of them has different properties, such as the formula of the damage and the affected area and or effects.

GIF 03-02-2021 04-26-22 p. m..gifGIF 03-02-2021 04-29-48 p. m..gif
 
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
 
OP is not taking more requests.

 
I need that when killing a monster it explodes or generates an explosion when it dies, second that a monster heals a boss if it is killed near the same, If you need more explanation, let me know
Post automatically merged:

I need that when killing a monster it explodes or generates an explosion when it dies, second that a monster heals a boss if it is killed near the same, If you need more explanation, let me know
 
Hi Sarah,

I need a spell that ricochet the damage on mobs closer to the main target.
if possible to make configurable like this;
Lua:
distanceEffect = 30
damageType = COMBAT_PHYSICALDAMAGE
ricochetChance = 20%
IncreaseRicochetWithSkill = +1 mob each +20 skill


ehh, maybe i asked a little bit to much, but i hope you can help me with this one XD
 
Hello, I've been looking for a script that when you kill a specific type of monster, it will give a chance of spawning another for its respective type of monster. As an example: you kill a dragon, there is a small chance of spawning a dragon miniboss, or you kill a dragon lord, there is a chance of spawning a dragon lord miniboss

Hope you can help me out with this one.
 
hello, I would need a spell that, when used on an opponent, takes him to certain positions on the map and returns with him in five seconds, thank you very much for your attention, best regards.
 
I need that when killing a monster it explodes or generates an explosion when it dies, second that a monster heals a boss if it is killed near the same, If you need more explanation, let me know
Post automatically merged:
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
 
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

thk

Sarah Wesker

 
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

:/
:(
 
Hi Sarah,

I need a spell that ricochet the damage on mobs closer to the main target.
if possible to make configurable like this;
Lua:
distanceEffect = 30
damageType = COMBAT_PHYSICALDAMAGE
ricochetChance = 20%
IncreaseRicochetWithSkill = +1 mob each +20 skill


ehh, maybe i asked a little bit to much, but i hope you can help me with this one XD

Hi @Niloahs
⚡ Bounce Spell ⚡

GIF 03-02-2021 12-46-19 a. m..gif
In this visual example, you can see when the spell gets all hits, this will depend on the chance you set
Note: I'm not sure if it is exactly what you ordered, I hope so
 
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! 👍
Hi, thanks for doing this! much appreciated!

So i would like to ask for a spell, that does so:
-Summons a creature
-Summon can be killed by players and monsters
-If the summon is killed by player or monster he explodes and doesnt deal any damage to the surrounding players (but does to the monsters)(area of explosion is 1 sqm around the summon)
-Summon upon reaching the target explodes(dies) and deals x amount of dmg (monsters and targeted player(only to targeted player) )
-Summon doesnt deal any other damage than explosion upon dying.
-Damage calculated based on player level and magic lvl.

If you decide to even create this spells, here are some additional, probably more time consuming features of this spell, perhaps u would be so kind to also add them , if not then its all good and im grateful anyway.
-Summons health is the % health of the player that summons it.
-Summons movement speed is 1.5x greater than the player that summons it.
-Summon follows u even if u change floor
-Summon teleports back to the player if he lost the player from the screen.

Thank you in advance.
 
Last edited:
Hey good morning (or evening). If u want help me am gonna be very happy man:
Actually I tried to edit existing script with stats, by adding more options like attackspeed etc. (with options to modal)
But my skill right now is not that much for this and I always end with errors in console
Can u add to this script some options like attackspeed (-1%) and dmg reduction (+1%)?
I have done adding attackspeed .lua function to server.
Can u help me? <3

The script:
 
Hello, I've been looking for a script that when you kill a specific type of monster, it will give a chance of spawning another for its respective type of monster. As an example: you kill a dragon, there is a small chance of spawning a dragon miniboss, or you kill a dragon lord, there is a chance of spawning a dragon lord miniboss

Hope you can help me out with this one.
What you ask is not very specific, however it is quite simple ...

When I read your publication, i imagine more things than you have asked, however those things require changes in the sources to be viable, the truth would have been beautiful, unfortunately in my publication I mentioned that I will not make changes in the sources.

Anyway, I made you a small script which generates a monster of the same type with an increased amount of life, when generated, an explosion effect is sent to give it a more dramatic touch.

data/scripts/yourscriptname.lua
Lua:
local spawnbosses = {
    ["Rotworm"] = {
        chance = 50,
        bossName = "Demon" -- i use Demon only for test
    },
    ["Dragon"] = {
        chance = 50,
        bossName = "Dragon Boss"
    }
}

local cSpawnBossWhenDie = CreatureEvent("SpawnBossWhenDie")
function cSpawnBossWhenDie.onDeath(creature, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
    local prop = spawnbosses[creature:getName()]
    if prop and math.random(100) <= prop.chance then
        Game.createMonster(prop.bossName, creature:getPosition())
    end
    return true
end
cSpawnBossWhenDie:register()

local ev = EventCallback
function ev.onTargetCombat(creature, target)
    if creature:isPlayer() and target:isMonster() and spawnbosses[target:getName()] then
        target:registerEvent("SpawnBossWhenDie")
    end
    return RETURNVALUE_NOERROR
end

GIF 03-02-2021 04-17-11 a. m..gif

Normally what would be expected of a miniboss is that it has: name, damage and other different properties, but without changes in the sources it is not possible, only the health per default, I hope this script will help you, or at least as an example, maybe for the next round you can imagine something that is more within reach ;)
Post automatically merged:

hello, I would need a spell that, when used on an opponent, takes him to certain positions on the map and returns with him in five seconds, thank you very much for your attention, best regards.
Hi @Restles
I hope this is enough, thanks for participating

data/scripts/yourscriptname.lua
Lua:
local spellTpConfig = {
    toPositions = {
        Position(3127, 1802, 7),
        Position(3128, 1807, 7),
        Position(3131, 1807, 7)
    },
    interval = 5 * 1000 -- 5 seconds
}

local spell = Spell(SPELL_INSTANT)

function spell.onCastSpell(creature, variant)
    local tid = variant:getNumber()
    local target = Creature(tid)
    local afterPos = target:getPosition()
    creature:getPosition():sendDistanceEffect(afterPos, CONST_ANI_ENERGY)
    afterPos:sendMagicEffect(CONST_ME_POFF)
    target:teleportTo(spellTpConfig.toPosition)
    spellTpConfig.toPosition:sendMagicEffect(CONST_ME_TELEPORT)
    addEvent(function(tid, afterPos)
        local target = Creature(tid)
        if target then
            target:getPosition():sendMagicEffect(CONST_ME_POFF)
            target:teleportTo(afterPos)
            afterPos:sendMagicEffect(CONST_ME_TELEPORT)
        end
    end, spellTpConfig.interval, tid, afterPos)
    return true
end

spell:name("Teleport Spell")
spell:words("exuna tp")
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 03-02-2021 04-32-04 a. m..gif

In the configuration you can add all the positions you want, in this example I use a position quite close to the target, but it works at any distance, the time can also be configured.
 
Last edited:
Status
Not open for further replies.
Back
Top