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

Applying negative conditions

Nemphis

Veteran OT User
Joined
Jun 22, 2009
Messages
653
Reaction score
393
Location
Sweden
This is a spell for my druids. Apply poison on target - so simple. I also added subID to the poison so more druids can apply the same poison to the same target or if the same druid have more than one offensive spell that applies poison they both will tick.

It seem to be following a problem I have no idea how to handle. I set up 3 idle monsters that I can apply poison to. As you can see in the script it should tick "poisonDmg" each second for 10 seconds.

Target 1: 10 times.
Target 2: 20 times.
Target 3: 30 times.

Anyone have an idea on whats going on?

TFS 1.2 Forgotten server. 10.98

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_CARNIPHILA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISON)

local condition = Condition(CONDITION_POISON)
condition:setParameter(CONDITION_PARAM_DELAYED, true)

function round(n)
    return n % 1 >= 0.5 and math.ceil(n) or math.floor(n)
end

function onCastSpell(creature, variant)
    local target = Creature(variant:getNumber())
    if target == nil then
        return false
    end
    local subID = (creature:getId())
    local poisonDmg = ((creature:getLevel() * creature:getMagicLevel()) / (creature:getLevel() + creature:getMagicLevel()))
    if poisonDmg > 10 then
        poisonDmg = 10
    end
    condition:setParameter(CONDITION_PARAM_SUBID, subID)
    condition:addDamage(10, 1000, -round(poisonDmg))
    target:addCondition(condition)
    return combat:execute(creature, variant)
end
 
With poison it will not add damage it will just add more ticks afaik (unless you apply poison with higher dmg).
This looks like its what its doing yeah?
 
Lets say i have this spell, Envenom, and i put poison on Terra Strike. With no SubID the strongest poison will take over.

With different subIds they will behave Envenom+Terra Strike poison damage. If two druids do this it will have 4 ticks of different poison damage. It works like intended in this section.

What dont work is that when i poison multiple targets, the next target gets more ticks than intended.
situation 1: First target gets 10 ticks, like it should.
situation 2: first target gets 10 ticks, second 20 ticks.
situation 3: first gets 10, second gets 30, third gets 50 ticks.

These situations is if you apply the same spell to Another creature Before the first runs out


If all target dies or poison eventually stops. I poison 1 target again and its back to 10.
 
Last edited:
Back
Top