Skip to content

SetActorTorch

Puts a lit torch or lantern in an actor’s free hand - or puts it out.

The game’s own burning torch, fire and light, in the actor’s free hand on every screen: at peace or in a fight, standing or walking. An actor draws no weapon outside a fight, so this is how a mode lights its guards and townsfolk at night. A death puts the torch out; an actor coming into view later shows it lit.

light picks a lantern instead - the same lanterns players carry (the lanterns): "lantern" or "lantern_fancy". It is held the torch’s way and lit at night like the torch.

SetActorTorch(id [, lit, light])
Parameter Type
id number the actor
lit boolean true (the default) = the light lit in the hand; false = put away (optional)
light string "torch" (the default), "lantern" or "lantern_fancy" (optional)

boolean - false for anything but a person actor (an animal too), for a dead one when lit is true (a corpse holds no torch; putting one out always works), or for an unknown light

-- the night watch lights up at dusk and puts the torches away at dawn (checked every ten seconds)
SetTimer(function()
local hour = GetWorldTime()
local night = hour >= 20 or hour < 6
for _, id in ipairs(WATCH) do
if IsActorTorchLit(id) ~= night then SetActorTorch(id, night) end
end
end, 10000, true)
-- the innkeeper's boy walks the yard with a lantern
SetActorTorch(boy, true, "lantern")

IsActorTorchLit · GetActorLight · CreateActor · GetWorldTime · SetTimer · the NPC actors group of the index