Skip to content

SetActorInvisible

Makes an actor or an animal invisible to every player, or seen again.

Its body leaves every screen as if it had walked out of range, with the horse it rides. It is not heard, a player cannot hit it, use it, carry it or rob it, and a carry or a pickpocketing it is part of ends; a hostile animal leaves the players it is invisible to alone. Nothing else changes: it keeps walking where MoveActor sends it, and your other orders still apply - when it shows again it is wherever it is then, dressed as it is then.

For a ghost, a spy only some players see, an actor waiting off stage for its cue. SetActorInvisibleFor gives one player their own rule. A reload of the mode shows every actor again.

SetActorInvisible(id [, invisible])
Parameter Type
id number the actor or animal
invisible boolean true (the default) hides it, false shows it again (optional)

boolean - false for anything but an actor or an animal

-- a ghost that only walks at night
local ghost = CreateActor(nil, x, y, z, 0, "The Grey Lady")
SetTimer(function()
local hour = GetWorldTime()
SetActorInvisible(ghost, not (hour >= 22 or hour < 4))
end, 10000, true)

IsActorInvisible · SetActorInvisibleFor · IsActorVisibleTo · SetPlayerInvisible · the NPC actors group of the index