Garry's Mod Wiki

Revision Difference

Entity:SendViewModelMatchingSequence#549132

<function name="SendViewModelMatchingSequence" parent="Entity" type="classfunc"> <description> Sends sequence animation to the view model. It is recommended to use this for view model animations, instead of <page>Entity:ResetSequence</page>. This function is only usable on view models. <bug issue="3229">Sequences 0-6 will not be looped regardless if they're marked as a looped animation or not.</bug> </description> <realm>Shared</realm> <args> <arg name="seq" type="number">The sequence ID returned by <page>Entity:LookupSequence</page> or <page>Entity:SelectWeightedSequence</page>.</arg> </args> </function> <example> <description>Converting an ACT_VM_* enumeration to a sequence usable by the function.</description> <code> local VModel = self:GetOwner():GetViewModel() local EnumToSeq = VModel:SelectWeightedSequence( ACT_VM_PRIMARYATTACK ) VModel:SendViewModelMatchingSequence( EnumToSeq ) </code> <output>Sends the primary attack enumeration sequence to the view model and plays it.</output> ⤶ </example>⤶ ⤶ ⤶ <example>⤶ <description>you can add a sequence to a Viewmodel</description>⤶ <code>⤶ local VModel = self:GetOwner():GetViewModel() // get the viewmodel entity ⤶ local EnumToSeq = VModel:LookupSequence("fire") // get the sequence ⤶ ⤶ VModel:SendViewModelMatchingSequence( EnumToSeq ) ⤶ </code>⤶ <output>Sends the sequence to the view model and plays it.</output>⤶ ⤶ </example>⤶ ⤶ </example>