Garry's Mod Wiki

DynamicLight

table DynamicLight( number index, boolean elight = false )

Description

Creates or replaces a dynamic light with the given id.

Only 32 dlights and 64 elights can be active at once.
It is not safe to hold a reference to this object after creation since its data can be replaced by another dlight at any time.
The minlight parameter affects the world and entities differently.

Arguments

1 number index
An unsigned Integer. Usually an entity index is used here.
2 boolean elight = false
Allocates an elight instead of a dlight. Elights have a higher light limit and do not light the world (making the "noworld" parameter have no effect).

Returns

1 table
A DynamicLight structured table. See Structures/DynamicLight

Example

Emits a bright white light from local players eyes.

hook.Add( "Think", "Think_Lights!", function() local dlight = DynamicLight( LocalPlayer():EntIndex() ) if ( dlight ) then dlight.pos = LocalPlayer():GetShootPos() dlight.r = 255 dlight.g = 255 dlight.b = 255 dlight.brightness = 2 dlight.Decay = 1000 dlight.Size = 256 dlight.DieTime = CurTime() + 1 end end )

Page Links


Special Pages


Wikis

?

Render Time: 28ms

DB GetPage 3
Generate Html 7
SaveChanges (1) 8
Render Body 0
Render Sidebar 7