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
Door Open/Close Depending on Situation
Armored Cow Offline
Member

Posts: 72
Threads: 3
Joined: Sep 2010
Reputation: 0
#7
RE: Door Open/Close Depending on Situation

Actually I'm having troubles too. It's only slamming the door, whether it's already closed or open.

Firstly, I have this in my void OnStart section:
//Callback to slam door
    AddEntityCollideCallback("Player", "area_lock_door", "CollideLock", true, 1);


//Function called when player steps into area_lock_door
void CollideLock(string &in asParent, string &in asChild, int alState)
{
    //Door is closed so activate CreakOpen function
    if(GetSwingDoorClosed("castle_1") == true)
        CreakOpen();
    
    //Door is open so slam it shut
    else
        StartPlayerLookAt("castle_1", 3, 4, "");
        AddTimer("", 0.5f, "TimerSlamDoor");
}

void TimerSlamDoor(string &in asTimer)
{
    SetSwingDoorClosed("castle_1", true, true);
    SetSwingDoorLocked("castle_1", true, true);    
    PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);        
    GiveSanityDamage(5.0f, true);
    AddTimer("", 3.0f, "TimerStopLook");
}

void CreakOpen()
{
    SetSwingDoorDisableAutoClose("castle_1", true);
    SetSwingDoorClosed("castle_1", false, false);    
    StartPlayerLookAt("castle_1", 2, 2, "");
    GiveSanityDamage(5.0f, true);
    PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);    
    AddTimer("castle_1", 0.05f, "TimerCreakDoor");
    AddTimer("castle_1", 0.1f, "TimerCreakDoor");
    AddTimer("castle_1", 0.2f, "TimerCreakDoor");
    AddTimer("castle_1", 0.3f, "TimerCreakDoor");
    AddTimer("", 3.0f, "TimerStopLook");
}

void TimerCreakDoor(string &in asTimer)
{
    AddPropForce("castle_1", 1, 0, 0, "World");
}

void TimerStopLook(string &in asTimer)
{
    StopPlayerLookAt();
}
09-18-2010, 09:43 PM
Find


Messages In This Thread
RE: Door Open/Close Depending on Situation - by Armored Cow - 09-18-2010, 09:43 PM



Users browsing this thread: 2 Guest(s)