SixNine
Active Member
- Joined
- Dec 12, 2018
- Messages
- 452
- Reaction score
- 41
So this spell was casted by creature and i noticed that it gave error. Is it because its made for players not for monsters to cast?
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
combat:setArea(createCombatArea(AREA_BEAM5))
function onGetFormulaValues(player, level, maglevel)
local min = (level * 30) + (maglevel * 130.5) + 25
local max = (level * 30) + (maglevel * 140) + 50
return -min, -max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
local player = Player(cid)
local playerPos = player:getPosition()
local playerDir = player:getDirection()
if playerDir == NORTH then
Position(playerPos.x, playerPos.y - 1, playerPos.z):sendMagicEffect(130)
elseif playerDir == SOUTH then
Position(playerPos.x, playerPos.y + 5, playerPos.z):sendMagicEffect(130)
elseif playerDir == WEST then
Position(playerPos.x - 1, playerPos.y, playerPos.z):sendMagicEffect(129)
elseif playerDir == EAST then
Position(playerPos.x + 5, playerPos.y, playerPos.z):sendMagicEffect(129)
end
return combat:execute(cid, var)
end[/cpde]