Frictional Games Forum (read-only)
[SCRIPT] Working secret door? - Printable Version

+- Frictional Games Forum (read-only) (
+-- Forum: Amnesia: The Dark Descent (
+--- Forum: Custom Stories, TCs & Mods - Development (
+---- Forum: Development Support (
+---- Thread: [SCRIPT] Working secret door? (/thread-53636.html)

Working secret door? - goodcap - 03-20-2017

I'm re-creating the secret office door from A Machine For Pigs. This is my setup:

Name: lever_small01_1
ConnectionStateChangeCallback: SecretDoor1

Secret Painting Door
Name: OfficeSecretDoor
ConnectionStateChangeCallback: SecretDoor1
Locked: YES

oid SecretDoor1(string &in asEntity, int alState)
AddTimer("", 0, "TimerPushSecret");
SetLocalVarInt("SecretDoorOpen", 1);
SetEntityInteractionDisabled("secretdoorswitchsecretdoorswitch", false);

void TimerPushSecret(string &in asTimer)
SetSwingDoorLocked("secretdoorswitchsecretdoorswitch", false, false);
SetSwingDoorClosed("secretdoorswitchsecretdoorswitch", false, false);
SetSwingDoorDisableAutoClose("secretdoorswitchsecretdoorswitch", true);
AddBodyForce("secretdoorswitchsecretdoorswitch", 0.0f, 0.0f, -8000.0f, "world");

Everything seems to work except for the door automatically opening that should be happening thanks to the AddBodyForce line

RE: Working secret door? - Mudbill - 03-20-2017

Since you have to push it angularly, simply applying force on an axis may not work that well. I think you need to apply adequent force in both X and Z, using timers to lessen the X/Z one and increase the Z/X one (depending on the direction it's facing).

This video on doors may work the same way: