- this summons vfx while some player have certain item in their inventory
- the placed pos depends on mwscripts holding
local types = require('openmw.types')
local core = require('openmw.core')
local util = require('openmw.util')
local self = require('openmw.self')
local nearby = require('openmw.nearby')
local holding = "6th bell hammer"
local vfx_name = "scatter"
local run
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 onUpdate()
local effe = core.magic.EFFECT_TYPE.FireDamage
local static = core.magic.effects.records[effe].hitStatic
local pos = self.position
if players(holding) == true and self.controls.movement > 0 then
core.sendGlobalEvent('SpawnVfx', {
model = types.Static.record(static).model,
position = pos + util.vector3(0,0,-20),
options = { vfxId = vfx_name }})
else
core.sendGlobalEvent('RemoveVfx', vfx_name)
end
end
return { engineHandlers = { onUpdate = onUpdate} }