The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Player Effects
dailycreepypasta Offline
Junior Member

Posts: 32
Threads: 18
Joined: Aug 2014
Reputation: 0
#1
Question  Player Effects

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: (Select All)
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");
    }
} 

Creator of "The Night I Went Insane".

http://www.moddb.com/mods/the-night-i-went-insane
03-17-2015, 04:56 AM
Find


Messages In This Thread
Player Effects - by dailycreepypasta - 03-17-2015, 04:56 AM
RE: Player Effects - by Traggey - 03-17-2015, 09:19 AM
RE: Player Effects - by Romulator - 03-17-2015, 01:11 PM
RE: Player Effects - by dailycreepypasta - 03-17-2015, 09:48 PM
RE: Player Effects - by FlawlessHappiness - 03-17-2015, 10:44 PM



Users browsing this thread: 1 Guest(s)