Skip to content

Instantly share code, notes, and snippets.

@CameronHall
Last active August 29, 2015 14:09
Show Gist options
  • Save CameronHall/c1e41b8e44b407f752d2 to your computer and use it in GitHub Desktop.
Save CameronHall/c1e41b8e44b407f752d2 to your computer and use it in GitHub Desktop.
Speed/animationState camo selection
if (isServer) then {
private ['_unit','_speed','_animationState','_animation','_limit','_texture'];
_unit = 'className'; //edit class name here
_animation = 'animationName'; //edit animation name here
_speedLimit = <5; // Speed limiter, CAN use operands and irrational numbers.
_texture = [0, "/pbo/texture.paa"]; //[hiddenselection, path]
if(typeOf _unit) then
{
while {true} do
{
_animationState = animationState _unit;
_speed = vectorMagnitude velocity _unit;
_speed = 3.6 * _speed;
uiSleep 0.5;
if (_speed _speedLimit && _animationState == _animation) then
{
_unit setObjectTextureGlobal _texture;
};
};
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment