From GMod Wiki
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Event Hook
|
Hook Name | TranslateActivity
|
Syntax | GM:TranslateActivity( Player ply, Act act )
|
Description | Animation
|
Returns | Nil
|
Lua State |
|
BBCode | [b][url=wiki.garrysmod.com/?title=Gamemode.TranslateActivity]Gamemode.TranslateActivity [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
|
Examples
Description | Translates between animations |
Used on | |
Code |
local IdleActivity = ACT_HL2MP_IDLE
local IdleActivityTranslate = {}
IdleActivityTranslate [ ACT_MP_STAND_IDLE ] = IdleActivity
IdleActivityTranslate [ ACT_MP_WALK ] = IdleActivity+1
IdleActivityTranslate [ ACT_MP_RUN ] = IdleActivity+2
IdleActivityTranslate [ ACT_MP_CROUCH_IDLE ] = IdleActivity+3
IdleActivityTranslate [ ACT_MP_CROUCHWALK ] = IdleActivity+4
IdleActivityTranslate [ ACT_MP_ATTACK_STAND_PRIMARYFIRE ] = IdleActivity+5
IdleActivityTranslate [ ACT_MP_ATTACK_CROUCH_PRIMARYFIRE ] = IdleActivity+5
IdleActivityTranslate [ ACT_MP_RELOAD_STAND ] = IdleActivity+6
IdleActivityTranslate [ ACT_MP_RELOAD_CROUCH ] = IdleActivity+6
IdleActivityTranslate [ ACT_MP_JUMP ] = ACT_HL2MP_JUMP_SLAM
// it is preferred you return ACT_MP_* in CalcMainActivity, and if you have a specific need to not tranlsate through the weapon do it here
function GM:TranslateActivity( ply, act )
local act = act
local newact = ply:TranslateWeaponActivity( act )
// select idle anims if the weapon didn't decide
if ( act == newact ) then
return IdleActivityTranslate[ act ]
else
return newact
end
end
|
Output | N/A |
http://luabin.overvprojects.nl/?path=/gamemodes/base/gamemode/animations.lua
Additional Notes