void OnStart()
{
AddEntityCollideCallback("Player", "AreaFallBreakLeg", "Leg", true, 1);
}
void Leg(string &in asParent, string &in asChild, int alState)
{
SetPlayerMoveSpeedMul(0.9);
SetPlayerRunSpeedMul(1);
AddTimer("", 1, "CheckLeg");
}
void CheckLeg(string &in asTimer)
{
if(GetPlayerSpeed() <= 0.9)
{
AddTimer("", 1, "CheckLeg");
AddTimer("", 0.5, "HeadTilt");
}
if(GetPlayerSpeed() == 1)
{
AddTimer("", 0.5, "CheckLeg");
AddTimer("", 0.3, "HeadTilt");
}
if(GetPlayerSpeed() == 0)
{
AddTimer("", 0.1, "CheckLeg");
}
}
void HeadTilt(string &in asTimer)
{
if(GetPlayerSpeed() <= 0.9)
{
FadePlayerRollTo(45, 0.5, 0.5);
SetPlayerMoveSpeedMul(0);
AddTimer("", 0.1, "HeadNormal");
}
if(GetPlayerSpeed() == 1)
{
FadePlayerRollTo(45, 0.2, 0.2);
SetPlayerRunSpeedMul(0.6);
AddTimer("", 0.05, "HeadNormal");
}
}
void HeadNormal(string &in asTimer)
{
if(GetPlayerSpeed() <= 0.9)
{
FadePlayerRollTo(0, 0.3, 0.3);
SetPlayerMoveSpeedMul(0.9);
AddTimer("", 0.5, "HeadTilt");
}
if(GetPlayerSpeed() == 1)
{
FadePlayerRollTo(0, 0.2, 0.2);
SetPlayerRunSpeedMul(1);
AddTimer("", 0.1, "HeadTilt");
}
}