Frictional Games Forum (read-only)
Anyone need help? - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Anyone need help? (/thread-7825.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22


RE: Anyone need help? - Roenlond - 05-15-2011

(05-15-2011, 05:45 PM)Dominic0904 Wrote: Thanks for the help with the Lamp thing...now, I got a timer problem. I want to add a timer in so the screen fades to black, this is the code so far.

Code:
((this is put here so you know where the timer came from))
AddTimer("FadeToBlackTimer", 5, "FadeToBlack_01");

((this is the part I mean))
void FadeToBlack_01(float string &in asTimer)
{
    if (asTimer == "FadeToBlackTimer")
    {
    FadeOut("", 4);
    return;
    }
}

It keeps giving me an error saying "Expected ')' or ',' "
it says that it expects it right before "&in".

I think I know it's something to do with the whole "(float string &in asTimer)" part. Since I still don't really understand what I need to put in here.

(float string &in asTimer) should be (string &in asTimer)


RE: Anyone need help? - Kyle - 05-15-2011

You can't have it as a "float string &in asTimer". The "asTimer" is a string, not a number. I could see someone thinking that it's a float or integer, but it's not. :/

Just have this:

void FadeToBlack_01(string &in asTimer)


Darn, you beat me to it. On my own thread... Sad


RE: Anyone need help? - Dominic0904 - 05-15-2011

That just gave me "No matching signatures to 'FadeOut(string@&, cost uint)' "

as well as
"Candidates are:
void FadeOut(float)"

that second part came up as INFO and not ERR


RE: Anyone need help? - Kyle - 05-15-2011

Have it "FadeOut(4);"


RE: Anyone need help? - Roenlond - 05-15-2011

(05-15-2011, 05:49 PM)Kyle Wrote: You can't have it as a "float string &in asTimer". The "asTimer" is a string, not a number. I could see someone thinking that it's a float or integer, but it's not. :/

Just have this:

void FadeToBlack_01(string &in asTimer)


Darn, you beat me to it. On my own thread... Sad

I'm sorry, didn't really notice it Smile


RE: Anyone need help? - Dominic0904 - 05-15-2011

Thanks again Kyle! Worked great!
Btw you've made a really great thread haha, just gonna say thanks personally, you've helped me a lot. Big Grin


RE: Anyone need help? - nemesis567 - 05-15-2011

(05-15-2011, 05:45 PM)Dominic0904 Wrote: Thanks for the help with the Lamp thing...now, I got a timer problem. I want to add a timer in so the screen fades to black, this is the code so far.

Code:
((this is put here so you know where the timer came from))
AddTimer("FadeToBlackTimer", 5, "FadeToBlack_01");

((this is the part I mean))
void FadeToBlack_01(float string &in asTimer)
{
    if (asTimer == "FadeToBlackTimer")
    {
    FadeOut("", 4);
    return;
    }
}

It keeps giving me an error saying "Expected ')' or ',' "
it says that it expects it right before "&in".

I think I know it's something to do with the whole "(float string &in asTimer)" part. Since I still don't really understand what I need to put in here.

Replace FadeOut("", 4); with FadeOut(4.0f);
How do you disable a normal player area or script area?


RE: Anyone need help? - X4anco - 05-15-2011

Hello peoples

What is a local variable and how do I set it up
etc...?


RE: Anyone need help? - Kyle - 05-15-2011

(05-15-2011, 07:12 PM)X4anco Wrote: Hello peoples

What is a local variable and how do I set it up
etc...?

A local variable is as simple as this:
x = 1

There are 3 different kinds of local variables, int, string, and float.

The difference from x = 1 and a local variable is that x can only be used in the function it is in mostly unless if you carry it over from one function to the next, but nevermind. A local variable can be used all within the whole script.

You can use a local variable if you want to check if 2 different things happened and then it check to see if the local variable is whatever.

Example:

Code:
void OnStart()
{
     SetLocalVarInt("Var1", 0);
     AddEntityCollideCallback("Player", "ScriptArea_1", "Func1", true, 1);
     AddEntityCollideCallback("Player", "ScriptArea_2", "Func2", true, 1);
     Func3();
}
void Func1(string &in asParent, string &in asChild, int alState)
{
     AddLocalVarInt("Var1", 1);
}
void Func2(string &inn asParent, string &in asChild, int alState)
{
     AddLocalVarInt("Var1", 1);
}
void Func3()
{
     if (GetLocalVarInt("Var1") == 2)
     {
          AddEntityCollideCallback("Player", "ScriptArea_3", "Func4", true, 1);
          return;
     }
}
void Func4(string &in asParent, string &in asChild, int alState)
{
     [whatever happens]
}



RE: Anyone need help? - nemesis567 - 05-15-2011

A local variable is a variable that works on the script you're using. This is, it will only work on that map, while a global variable would work in all of them.

To set a local variable you use the function:

SetLocalVarInt(string& asName, int alVal); //If the variable is an integer, where asName is the variable name which can be anything you like, and alVal is the variable value(must be an integer)

GetLocalVarInt(string& asName); //Returns an integer and can only be used to get an integer variable. asName is the name of the local variable

SetLocalVarFloat(string& asName, float alVal); //If the variable is an float, where asName is the variable name which can be anything you like, and alVal is the variable value(must be a float var)

GetLocalVarFloat(string& asName); //Returns a float and can only be used to get an float variable. asName is the name of the local variable

SetLocalVarString(string& asName, const string& alVal); //If the variable is an string, where asName is the variable name which can be anything you like, and alVal is the variable value(must be a string)

GetLocalVarString(string& asName); //Returns a string and can only be used to get an string variable. asName is the name of the local variable
So, does anyone knows How do you disable a normal player area or script area?