Frictional Games Forum (read-only)

Full Version: If statement.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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/tut...ner#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.
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.
(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