bodyPartsUpdated⚓︎
This event is triggered when an actor's body parts have finished updating. This typically triggers when an actor is first rendered, or when their equipment changes.
--- @param e bodyPartsUpdatedEventData
local function bodyPartsUpdatedCallback(e)
end
event.register(tes3.event.bodyPartsUpdated, bodyPartsUpdatedCallback)
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⚓︎
mobile
(tes3mobileActor): Read-only. The mobile actor whose body parts were updated.reference
(tes3reference): Read-only. The reference for the actor whose body parts were updated.
Examples⚓︎
Example: In this example all the scene graph nodes that make up left arm are culled. That will effectively make all the left arms in the game disappear.
local leftArmParts = {
tes3.activeBodyPart.leftForearm,
tes3.activeBodyPart.leftHand,
tes3.activeBodyPart.leftUpperArm,
tes3.activeBodyPart.leftWrist,
tes3.activeBodyPart.shield
}
---@param e bodyPartsUpdatedEventData
local function ripLefties(e)
local bpm = e.reference.bodyPartManager
if (not bpm) then return end
-- Hide all left arm nodes.
for _, part in ipairs(leftArmParts) do
-- We want to hide the body parts in all the three
-- layers that make up the character's body.
for _, layer in pairs(tes3.activeBodyPartLayer) do
local activePart = bpm:getActiveBodyPart(layer, part)
if (activePart and activePart.node) then
activePart.node.appCulled = true
end
end
end
end
event.register(tes3.event.bodyPartsUpdated, ripLefties)