Garry's Mod Wiki

Garry's Mod Wiki

  Entity:SetSequence( number sequenceId )

Description

Sets the entity's model sequence.

If the specified sequence is already active, the animation will not be restarted. See Entity:ResetSequence for a function that restarts the animation even if it is already playing.

In some cases you want to run Entity:ResetSequenceInfo to make this function run.

This will not work properly if called directly after calling Entity:SetModel. Consider waiting until the next Tick.

Will not work on players due to the animations being reset every frame by the base gamemode animation system. See GM:CalcMainActivity.

For custom scripted entities you will want to apply example from ENTITY:Think to make animations work.

Arguments

1 number sequenceId
The sequence to play. Also accepts strings.
If set to a string, the function will automatically call Entity:LookupSequence to retrieve the sequence ID as a number.

Example

Set the entity to play the "idle" sequence.

self:SetSequence( "idle" )

Example

Set the entity to play the first sequence defined on the model (usually idle).

self:SetSequence( 0 )

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...