void DrunkMode_Start()
{
SetPlayerLookSpeedMul(-1);
FadePlayerFOVMulTo(1.25f, 2.5f);
FadeRadialBlurTo(0.05f, 0.01f);
PlayGuiSound("27_thump", 1.0f);
AddTimer("DrunkModeMoveTimer", RandFloat(1.0f, 2.0f), "DrunkMode_MoveReset");
AddTimer("DrunkModeViewTimer", RandFloat(0.5f, 2.5f), "DrunkMode_ViewAdjust");
}
void DrunkMode_Stop()
{
FadePlayerFOVMulTo(1.0f, 2.5f);
FadeRadialBlurTo(0.0f, 0.01f);
MovePlayerHeadPos(0.0f, 0.0f, 0.0f, 1.0f, 0.25f);
FadePlayerRollTo(0.0f, 1.0f, 10.0f);
RemoveTimer("DrunkModeMoveTimer");
RemoveTimer("DrunkModeViewTimer");
}
void DrunkMode_MoveReset(string &in asTimer)
{
//AddDebugMessage("DrunkMode_Reset()", false);
SetGlobalVarFloat("PlayerPrevX", GetPlayerPosX());
SetGlobalVarFloat("PlayerPrevZ", GetPlayerPosZ());
AddTimer("DrunkModeMoveTimer", 0.1f, "DrunkMode_MoveDetect");
}
void DrunkMode_MoveDetect(string &in asTimer)
{
if(GetGlobalVarFloat("PlayerPrevX") - GetPlayerPosX() < -0.1f)
{
AddPlayerBodyForce(RandFloat(-30000.0f, -20000.0f), 0.0f, 0.0f, false);
AddTimer("DrunkModeMoveTimer", RandFloat(3.0f, 4.0f), "DrunkMode_MoveReset");
}
else if(GetGlobalVarFloat("PlayerPrevX") - GetPlayerPosX() > 0.1f)
{
AddPlayerBodyForce(RandFloat(20000.0f, 30000.0f), 0.0f, 0.0f, false);
AddTimer("DrunkModeMoveTimer", RandFloat(3.0f, 4.0f), "DrunkMode_MoveReset");
}
if(GetGlobalVarFloat("PlayerPrevZ") - GetPlayerPosZ() < -0.1f)
{
AddPlayerBodyForce(0.0f, 0.0f, RandFloat(-30000.0f, -20000.0f), false);
AddTimer("DrunkModeMoveTimer", RandFloat(3.0f, 4.0f), "DrunkMode_MoveReset");
}
else if(GetGlobalVarFloat("PlayerPrevZ") - GetPlayerPosZ() > 0.1f)
{
AddPlayerBodyForce(0.0f, 0.0f, RandFloat(30000.0f, 20000.0f), false);
AddTimer("DrunkModeMoveTimer", RandFloat(3.0f, 4.0f), "DrunkMode_MoveReset");
}
else
{
AddTimer("DrunkModeMoveTimer", RandFloat(1.0f, 2.0f), "DrunkMode_MoveReset");
}
}
void DrunkMode_ViewAdjust(string &in asTimer)
{
FadeRadialBlurTo(RandFloat(0.01f, 0.05f), 0.01f);
MovePlayerHeadPos(RandFloat(-0.2f, 0.2f), RandFloat(-0.2f, 0.2f), RandFloat(-0.2f, 0.2f), RandFloat(0.05f, 0.1f), 0.05f);
FadePlayerRollTo(RandFloat(-10.0f, 10.0f), 1.0f, 10.0f);
AddTimer("DrunkModeViewTimer", RandFloat(0.5f, 2.5f), "DrunkMode_ViewAdjust");
}