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
Unlock door when timer is run out
dasde Offline
Junior Member

Posts: 30
Threads: 6
Joined: May 2011
Reputation: 0
#1
Unlock door when timer is run out

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
05-27-2011, 02:31 PM
Find
Greven Offline
Member

Posts: 106
Threads: 13
Joined: May 2011
Reputation: 3
#2
RE: Unlock door when timer is run out

Well then you just
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.

[WIP] Recidivus
(This post was last modified: 05-27-2011, 02:36 PM by Greven.)
05-27-2011, 02:35 PM
Find
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
#3
RE: Unlock door when timer is run out

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

[Image: 44917299.jpg]Dubstep <3
(This post was last modified: 05-27-2011, 02:46 PM by xtron.)
05-27-2011, 02:46 PM
Find
dasde Offline
Junior Member

Posts: 30
Threads: 6
Joined: May 2011
Reputation: 0
#4
RE: Unlock door when timer is run out

Niether of the two scripts work
05-27-2011, 02:51 PM
Find
Greven Offline
Member

Posts: 106
Threads: 13
Joined: May 2011
Reputation: 3
#5
RE: Unlock door when timer is run out

(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?

[WIP] Recidivus
(This post was last modified: 05-27-2011, 02:54 PM by Greven.)
05-27-2011, 02:51 PM
Find
dasde Offline
Junior Member

Posts: 30
Threads: 6
Joined: May 2011
Reputation: 0
#6
RE: Unlock door when timer is run out

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
Find
Greven Offline
Member

Posts: 106
Threads: 13
Joined: May 2011
Reputation: 3
#7
RE: Unlock door when timer is run out

(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:
OnEnter()
{
AddTimer("", 30.0f, DoorOpen)
}

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

[WIP] Recidivus
05-27-2011, 03:00 PM
Find
dasde Offline
Junior Member

Posts: 30
Threads: 6
Joined: May 2011
Reputation: 0
#8
RE: Unlock door when timer is run out

(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:
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.
05-27-2011, 03:04 PM
Find
Henriksen Offline
Senior Member

Posts: 308
Threads: 71
Joined: Dec 2010
Reputation: 2
#9
RE: Unlock door when timer is run out

Then you are doing something wrong send us the WHOLE script and let us see?
05-27-2011, 03:08 PM
Find
dasde Offline
Junior Member

Posts: 30
Threads: 6
Joined: May 2011
Reputation: 0
#10
RE: Unlock door when timer is run out

(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:
//===========================================
     // 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.
05-27-2011, 03:11 PM
Find




Users browsing this thread: 2 Guest(s)