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



Where - Icaab2607 - 04-26-2013

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


RE: Where - xxxxxxxxxxxxxxxx - 04-26-2013

Well, what does the error message say? It usually tells you which line doesn't work and what kind of error it is.


RE: Where - PutraenusAlivius - 04-26-2013

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


RE: Where - Romulator - 04-26-2013

(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:
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:
else(alState == -1



RE: Where - Tomato Cat - 04-26-2013

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:
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:
else if(alState == -1

*edit*

Just replace it with this.

PHP Code:
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);




RE: Where - Icaab2607 - 04-28-2013

[b]Mr Credits look:[/b]

[video=youtube]http://youtu.be/o6jift9j6-8[/video][b]
[/b]


RE: Where - Tomato Cat - 04-28-2013

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


RE: Where - PutraenusAlivius - 04-28-2013

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


RE: Where - Tomato Cat - 04-28-2013

(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


RE: Where - Icaab2607 - 04-28-2013

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

I speak that does not work