Garry's Mod Wiki

Entity:SelectWeightedSequence

Description

Returns sequence ID corresponding to given activity ID.

Opposite of Entity:GetSequenceActivity.

Similar to Entity:LookupSequence.

See also Entity:SelectWeightedSequenceSeeded.

Arguments

1 number act
The activity ID, see Enums/ACT.

Returns

1 number
The sequence ID

Example

Use this hook to check if the model has a certain ACT_* enumeration, and if it does, play it.

local VModel = self.Owner:GetViewModel() if ( self:Clip1() == 0 and VModel:SelectWeightedSequence( ACT_VM_RELOAD_EMPTY ) ) then local SEQ = self:LookupSequence( ACT_VM_RELOAD_EMPTY ) if ( SEQ == -1 ) then print( "reload" ) local EnumToSeq = VModel:SelectWeightedSequence( ACT_VM_RELOAD ) -- Play the normal reload animation VModel:SendViewModelMatchingSequence( EnumToSeq ) else print( "reload empty" ) local EnumToSeq = VModel:SelectWeightedSequence( ACT_VM_RELOAD_EMPTY ) -- Play the empty reload animation VModel:SendViewModelMatchingSequence( EnumToSeq ) end end
Output: Will play the ACT_VM_RELOAD_EMPTY enumeration if the model has it. If not, it will play the normal reload enum.

Page Links


Special Pages


Wikis

?

Render Time: 40ms

Session 0
DB GetPage 3
Generate Html 15
SaveChanges 8
Render Body 0
Render Sidebar 12