Garry's Mod Wiki

Revision Difference

Entity:SetSequence#514452

<function name="SetSequence" parent="Entity" type="classfunc">⤶ <description>⤶ Sets the entity's model sequence.⤶ ⤶ If the specified sequence is already active, the animation will not be restarted. See <page>Entity:ResetSequence</page> for a function that restarts the animation even if it is already playing.⤶ ⤶ In some cases you want to run <page>Entity:ResetSequenceInfo</page> to make this function run.⤶ ⤶ <note>This will not work properly if called directly after calling <page>Entity:SetModel</page>. Consider waiting until the next Tick.</note>⤶ ⤶ <note>Will not work on players due to the animations being reset every frame by the base gamemode animation system in <page>GM:CalcMainActivity</page>. For Players, use in <page>GM:UpdateAnimation</page> instead.</note>⤶ </description>⤶ <realm>Shared</realm>⤶ <args>⤶ <arg name="sequenceId" type="number">The sequence to play. Also accepts strings.&#xA;&#xA;&lt;note&gt;If set to a string, the function will automatically call &lt;page&gt;Entity:LookupSequence&lt;/page&gt; to retrieve the sequence ID as a number.&lt;/note&gt;</arg>⤶ </args>⤶ </function>⤶ ⤶ <example>⤶ <description>Set the entity to play the "idle" sequence.</description>⤶ <code>self:SetSequence( "idle" )</code>⤶ ⤶ </example>⤶ ⤶ ⤶ <example>⤶ <description>Set the entity to play the first sequence defined on the model (usually idle).</description>⤶ <code>self:SetSequence( 0 )</code>⤶ ⤶ </example>