Frictional Games Forum (read-only)
[SCRIPT] If statements and entities - 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: [SCRIPT] If statements and entities (/thread-17646.html)



If statements and entities - Lizard - 08-10-2012

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


RE: If statements and entities - Your Computer - 08-10-2012

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?


RE: If statements and entities - Lizard - 08-10-2012

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?


RE: If statements and entities - Your Computer - 08-10-2012

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.


RE: If statements and entities - Lizard - 08-10-2012

(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


RE: If statements and entities - Your Computer - 08-10-2012

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


RE: If statements and entities - Lizard - 08-10-2012

i set it so that it will only check if the area exist, when the player picks up a specific oil potion