Hi, I am using TFS 1.0 and here is the spell script I wrote
The code will execute as long as the player is targetting someone, it does not matter who and it will generate new userdata for that particular target each time. The thing is, it will keep dealing damage to the same monster, even if you have switched the target to someone else (whilst actually maintaing your target, i.e. not unselecting)
I would like someone to help me with this as this is major issue that I could not fix it myself. I want it to deal damage to the other monster, when the player switches its targets
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)
local condition = createConditionObject(CONDITION_FIRE)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 5, 3000, -100)
setCombatCondition(combat, condition)
function onGetFormulaValues(cid, level, maglevel)
min = -((level / 5) + (maglevel * 7.5) + 25)
max = -((level / 5) + (maglevel * 13) + 50)
return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
function repeatSpell()
local target = Player(cid):getTarget()
print(target);
if not target then
print("TARGET NOT FOUND");
return true
end
doCombat(cid, combat, var)
addEvent(repeatSpell, 1000)
end
repeatSpell()
return doCombat(cid, combat, var)
end
The code will execute as long as the player is targetting someone, it does not matter who and it will generate new userdata for that particular target each time. The thing is, it will keep dealing damage to the same monster, even if you have switched the target to someone else (whilst actually maintaing your target, i.e. not unselecting)
I would like someone to help me with this as this is major issue that I could not fix it myself. I want it to deal damage to the other monster, when the player switches its targets