Frictional Games Forum (read-only)

Full Version: Unlock door when timer is run out
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello

I am sitting with a script, and I cant really figure out how to set up a script that unlocks a swingdoor after the timer "Door" has ran out.


I would like to know how I do this.


Thank you
Well then you just
Code:
void door(string &in asTimer)
{
SetSwingDoorLocked("the doors name", false, true)
}
I dont remember what the "true" did but you can just try and see for yourself if its supposed to be true or false.
Code:
void door(string &in asTimer)
{
AddTimer("", 60.0f, "Door_timer");
}


void Door_timer(string &in asTimer)
{
SetSwingDoorLocked("DOORNAME", false, true);
}

After 60seconds the function "Door_timer" will activate and unlock the door "DOORNAME". Correct me if I'm wrong 'cuz I'm new to scripting ;D
Niether of the two scripts work
(05-27-2011, 02:51 PM)dasde Wrote: [ -> ]Niether of the two scripts work

Can we see youre script then? And what is the name of the door in youre level editor?
Thanks for the fast replies, very nice.

The door name is:

BruteDoor_1


There is nothing in the script yet, I am starting with the timer. I have the OnStart, OnEnter and OnLeave, all the starter stuff.
(05-27-2011, 02:54 PM)dasde Wrote: [ -> ]Thanks for the fast replies, very nice.

The door name is:

BruteDoor_1


There is nothing in the script yet, I am starting with the timer. I have the OnStart, OnEnter and OnLeave, all the starter stuff.

Ok so is the timer for the beginning or when you enter a area?

If its in the beginning (on enter) then:
Code:
OnEnter()
{
AddTimer("", 30.0f, DoorOpen)
}

void DoorOpen(string &in asTimer)
{
SetSwingDoorLocked("BruteDoor_1", false, true)
}
(05-27-2011, 03:00 PM)Greven Wrote: [ -> ]
(05-27-2011, 02:54 PM)dasde Wrote: [ -> ]Thanks for the fast replies, very nice.

The door name is:

BruteDoor_1


There is nothing in the script yet, I am starting with the timer. I have the OnStart, OnEnter and OnLeave, all the starter stuff.

Ok so is the timer for the beginning or when you enter a area?

If its in the beginning (on enter) then:
Code:
OnEnter()
{
AddTimer("", 30.0f, DoorOpen)
}

void DoorOpen(string &in asTimer)
{
SetSwingDoorLocked("BruteDoor_1", false, true)
}

Didnt work. If you can use this information, then the door is locked in the editor.
Then you are doing something wrong send us the WHOLE script and let us see?
(05-27-2011, 03:08 PM)teddifisk Wrote: [ -> ]Then you are doing something wrong send us the WHOLE script and let us see?

Well if you absolutely want it, then here it is:
Code:
//===========================================
     // Starter's Script File!
     //===========================================

     //===========================================
     // This runs when the map first starts
     void OnStart()
     {
        AddUseItemCallback("UseKeyOnDoor", "key_tomb_rusty_2", "level_wood_1", "UseKeyOnDoor", true);
     }
    
        
    



     //===========================================
     // This runs when the player enters the map
     void OnEnter()
     {
     AddTimer("", 52.0f, "Door_Timer");
     }

     //===========================================
     // This runs when the player leaves the map
     void OnLeave()
     {
     }
    
    
     //===========================================
    
/////////////////////////////////
//LAST DOOR//
void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
    PlaySoundAtEntity("unlocked", "unlock_door", asEntity, 0.0f, false);
    
    GiveSanityBoostSmall();
    
    SetLevelDoorLocked(asEntity, false);
    RemoveItem(asItem);
    
    CompleteQuest("02LockedDoosr", "02LockedDoor");

    
}
//LAST DOOR//
///////////////////////////////


///////////////////////////////
// START SWING DOOR

void Door_timer(string &in asTimer)
{
SetSwingDoorLocked("BruteDoor_1", false, true);
}



For the record, LAST DOOR is a door that leads to another map, but the code is taken from another script. LevelDoors is oddly easier to work with.
Pages: 1 2