Garry's Mod Wiki

Revision Difference

ENTITY:Think#546524

<function name="Think" parent="ENTITY" type="hook"> <ishook>yes</ishook> <description> Called every frame on the client. Called every tick on the server. <note>You may need to call <page>Entity:Spawn</page> to get this hook to run server side.</note>⤶ <note>By default, it runs about 5-6 times per second on the server, but you can force it to run at servers tickrate using the example below.</note> <note>You may need to call <page>Entity:Spawn</page> to get this hook to run server side.⤶ By default, it runs about 5-6 times per second on the server, but you can force it to run at servers tickrate using the example below.</note> </description> <realm>Shared</realm> <predicted>No</predicted> <rets> <ret name="" type="boolean">Return true if you used <page>Entity:NextThink</page> to override the next execution time.</ret> <ret name="" type="boolean">Return `true` if you used <page>Entity:NextThink</page> to override the next execution time.</ret> </rets> </function> <example> <description> Force the think hook to run at the maximum frequency. This is generally only used for `anim` type entities, if the entity has to play model animations/sequences. </description> <code> ENT.AutomaticFrameAdvance = true -- Must be set on client function ENT:Think() -- Do stuff self:NextThink( CurTime() ) -- Set the next think to run as soon as possible, i.e. the next frame. return true -- Apply NextThink call return true -- Apply NextThink call end </code> ⤶ </example></example>