06-06-2013, 12:50 AM
Hello, I am trying to get a swing door to open slowly by itself using AddPropForce. An example of what I want is in the original Amnesia in the Rain Hall level. However for the past 2 hours I have been trying to do this but every single time I enter the script area, the door does nothing. Everything looks fine in the script but it just doesn't want to work.
Here is the entire script for the level:
I just don't know what to do and need help.
Here is the entire script for the level:
Code:
//This is only executed when the map is loaded for the first time. Only happens once. Can be used for adding effects that should not repeat.//
void OnStart()
{
SetPlayerLampOil(70);
GiveItemFromFile("lantern", "lantern.ent");
AddEntityCollideCallback("Player", "Door_Creepy", "DoorOpens", true, 1);
}
void DoorOpens(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("CreepyDoor", false, false);
SetSwingDoorDisableAutoClose("CreepyDoor", true);
AddTimer("swing_door", 0.01f, "TimerDoor");
}
void TimerDoor(string &in asTimer)
{
if(asTimer == "swing_door")
{
AddPropForce("CreepyDoor", 500.0f, 0.0f, 0.0f, "world");
}
}
//This is executed every time you enter the level. Can be executed several times. Can be used for playing music and adding checks.//
void OnEnter()
{
AddEntityCollideCallback("Player", "ReturnPlayerArea_0", "ReturnPlayer", false, 1);
}
void ReturnPlayer(string &in asParent, string &in asChild, int alState)
{
TeleportPlayer("PlayerStartArea_1");
}
//This is executed every time you leave the level. Can be executed several times. Can be used for stopping music//
void OnLeave()
{
}
I just don't know what to do and need help.