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



If statement. - Scupp - 07-17-2012

I need little help with this if statement. How can I make it so that IF some entities in the script are active, something happes. I readed this:
http://wiki.frictionalgames.com/hpl2/tutorials/script/entihscript_beginner#the_if and have watched some videos but I can't find the answer or any other way to do this.

Let's say that I have this script:


void lauta(string &in asParent, string &in asChild, int alState)
{
if(alState == 1)
{
PlayMusic("impact_wood_low2.ogg", false, 150.00, 0, 0, true);
SetEntityActive("lauta_1", true);
SetEntityActive("lauta", false);
}
}
void lauta2(string &in asParent, string &in asChild, int alState)
{
if(alState == 1)
{
PlayMusic("impact_wood_heavy_low2.ogg", false, 150.00, 0, 0, true);
SetEntityActive("lauta_2", true);
SetEntityActive("lauta2", false);
}
}
void lauta3(string &in asParent, string &in asChild, int alState)
{
if(alState == 1)
{
PlayMusic("impact_wood_heavy_low2.ogg", false, 150.00, 0, 0, true);
SetEntityActive("lauta_3", true);
SetEntityActive("lauta3", false);
}
}

I wan't that something happens when lauta_1, lauta_2 and lauta_3 are active. How can I do that? I'm not here to get whole script. I just want to know how it happens and what should I do.


RE: If statement. - Juby - 07-17-2012

You may need to add a localvar or globalvar whenever you activate an entity as a makeshift way to check if it exists. Then check the var in a function and do what you want when they are active.


RE: If statement. - Scupp - 07-17-2012

(07-17-2012, 02:06 PM)Juby Wrote: You may need to add a localvar or globalvar whenever you activate an entity as a makeshift way to check if it exists. Then check the var in a function and do what you want when they are active.
Alright I got it fixed! Thanks Smile