Frictional Games Forum (read-only)
Player Effects - 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: Player Effects (/thread-29754.html)



Player Effects - dailycreepypasta - 03-17-2015

I want to create the effect of the Player limping as they walk/run. How can I do this? I tried this code but it's not working:

PHP Code:
void OnStart()
{
    
AddEntityCollideCallback("Player""AreaFallBreakLeg""Leg"true1);
}

void Leg(string &in asParentstring &in asChildint 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(450.50.5);
         
SetPlayerMoveSpeedMul(0);
        
AddTimer(""0.1"HeadNormal");
    }
    
    if(
GetPlayerSpeed() == 1)
    {
        
FadePlayerRollTo(450.20.2);
        
SetPlayerRunSpeedMul(0.6);
        
AddTimer(""0.05"HeadNormal");
    }
}

void HeadNormal(string &in asTimer)
{
    if(
GetPlayerSpeed() <= 0.9)
    {
         
FadePlayerRollTo(00.30.3);
         
SetPlayerMoveSpeedMul(0.9);
        
AddTimer(""0.5"HeadTilt");
    }
    
    if(
GetPlayerSpeed() == 1)
    {
        
FadePlayerRollTo(00.20.2);
        
SetPlayerRunSpeedMul(1);
        
AddTimer(""0.1"HeadTilt");
    }




RE: Player Effects - Traggey - 03-17-2015

Please make sure to post in the development support section for questions, thanks!


RE: Player Effects - Romulator - 03-17-2015

What isn't working? Does the code execute? If so, where does it stop?


RE: Player Effects - dailycreepypasta - 03-17-2015

(03-17-2015, 01:11 PM)Romulator Wrote: What isn't working? Does the code execute? If so, where does it stop?

The code seems to run but the head position doesn't change, it stays normal. I'm going to add debug messages to make sure everything is working as it should.


RE: Player Effects - FlawlessHappiness - 03-17-2015

(03-17-2015, 09:48 PM)dailycreepypasta Wrote:
(03-17-2015, 01:11 PM)Romulator Wrote: What isn't working? Does the code execute? If so, where does it stop?

The code seems to run but the head position doesn't change, it stays normal. I'm going to add debug messages to make sure everything is working as it should.

I think that's because speed is set to something like 0.5.
It's not speed in seconds IIRC. Smaller numbers = slower-