Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support


Post Reply 
 
Thread Rating:
  • 2 Votes - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to remove a Timer Loop which opens a door using AddPropForce?
Author Message
Frontcannon Offline
Senior Member

Posts: 538
Joined: Jul 2010
Reputation: 2
Post: #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 all posts by this user Quote this message in a reply
Post Reply 


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



User(s) browsing this thread: 1 Guest(s)