ENT.Think

From GMod Wiki

Jump to: navigation, search
Event Hook
Hook NameThink
SyntaxENT:Think( )
DescriptionCalled when the entity thinks.
ReturnsNil
Lua StateNewerShared.png
BBCode[b][url=wiki.garrysmod.com/?title=ENT.Think]ENT.Think [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionEvery think, increment the redness of the entity.
Used onNewerServer.png
Code
 function ENT:Think()
	self.R = self.R or 0; -- if R is nil, make it 0
 
	if(self.R >= 255) then
		self.R = 0; -- reset R if it's over 255
	end
 
	self:SetColor(self.R, 0, 0, 255); -- actually set the color
 
	self.R = self.R + 1; -- increment R
 end
OutputChange the entity's color to a growing red color.


Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox