Yan18
Member
- Joined
- Jun 14, 2014
- Messages
- 104
- Solutions
- 3
- Reaction score
- 17
Hello Guys!
I created a spell in area that depending on the direction, will change the area and effect. When I use the spell, generate this error:
My Spell script:
I tried to put the local variables area inside the function onCastSpell(), but the error remains.
I created a spell in area that depending on the direction, will change the area and effect. When I use the spell, generate this error:
Bash:
LuaScriptInterface::luaCreateCombatArea(). This function can only be used while loading the script.
stack traceback:
[C]: in function 'createCombatArea'
My Spell script:
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setFormula(COMBAT_FORMULA_DAMAGE, -1, -250, -1, -450)
local area_north = createCombatArea(AREA_NORTH)
local area_east = createCombatArea(AREA_EAST)
local area_south = createCombatArea(AREA_SOUTH)
local area_west = createCombatArea(AREA_WEST)
local spell = Spell(SPELL_INSTANT)
function spell.onCastSpell(creature, variant)
if creature:getDirection() == NORTH then
creature:getPosition():sendMagicEffect(187)
combat:setArea(area_north)
elseif creature:getDirection() == EAST then
creature:getPosition():sendMagicEffect(188)
combat:setArea(area_east)
elseif creature:getDirection() == SOUTH then
creature:getPosition():sendMagicEffect(189)
combat:setArea(area_south)
elseif creature:getDirection() == WEST then
creature:getPosition():sendMagicEffect(190)
combat:setArea(area_west)
end
return combat:execute(creature, variant)
end
spell:group("attack")
spell:id(2004)
spell:name("Sper")
spell:words("Sper")
spell:level(50)
spell:mana(100)
spell:isPremium(false)
spell:range(1)
spell:needCasterTargetOrDirection(false)
spell:isBlockingWalls(true)
spell:cooldown(8000)
spell:groupCooldown(8000)
spell:needLearn(false)
spell:vocation("sorcerer;true", "druid;true", "master sorcerer", "elder druid")
spell:register()
I tried to put the local variables area inside the function onCastSpell(), but the error remains.