Frictional Games Forum (read-only)
[SCRIPT] Inverted Controls - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Inverted Controls (/thread-26601.html)

Pages: 1 2


RE: Inverted Controls - FlawlessHappiness - 10-08-2014

If it's not possible, and if you just want to disorientate the player, how about giving the player pushes?

Different amounts, smaller or bigger, forward, backward, left, right, with random timers.
This could definitely work for a drunken feeling.
Also remember to spin the player-camera for extra effect.


RE: Inverted Controls - MrBehemoth - 10-08-2014

Aww, shame, coz I just debugged it. Smile

If anyone is interested:
Spoiler below!
PHP Code:
void DrunkMode_Start()
{
    
SetPlayerLookSpeedMul(-1);
    
FadePlayerFOVMulTo(1.25f2.5f);
    
FadeRadialBlurTo(0.05f0.01f);
    
PlayGuiSound("27_thump"1.0f);
    
AddTimer("DrunkModeMoveTimer"RandFloat(1.0f2.0f), "DrunkMode_MoveReset");
    
AddTimer("DrunkModeViewTimer"RandFloat(0.5f2.5f), "DrunkMode_ViewAdjust");
}

void DrunkMode_Stop()
{
    
FadePlayerFOVMulTo(1.0f2.5f);
    
FadeRadialBlurTo(0.0f0.01f);
    
MovePlayerHeadPos(0.0f0.0f0.0f1.0f0.25f);
    
FadePlayerRollTo(0.0f1.0f10.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.0f0.0ffalse);
        
AddTimer("DrunkModeMoveTimer"RandFloat(3.0f4.0f), "DrunkMode_MoveReset");
    }
    else if(
GetGlobalVarFloat("PlayerPrevX") - GetPlayerPosX() > 0.1f)
    {
        
AddPlayerBodyForce(RandFloat(20000.0f30000.0f), 0.0f0.0ffalse);
        
AddTimer("DrunkModeMoveTimer"RandFloat(3.0f4.0f), "DrunkMode_MoveReset");
    }
    
    if(
GetGlobalVarFloat("PlayerPrevZ") - GetPlayerPosZ() < -0.1f)
    {
        
AddPlayerBodyForce(0.0f0.0fRandFloat(-30000.0f, -20000.0f), false);
        
AddTimer("DrunkModeMoveTimer"RandFloat(3.0f4.0f), "DrunkMode_MoveReset");
    }
    else if(
GetGlobalVarFloat("PlayerPrevZ") - GetPlayerPosZ() > 0.1f)
    {
        
AddPlayerBodyForce(0.0f0.0fRandFloat(30000.0f20000.0f), false);
        
AddTimer("DrunkModeMoveTimer"RandFloat(3.0f4.0f), "DrunkMode_MoveReset");
    }
    else
    {
        
AddTimer("DrunkModeMoveTimer"RandFloat(1.0f2.0f), "DrunkMode_MoveReset");
    }
}

void DrunkMode_ViewAdjust(string &in asTimer)
{
    
FadeRadialBlurTo(RandFloat(0.01f0.05f), 0.01f);
    
MovePlayerHeadPos(RandFloat(-0.2f0.2f), RandFloat(-0.2f0.2f), RandFloat(-0.2f0.2f), RandFloat(0.05f0.1f), 0.05f);
    
FadePlayerRollTo(RandFloat(-10.0f10.0f), 1.0f10.0f);
    
AddTimer("DrunkModeViewTimer"RandFloat(0.5f2.5f), "DrunkMode_ViewAdjust");



I'd recommend Flawless's idea - just give the player random pushes, with camera roll, and radial blur too, why not.


RE: Inverted Controls - Neelke - 10-08-2014

Thanks guys. I'll test around a bit with this.