filterSoulGemTarget⚓︎
This event fires when a soul gem target is filtered
--- @param e filterSoulGemTargetEventData
local function filterSoulGemTargetCallback(e)
end
event.register(tes3.event.filterSoulGemTarget, filterSoulGemTargetCallback)
Tip
An event can be claimed by setting e.claim to true, or by returning false from the callback. Claiming the event prevents any lower priority callbacks from being called.
Event Data⚓︎
filter(boolean): Setting this tofalseornilwill prevent themobile's soul to end up in thesoulGem. Setting this totruewill make the opposite.mobile(tes3mobileActor): Read-only. The mobile actor whose soul is to be soultrapped.reference(tes3reference): Read-only. The reference.soulGem(tes3misc): Read-only. The soul gem object.
Examples⚓︎
Example: A more elaborate example.
local function onInitialized()
tes3.addSoulGem({ item = "misc_dwrv_artifact60" })
end
event.register(tes3.event.initialized, onInitialized)
local function onFilterSoulGemTarget(e)
if (e.reference.baseObject.id:lower() == "fargoth") then
return e.soulGem.id == "misc_dwrv_artifact60"
end
end
event.register(tes3.event.filterSoulGemTarget, onFilterSoulGemTarget)
-- calcSoulValue event allows assigning a new soul value to creatures
-- If the event was triggered for an NPC, it allows assigning a value
-- thus allowing soul-trapping the actor.
local function calcSoulValueCallback(e)
if (e.actor.id:lower() == "fargoth") then
e.value = 69
mwse.log("Getting Fargoth's value.")
return
end
end
event.register(tes3.event.calcSoulValue, calcSoulValueCallback)
Example: Example
local function onInitialized()
-- This will turn the Dwemer Tube in a soul gem
tes3.addSoulGem({ item = "misc_dwrv_artifact60" })
end
event.register(tes3.event.initialized, onInitialized)
local function onFilterSoulGemTarget(e)
-- Make it so Vivec can only be trapped by a special container.
if (e.reference.baseObject.id:lower() == "vivec") then
e.filter = (e.soulGem.id == "misc_dwrv_artifact60")
end
end
event.register(tes3.event.filterSoulGemTarget, onFilterSoulGemTarget)