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"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");
    }


Creator of "The Night I Went Insane".

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

Posts: 3,257
Threads: 74
Joined: Feb 2012
Reputation: 185
#2
RE: Player Effects

Please make sure to post in the development support section for questions, thanks!
03-17-2015, 09:19 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#3
RE: Player Effects

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

Discord: Romulator#0001
[Image: 3f6f01a904.png]
03-17-2015, 01:11 PM
Find
dailycreepypasta Offline
Junior Member

Posts: 32
Threads: 18
Joined: Aug 2014
Reputation: 0
#4
RE: Player Effects

(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.

Creator of "The Night I Went Insane".

http://www.moddb.com/mods/the-night-i-went-insane
03-17-2015, 09:48 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#5
RE: Player Effects

(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-

Trying is the first step to success.
03-17-2015, 10:44 PM
Find




Users browsing this thread: 2 Guest(s)