Frictional Games Forum (read-only)
[SCRIPT] How to make a door open ajar? - 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 ajar? (/thread-20302.html)

Pages: 1 2


How to make a door open ajar? - serbusfish - 02-13-2013

Ive got a setup where a lever opens a locked door, however I want to make the door open slightly ajar once the lever is pulled so the player can see what the lever in question has done (the lever is in a different room). I tried using 'SetMoveObjectState' but it doesnt work, I have used a script to unlock the door which works, its just moving it im having trouble with.


RE: How to make a door open ajar? - MulleDK19 - 02-13-2013

AddPropForce


RE: How to make a door open ajar? - Adrianis - 02-13-2013

You'll need to use SetSwingDoorDisableAutoClose and SetSwingDoorClosed in addition to AddPropForce.

Check out this tutorial
http://wiki.frictionalgames.com/hpl2/tutorials/script/pushdoorsopen
Thats pushing the door open a lot, but its the same principal - you just need to use a lot less force


RE: How to make a door open ajar? - Kreekakon - 02-13-2013

Rip the door off its hinges, and whack it against the jar.

In all seriousness though, pay attention to the other guys in this thread.


RE: How to make a door open ajar? - FlawlessHappiness - 02-13-2013

(02-13-2013, 11:19 AM)Adrianis Wrote: You'll need to use SetSwingDoorDisableAutoClose and SetSwingDoorClosed in addition to AddPropForce.

Instead of doing this, you can just set the open amount to 0.1 or maybe even smaller.


RE: How to make a door open ajar? - Kreekakon - 02-13-2013

(02-13-2013, 11:50 AM)BeeKayK Wrote: Instead of doing this, you can just set the open amount to 0.1 or maybe even smaller.

Won't really work for this guy's case as the door will open after the level has already begun.


RE: How to make a door open ajar? - Adrianis - 02-13-2013

(02-13-2013, 11:50 AM)BeeKayK Wrote:
(02-13-2013, 11:19 AM)Adrianis Wrote: You'll need to use SetSwingDoorDisableAutoClose and SetSwingDoorClosed in addition to AddPropForce.

Instead of doing this, you can just set the open amount to 0.1 or maybe even smaller.

.... uhh yeh, do that! Although if the value is too small it may just auto-close again.

Alternatively,
PHP Code:
void MakeDoorAJar()
{
     
SetEntityActive("door"false);
     
CreateEntityAtArea("A_Jar""Jar.ent""doorarea"true);




RE: How to make a door open ajar? - FlawlessHappiness - 02-13-2013

Oh i used a script like this once.
What happened in the script was basically a timer that kept pushing the door a little bit, a certain amount of time. Like this:

void TimerPushDoor(string &in asTimer)
{
if(GetLocalVarInt("PushDoorVar") == 10)
{
return;
}

AddLocalVarInt("PushDoorVar", 1);
AddPropImpulse("Door", 0, 0, 0.5f, "World");
AddTimer("TimerPushDoor", 0.2, "TimerPushDoor");
}


RE: How to make a door open ajar? - NaxEla - 02-13-2013

(02-13-2013, 12:41 PM)BeeKayK Wrote: Oh i used a script like this once.
What happened in the script was basically a timer that kept pushing the door a little bit, a certain amount of time. Like this:

void TimerPushDoor(string &in asTimer)
{
if(GetLocalVarInt("PushDoorVar") == 10)
{
return;
}

AddLocalVarInt("PushDoorVar", 1);
AddPropImpulse("Door", 0, 0, 0.5f, "World");
AddTimer("TimerPushDoor", 0.2, "TimerPushDoor");
}

This is what I've used, too. It's actually how Frictional Games does it in the first map of TDD.


RE: How to make a door open ajar? - FlawlessHappiness - 02-13-2013

(02-13-2013, 05:02 PM)NaxEla Wrote:
(02-13-2013, 12:41 PM)BeeKayK Wrote: Oh i used a script like this once.
What happened in the script was basically a timer that kept pushing the door a little bit, a certain amount of time. Like this:

void TimerPushDoor(string &in asTimer)
{
if(GetLocalVarInt("PushDoorVar") == 10)
{
return;
}

AddLocalVarInt("PushDoorVar", 1);
AddPropImpulse("Door", 0, 0, 0.5f, "World");
AddTimer("TimerPushDoor", 0.2, "TimerPushDoor");
}

This is what I've used, too. It's actually how Frictional Games does it in the first map of TDD.

Exactly Wink