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


Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to remove a Timer Loop which opens a door using AddPropForce?
Frontcannon Offline
Senior Member

Posts: 538
Threads: 10
Joined: Jul 2010
Reputation: 2
#9
RE: How to remove a Timer Loop which opens a door using AddPropForce?

For some reason, this worked:

void OpenDoor(string &in asParent, string &in asChild, int alState)
{
    SetSwingDoorClosed("prison_section_2", false, false);
    SetSwingDoorDisableAutoClose("prison_section_2", true);
    AddTimer("swing_door", 0.01f, "TimerDoor");
    SetEntityPlayerLookAtCallback("prison_section_2", "RemoveTimerCreak", true);
}

void TimerDoor(string &in asTimer)
{
    if(asTimer == "swing_door")
    {
        AddPropForce("prison_section_2", 0.0f, 0.0f, 25.0f, "");
    }
    else
    {
        AddPropForce("prison_section_2", 0.0f, 0.0f, -95.0f, "");
    }
    AddTimer(asTimer, 0.03, "TimerDoor");
}

void RemoveTimerCreak(string &in asEntity, int alState)
{
    RemoveTimer("swing_door");
    PlaySoundAtEntity("pant", "react_scare.snt", "Player", 0.0f, false);
}

Also, it's way more precise because the 'react_scare'-sound will now always be played at the right time Cool


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
12-12-2010, 07:34 PM
Find


Messages In This Thread
RE: How to remove a Timer Loop which opens a door using AddPropForce? - by Frontcannon - 12-12-2010, 07:34 PM



Users browsing this thread: 3 Guest(s)