Enables or disables the light attached to the specified entity (with the assumption that the entity is a light source).
set_entity_light_enabled(entity, enabled)
Argument | Description | Type | Required |
---|---|---|---|
entity | Entity that will have its light enabled or disabled. | Entity | Yes |
enabled | Determines the light's state (on or off). | Boolean | Yes |
If you'd like to change the color of the entity's light instead of toggling it on or off, see the related Set Entity Light Color function.
set_entity_light_enabled(entity["lamp"], false);
Results: The entity with an ID of “lamp” will have its light disabled (i.e. it will be turned off and no longer cast light until turned on again).
Use the Set Entity Light Enabled function to toggle a room's light on and off when the player interacts with a switch or button.