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
Where
Tomato Cat Offline
Senior Member

Posts: 287
Threads: 2
Joined: Sep 2012
Reputation: 20
#5
RE: Where

Quote:And also, in your 12th line, where it says
Quote:if(alState == -1)

You can make it "else". So it looks like this:

PHP Code: (Select All)
else(alState == -1

You're thinking of else if. =p An else if statement will execute if the condition before it isn't true.

An else statement will execute if no previous condition is true.

PHP Code: (Select All)
else if(alState == -1

*edit*

Just replace it with this.

PHP Code: (Select All)
void FuncInsanityHall(string &in asParentstring &in asChildint alState)
{
    if(
alState == 1)
    {
        
SetLocalVarFloat("init_sanity"GetPlayerSanity());
        
AddTimer("start_drain"0.01"SanityDrain");
        
AddDebugMessage("Adding start_drain",false);
    }
    
        else if(
alState == -1)
        {
            
SetPlayerSanity(GetLocalVarFloat("init_sanity"));
            
RemoveTimer("drain_loop");
            
RemoveTimer("start_drain");
            
AddDebugMessage("Removing timers",false);
            }
}

void SanityDrain(string &in asTimer)
{
    if(
asTimer == "start_drain")
    {
        if(
GetPlayerSanity() > 20
        {
        
GiveSanityDamage(5false);
        
AddDebugMessage("Giving sanity damage",false);
        }
    }
    
    else if(
asTimer == "drain_loop")
    {
        if(
GetPlayerSanity() > 20
        {
        
GiveSanityDamage(5false);
        
AddDebugMessage("Giving sanity damage",false);
        
AddDebugMessage("Player sanity at "+GetPlayerSanity(),false);
        }
    }
    
AddTimer("drain_loop"1"SanityDrain");
    
AddDebugMessage("Adding drain_loop",false);


RAISE YOUR DONGERS ヽ༼ຈل͜ຈ༽ノ
(This post was last modified: 04-26-2013, 03:49 PM by Tomato Cat.)
04-26-2013, 03:22 PM
Find


Messages In This Thread
Where - by Icaab2607 - 04-26-2013, 01:14 PM
RE: Where - by xxxxxxxxxxxxxxxx - 04-26-2013, 01:27 PM
RE: Where - by PutraenusAlivius - 04-26-2013, 01:45 PM
RE: Where - by Romulator - 04-26-2013, 02:07 PM
RE: Where - by Tomato Cat - 04-26-2013, 03:22 PM
RE: Where - by Icaab2607 - 04-28-2013, 08:55 AM
RE: Where - by Tomato Cat - 04-28-2013, 02:33 PM
RE: Where - by PutraenusAlivius - 04-28-2013, 02:39 PM
RE: Where - by Tomato Cat - 04-28-2013, 02:43 PM
RE: Where - by Icaab2607 - 04-28-2013, 06:18 PM



Users browsing this thread: 1 Guest(s)