0 then return true else return false end end end local function onActive() caster = 0 end local function onUpdate() if caster == 0 and players(holding) == true then local effe = core.magic.EFFECT_TYPE.FireDamage local static = core.magic.effects.records[effe].hitStatic anim.addVfx(self, types.Static.record(static).model, { boneName = bone, loop = true, vfxId = vfx_name_id }) caster = 1 end if caster == 1 and players(holding) == false then --players("6t"> 0 then return true else return false end end end local function onActive() caster = 0 end local function onUpdate() if caster == 0 and players(holding) == true then local effe = core.magic.EFFECT_TYPE.FireDamage local static = core.magic.effects.records[effe].hitStatic anim.addVfx(self, types.Static.record(static).model, { boneName = bone, loop = true, vfxId = vfx_name_id }) caster = 1 end if caster == 1 and players(holding) == false then --players("6t"> 0 then return true else return false end end end local function onActive() caster = 0 end local function onUpdate() if caster == 0 and players(holding) == true then local effe = core.magic.EFFECT_TYPE.FireDamage local static = core.magic.effects.records[effe].hitStatic anim.addVfx(self, types.Static.record(static).model, { boneName = bone, loop = true, vfxId = vfx_name_id }) caster = 1 end if caster == 1 and players(holding) == false then --players("6t">
local types = require('openmw.types')
local core = require('openmw.core')
local self = require('openmw.self')
local anim = require('openmw.animation')
local nearby = require('openmw.nearby')

local caster --state
local holding = "6th bell hammer"
local vfx_name_id = "scatter"
local bone = ""

local function players(hold)
    local acts = nearby.players
    for a, b in pairs(acts) do
        if types.Actor.inventory(acts[a]):countOf(hold) > 0 then
          return true
        else
          return false
        end
    end  
end

local function onActive()
  caster = 0
end

local function onUpdate()
    if caster == 0 and players(holding) == true then
       local effe = core.magic.EFFECT_TYPE.FireDamage
       local static = core.magic.effects.records[effe].hitStatic
       anim.addVfx(self, types.Static.record(static).model, { boneName = bone, loop = true, vfxId = vfx_name_id })
       caster = 1
    end              
    if caster == 1 and players(holding) == false then --players("6th bell hammer") == false then
        print("no")
        anim.removeVfx(self, vfx_name_id)
        caster = 0
    end
end

local function onInactive()
    anim.removeVfx(self, vfx_name_id)
end

return { engineHandlers = { onActive = onActive, onInactive = onInactive, onUpdate = onUpdate} }