SetActorTorch
Puts a lit torch 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.
Syntax
Section titled “Syntax”SetActorTorch(id [, lit])| Parameter | Type | |
|---|---|---|
id |
number | the actor |
lit |
boolean | true (the default) = the torch lit in the hand; false = put away (optional) |
Returns
Section titled “Returns”boolean - false for anything but a person actor (an animal too), or for a dead one when lit is true (a corpse holds no torch; putting one out always works)
Example
Section titled “Example”-- 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 endend, 10000, true)See also
Section titled “See also”IsActorTorchLit · CreateActor · GetWorldTime · SetTimer · the NPC actors group of the index
