[SOLVED BY Andu, SEE BELOW FOR SOLUTION]
So I found a nice script here on OTland by Codinablack for an AoE spell that does instant damage AND adds a condition to the target. The script is as follows:
Again, this script works perfect. Using it in-game creates a black smoke wave that does instant death damage and curses the target for 20 turns, doing damage every 1.5 seconds. I liked the spell, so I decided to make another one, but poison style this time. I made another script, literally copy and pasted my working one and then edited the magic effect, damage type:
Once I had this script created, I made sure to add it into spells.xml, then I tested it out. When I used it in-game, the spell graphically was correct. A radius 3 AoE bomb of insects. Whatever the spell hit took instant damage, BUT WAS NOT POISONED. I thought I made a mistake in the lua script, double checked it, re-copy and pasted it, double checked spells.xml, all normal. Same issue.
Then, I tried something: I deleted the first spell, the death/curse one, the working one. Then I restarted the server, and tried the poison spell. It worked. I re-added the death spell, restarted the server, and the death spell worked, but the poison did not.
I have no idea why, but it seems as though something is not allowing me to have more than 1 of this type of spell. I know my code/script for the spells themselves are fine because when I have only one added, they both work perfectly. It's when I have both that only one fully works (by fully working I mean it adds the condition to the target).
Also, I'm not getting any errors coming up in the CMD window, and I haven't exceeded the maximum number of allowed spells. Again, as it says in the title, TFS 1.0.
Thanks
So I found a nice script here on OTland by Codinablack for an AoE spell that does instant damage AND adds a condition to the target. The script is as follows:
Code:
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_BLACKSMOKE)
local area = createCombatArea(AREA_WAVE2)
combat:setArea(area)
local condition = Condition(CONDITION_CURSED)
condition:setTicks(40000)
condition:setParameter(CONDITION_PARAM_DELAYED, 1)
condition:setParameter(CONDITION_PARAM_TICKINTERVAL, 1500)
function onGetFormulaValues(cid, level, maglevel)
min = -((level / 5) + (maglevel * 3) + 5)
max = -((level / 5) + (maglevel * 4) + 7)
return min, max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function CastSpell(cid, var)
local player = Player(cid)
local level = player:getLevel()
local maglevel = player:getMagicLevel()
min = -((level / 5) + (maglevel * 0.5) + 5)
max = -((level / 5) + (maglevel * 0.9) + 7)
condition:setParameter(CONDITION_PARAM_PERIODICDAMAGE, math.random(min,max))
combat:setCondition(condition)
end
function onCastSpell(creature, var)
CastSpell(creature:getId(), var)
return combat:execute(creature, var)
end
Again, this script works perfect. Using it in-game creates a black smoke wave that does instant death damage and curses the target for 20 turns, doing damage every 1.5 seconds. I liked the spell, so I decided to make another one, but poison style this time. I made another script, literally copy and pasted my working one and then edited the magic effect, damage type:
Code:
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_INSECTS)
local area = createCombatArea(AREA_CIRCLE3X3)
combat:setArea(area)
local condition = Condition(CONDITION_POISON)
condition:setTicks(40000)
condition:setParameter(CONDITION_PARAM_DELAYED, 1)
condition:setParameter(CONDITION_PARAM_TICKINTERVAL, 1500)
function onGetFormulaValues(cid, level, maglevel)
min = -((level / 5) + (maglevel * 3) + 5)
max = -((level / 5) + (maglevel * 4) + 7)
return min, max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function CastSpell(cid, var)
local player = Player(cid)
local level = player:getLevel()
local maglevel = player:getMagicLevel()
min = -((level / 5) + (maglevel * 0.5) + 5)
max = -((level / 5) + (maglevel * 0.9) + 7)
condition:setParameter(CONDITION_PARAM_PERIODICDAMAGE, math.random(min,max))
combat:setCondition(condition)
end
function onCastSpell(creature, var)
CastSpell(creature:getId(), var)
return combat:execute(creature, var)
end
Once I had this script created, I made sure to add it into spells.xml, then I tested it out. When I used it in-game, the spell graphically was correct. A radius 3 AoE bomb of insects. Whatever the spell hit took instant damage, BUT WAS NOT POISONED. I thought I made a mistake in the lua script, double checked it, re-copy and pasted it, double checked spells.xml, all normal. Same issue.
Then, I tried something: I deleted the first spell, the death/curse one, the working one. Then I restarted the server, and tried the poison spell. It worked. I re-added the death spell, restarted the server, and the death spell worked, but the poison did not.
I have no idea why, but it seems as though something is not allowing me to have more than 1 of this type of spell. I know my code/script for the spells themselves are fine because when I have only one added, they both work perfectly. It's when I have both that only one fully works (by fully working I mean it adds the condition to the target).
Also, I'm not getting any errors coming up in the CMD window, and I haven't exceeded the maximum number of allowed spells. Again, as it says in the title, TFS 1.0.
Thanks
Last edited: