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