Frictional Games Forum (read-only)

Full Version: If statements and entities
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is it possible to use entities or area in if statements?
If it is, i would happy isf you could tell me how to do it.


This is what i've tried

void OnStart
{
SetEntityPlayerInteractCallback("potion_oil_1", "MonsterActivation", true);
}

void MonsterActivation(string &in asEntity)
{
if (("MonsterArea_1") == false)
{
SetEntityActive("MonsterArea_1", true);
}
else
{
PlaySoundAtEntity("", "grunt/enabled", "prison_2", 0, false);
PlaySoundAtEntity("", "scare_slam_door", "prison_2", 0, false);
}
}

Thanks in advance
Well, you can use GetEntityExists, but this won't test if the entity is active or not. As for your MonsterActivation function, have you thought about comparing against the parameter asEntity?
Thanks for telling me about "GetEntityExists"
Now i got it working with doing this

void OnStart
{
SetEntityPlayerInteractCallback("potion_oil_1", "MonsterActivation", true);
}

void MonsterActivation(string &in asEntity)
{
if (GetEntityExists("MonsterArea_1"))
{
SetEntityActive("MonsterArea_1", true);
}
}


Just a quick question. is it possible to use a doors openamount in an if statement or in a script at all?
Do you plan on using that same MonsterActivation function for several maps? 'Cause that's the only reason i can think of to write it like that.

As for your "quick question", mess around with GetSwingDoorState.
(08-10-2012, 04:45 PM)Your Computer Wrote: [ -> ]1. Do you plan on using that same MonsterActivation function for several maps? 'Cause that's the only reason i can think of to write it like that.

2. As for your "quick question", mess around with GetSwingDoorState.

1. Im using the same area for different things on different times and places in the same map

2. Thanks man
(08-10-2012, 04:48 PM)ZereboO Wrote: [ -> ]1. Im using the same area for different things on differents times and places in the same map

But do you realize that GetEntityExists is going to always return true if the entity is in the map?
i set it so that it will only check if the area exist, when the player picks up a specific oil potion