Skip to content

calcSoulValue⚓︎

This event is raised when determining the value of a soul, unmodified by GMSTs. The value can be modified, or used to provide a soul value to NPCs who would normally not be allowed one.

--- @param e calcSoulValueEventData
local function calcSoulValueCallback(e)
end
event.register(tes3.event.calcSoulValue, calcSoulValueCallback)

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⚓︎

  • actor (tes3creature, tes3npc): Read-only. The actor whose soul is being evaluated.
  • value (number, nil): The value of the actor's soul. This may be nil for NPCs.

Examples⚓︎

Example: This example shows how to assign a value to an NPC's soul.

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)