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
Icaab2607 Offline
Junior Member

Posts: 34
Threads: 13
Joined: Mar 2013
Reputation: 0
#1
Bug  Where

Where here error? Huh

void OnStart()
{
AddEntityCollideCallback("Player", "InsanityHall", "FuncInsanityHall", false, 0);
}

void FuncInsanityHall(string &in asParent, string &in asChild, int alState)
{
if(alState == 1) {
SetLocalVarFloat("init_sanity", GetPlayerSanity());
AddTimer("start_drain", 0.01, "SanityDrain");
}
if(alState == -1) {
SetPlayerSanity(GetLocalvarFloat("init_sanity"));
RemoveTimer("drain_loop");
RemoveTimer("start_drain");
}
}

void SanityDrain(string &in asTimer)
{
if(asTimer == "start_drain") return;
if(GetPlayerSanity() > 20) GiveSanityDamage(5, false);
AddTimer("drain_loop", 1, "SanityDrain");
}
04-26-2013, 01:14 PM
Find
xxxxxxxxxxxxxxxx Away
Posting Freak

Posts: 935
Threads: 0
Joined: Jun 2012
Reputation: 54
#2
RE: Where

Well, what does the error message say? It usually tells you which line doesn't work and what kind of error it is.
04-26-2013, 01:27 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#3
RE: Where

You should get an error message saying what line that's wrong.

"Veni, vidi, vici."
"I came, I saw, I conquered."
04-26-2013, 01:45 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#4
RE: Where

(04-26-2013, 01:14 PM)Icaab2607 Wrote: void SanityDrain(string &in asTimer)
{
if(asTimer == "start_drain") return;
if(GetPlayerSanity() > 20) GiveSanityDamage(5, false);
AddTimer("drain_loop", 1, "SanityDrain");
}

You have an if that is not bracketed.
Try changing it to this:

PHP Code: (Select All)
void SanityDrain(string &in asTimer)
{
    if(
asTimer == "start_drain") return;
    if(
GetPlayerSanity() > 20
    {
    
GiveSanityDamage(5false);
    
AddTimer("drain_loop"1"SanityDrain");
    }


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

Discord: Romulator#0001
[Image: 3f6f01a904.png]
04-26-2013, 02:07 PM
Find
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
Icaab2607 Offline
Junior Member

Posts: 34
Threads: 13
Joined: Mar 2013
Reputation: 0
#6
RE: Where

[b]Mr Credits look:[/b]

[video=youtube]http://youtu.be/o6jift9j6-8[/video][b]
[/b]
04-28-2013, 08:55 AM
Find
Tomato Cat Offline
Senior Member

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

Uh, what is it you're trying to do exactly?

RAISE YOUR DONGERS ヽ༼ຈل͜ຈ༽ノ
04-28-2013, 02:33 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#8
RE: Where

(04-28-2013, 02:33 PM)Mr Credits Wrote: Uh, what is it you're trying to do exactly?

I think he wants to swim.

"Veni, vidi, vici."
"I came, I saw, I conquered."
04-28-2013, 02:39 PM
Find
Tomato Cat Offline
Senior Member

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

(04-28-2013, 02:39 PM)JustAnotherPlayer Wrote:
(04-28-2013, 02:33 PM)Mr Credits Wrote: Uh, what is it you're trying to do exactly?

I think he wants to swim.

Can that even be done? o.o

RAISE YOUR DONGERS ヽ༼ຈل͜ຈ༽ノ
04-28-2013, 02:43 PM
Find
Icaab2607 Offline
Junior Member

Posts: 34
Threads: 13
Joined: Mar 2013
Reputation: 0
#10
RE: Where

Я море знаем, не получилось Sad.

I speak that does not work
(This post was last modified: 04-28-2013, 06:20 PM by Icaab2607.)
04-28-2013, 06:18 PM
Find




Users browsing this thread: 2 Guest(s)