Watchdog87
Member
- Joined
- Mar 2, 2014
- Messages
- 30
- Solutions
- 1
- Reaction score
- 5
Hello! I have a problem with a script. I'm trying to make a spell execute in the direction the character is facing. I did not create this script, I took it from somewhere on these forums.
It works but only for 1 tile and doesn't work for the whole area of what is stated in combat:setArea. I tested changing
to
and it did work but only for 1 or 2 directions, so I need a way to make "CONST_ME_NONE" reflect to whatever direction the execution gives.
I hope I made sense, thanks in advance!
It works but only for 1 tile and doesn't work for the whole area of what is stated in combat:setArea. I tested changing
Code:
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_NONE)
Code:
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
I hope I made sense, thanks in advance!
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_NONE)
combat:setFormula(COMBAT_FORMULA_DAMAGE, 0, -100, 0, -200)
combat:setArea(createCombatArea(AREA_SQUAREWAVE5, AREADIAGONAL_SQUAREWAVE5))
local effect = {
[DIRECTION_NORTH] = CONST_ME_FIREAREA,
[DIRECTION_EAST] = CONST_ME_ENERGYHIT,
[DIRECTION_SOUTH] = CONST_ME_MORTAREA,
[DIRECTION_WEST] = CONST_ME_POISONAREA
}
function onCastSpell(creature, variant)
creature:getPosition():sendMagicEffect(effect[creature:getDirection()])
return combat:execute(creature, variant)
end