local types = require('openmw.types')
local core = require('openmw.core')
local I = require('openmw.interfaces')
local self = require('openmw.self')
local util = require('openmw.util')
--local nearby = require('openmw.nearby')
--local camera = require('openmw.camera')

I.AnimationController.addTextKeyHandler('spellcast', function(groupname, key)

    if key.sub(key, #key - 6) == 'release' then
        
      if types.Actor.getSelectedSpell(self).id == "fireball" then
        
        local effect = core.magic.effects.records[core.magic.EFFECT_TYPE.FireDamage].areaStatic
        local model = types.Static.records[effect].model
        
        for i= 1 , 50 do     
          
          local x = 100 * math.cos(math.rad(45)*i)
          local y = 100 * math.sin(math.rad(45)*i)

          local trans = util.transform
          local rotate = trans.rotateZ(self.rotation:getYaw()) * util.vector3(x,20*i,y)
          
          local pos = self.position + util.vector3(0,0,100) + rotate  
           
          core.sendGlobalEvent('SpawnVfx', {model = model, position = pos })
          
        end
      end
    end
end)

image.png