• 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] Multiple Condition Spell

SorketROrk

Well-Known Member
Joined
Oct 14, 2020
Messages
152
Solutions
1
Reaction score
69
Location
Sweden
Hey!

I have been searching for a spell with multiple conditions but dont seem to find any, this is what I would like it to do:

"Exori Gran" That will leave the target with the condition (Bleeding) doing damage over time if target is hit, then add condition (Strong Haste) to the caster.
Would be great if the damage over time is based on player SKILL, but its not a must!

I dont know if this is possible, might as well ask here :) all help is greatly appreciated

Yours,
SRO
 
Hey mate, I don't know much about script, but try this:

data/spells/attack/fierce_berserker

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setParameter(COMBAT_PARAM_USECHARGES, true)
combat:setArea(createCombatArea(AREA_SQUARE1X1))

function onGetFormulaValues(player, skill, attack, factor)
    local min = (player:getLevel() / 5) + (skill * attack * 0.06) + 13
    local max = (player:getLevel() / 5) + (skill * attack * 0.11) + 27
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

local function getHighestSkillLevel(creature)
    local skillLevel = -1
    for skillType = SKILL_CLUB, SKILL_AXE do
        if skillLevel < creature:getEffectiveSkillLevel(skillType) then
            skillLevel = creature:getEffectiveSkillLevel(skillType)
        end
    end
    return skillLevel
end

function onCastSpell(creature, variant)
    local skill = getHighestSkillLevel(creature)
    local min =  (skill * 0.5) + 5
    local max = (skill * 0.7) + 5
    local damage = math.random(math.floor(min) * 1000, math.floor(max) * 1000) / 1000
    for _, target in ipairs(combat:getTargets(creature, variant)) do
        creature:addDamageCondition(target, CONDITION_BLEEDING, DAMAGELIST_LOGARITHMIC_DAMAGE, target:isPlayer() and damage / 4 or damage)
    end
    return true
end
 
Last edited:
Hey mate, I don't know much about script, but try this to put the bleed condition:

on the spell exori gran, at this function:

Lua:
function onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end

you will change it to:

Code:
function onCastSpell(creature, variant)
        cid:addDamageCondition(Creature(var:getNumber()), CONDITION_BLEEDING, DAMAGELIST_LOGARITHMIC_DAMAGE, 25, CONDITION_PARAM_TICKS, 100)
    return combat:execute(creature, variant)
end

25 is how much damage the bleed will do.

I did not test it, but try it and let me know, I may have other ideas of how to do it.

And the strong haste will only be activated if a target it hit or everytime the player cast exori gran he will receive strong haste?
Hi,

Thanks for replying and trying to help out!

I'm at work right now but I'll make sure to test it when I get home. Also, the idea is for the player to get haste if enemy is hit by the spell of the caster. If this is not possible or you dont know how I would still like to get haste anyhow xD

I've managed to make spells with conditions before, and several conditions at the same time as well, but I can't get haste on caster and leave enemy bleeding :/
 
Hi,

Thanks for replying and trying to help out!

I'm at work right now but I'll make sure to test it when I get home. Also, the idea is for the player to get haste if enemy is hit by the spell of the caster. If this is not possible or you dont know how I would still like to get haste anyhow xD

I've managed to make spells with conditions before, and several conditions at the same time as well, but I can't get haste on caster and leave enemy bleeding :/
I tested what I proposed before and it didn't work, so I made some changes and know it's working and also according to player skill. How much would you like the player to hit? For example, for a player with skill 100, how much would it hit with bleed condition?

I edited the previous post to the correct script with what you asked for.

The haste, I tried and did not work out, I will keep trying and if succed I will let you know.
 
Last edited:
Back
Top