drakylucas
Intermediate OT User
- Joined
- Dec 15, 2015
- Messages
- 236
- Solutions
- 7
- Reaction score
- 121
Hello guys, I'm editing this topic since I solved some of problems that I had describe.
My last doubt (I guess): How I can dynamically change the spell area?
this is my current spell (for monster):
The problem is: I can't use combat:setArea inside onCastSpell, because the TFS needs to load it before the execution of the spell (I get an error if I try to use it inside onCastSpell), and this
is executing just 1 time, so all times the spell that should be dynamic is having the same area.
Thanks
My last doubt (I guess): How I can dynamically change the spell area?
this is my current spell (for monster):
Code:
local areas = {AREA_CROSS1X1, AREA_SQUARE1X1}
local area = areas[math.random(1,#areas)]
local combat = Combat()
local combat2 = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setArea(createCombatArea(area))
combat2:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat2:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat2:setArea(createCombatArea(area))
combat2:setFormula(COMBAT_FORMULA_DAMAGE,-10000, 0, -50000, 0)
local function executeSpell(n, creature, variant)
if(Creature(creature)) then
print("Test - n = "..n)
variant.pos = Creature(creature):getPosition()
if(n < 3) then
combat:execute(creature, variant)
return addEvent(executeSpell,800, n+1, creature, variant)
else
return combat2:execute(creature,variant)
end
end
end
function onCastSpell(creature, variant)
return executeSpell(1, creature:getId(),variant)
end
The problem is: I can't use combat:setArea inside onCastSpell, because the TFS needs to load it before the execution of the spell (I get an error if I try to use it inside onCastSpell), and this
Code:
local area = areas[math.random(1,#areas)]
Thanks
Last edited: