Frictional Games Forum (read-only)
[SCRIPT] How to make a door open when walking into an area? - 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] How to make a door open when walking into an area? (/thread-13579.html)



How to make a door open when walking into an area? - MissMarilynn - 02-25-2012

I don't want to necessarily use a PropForce script but I want it to to be an OpenAmount but I can't use it right away because it's locked in the beginning.

The player doesn't see the door when it opens slightly. Is there no other choice but to use propforce? And if so, what would I use to script that?

Thank you!


RE: How to make a door open when walking into an area? - Shives - 02-25-2012

Do you mean the door should open if the player is walking in an area?
My english is very bad.
If you mean this you could do that
Code:
void OnStart()
{
AddEntityCollideCallback("Player", "Name of Area", "Func", true, 1);
}
void Func(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorDisableAutoClose("Name of door", true);
SetSwingDoorClosed("Name of door",false, true);
AddPropForce("Name of door", -1200, 0, 0, "world");
}




RE: How to make a door open when walking into an area? - Strembitsky - 02-25-2012

If the player doesn't see the door, you could have two entities: One closed and locked, and the other open the amount you'd like.

Use a simple SetEntityActive script for both of them.


RE: How to make a door open when walking into an area? - MissMarilynn - 02-25-2012

(02-25-2012, 07:51 PM)Strembitsky Wrote: If the player doesn't see the door, you could have two entities: One closed and locked, and the other open the amount you'd like.

Use a simple SetEntityActive script for both of them.
I like that idea a lot. How do I set the door I have inactive?
How would I put it into this script?


void SpawnMonster(string &in asEntity)
{
SetEntityActive("servant_grunt_2", true);
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_1", 4, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_2", 4, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_3", 3, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_4", 3, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_5", 3, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_6", 3, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_7", 3, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_8", 3, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_9", 3, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_10", 10, "");
GiveSanityDamage(5.0f, true);
SetMessage("walk","Oh_No",0);

SetSwingDoorLocked("mansion_2", false, true);

}


RE: How to make a door open when walking into an area? - Strembitsky - 02-25-2012

(02-25-2012, 08:00 PM)MissMarilynn Wrote:
(02-25-2012, 07:51 PM)Strembitsky Wrote: If the player doesn't see the door, you could have two entities: One closed and locked, and the other open the amount you'd like.

Use a simple SetEntityActive script for both of them.
I like that idea a lot. How do I set the door I have inactive?
How would I put it into this script?


void SpawnMonster(string &in asEntity)
{
SetEntityActive("servant_grunt_2", true);
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_1", 4, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_2", 4, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_3", 3, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_4", 3, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_5", 3, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_6", 3, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_7", 3, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_8", 3, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_9", 3, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_10", 10, "");
GiveSanityDamage(5.0f, true);
SetMessage("walk","Oh_No",0);

SetSwingDoorLocked("mansion_2", false, true);

}
I may be wrong since I do not have the editor with me right now, but I'm sure you can set entities inactive/active in their settings. Click on the door, and under the name there is a checkbox.

Have 2 doors, on each other. In the code, SetEntityActive("Door1", true); and SetEntityActive("Door2", false);