Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help How to make a door open when walking into an area?
MissMarilynn Offline
Member

Posts: 77
Threads: 23
Joined: Oct 2011
Reputation: 1
#1
How to make a door open when walking into an area?

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!
02-25-2012, 07:42 PM
Find
Shives Offline
Member

Posts: 154
Threads: 41
Joined: Jan 2012
Reputation: 1
#2
RE: How to make a door open when walking into an area?

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
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");
}


My Custom Story
http://www.frictionalgames.com/forum/thread-12587.html

Sorry for bad English


(This post was last modified: 02-25-2012, 07:49 PM by Shives.)
02-25-2012, 07:48 PM
Find
Strembitsky Offline
Senior Member

Posts: 254
Threads: 37
Joined: Feb 2012
Reputation: 3
#3
RE: How to make a door open when walking into an area?

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.

The Nightmares v1.0 - Dreadful Fires WIP
02-25-2012, 07:51 PM
Find
MissMarilynn Offline
Member

Posts: 77
Threads: 23
Joined: Oct 2011
Reputation: 1
#4
RE: How to make a door open when walking into an area?

(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);

}
(This post was last modified: 02-25-2012, 08:02 PM by MissMarilynn.)
02-25-2012, 08:00 PM
Find
Strembitsky Offline
Senior Member

Posts: 254
Threads: 37
Joined: Feb 2012
Reputation: 3
#5
RE: How to make a door open when walking into an area?

(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);

The Nightmares v1.0 - Dreadful Fires WIP
02-25-2012, 08:35 PM
Find




Users browsing this thread: 1 Guest(s)