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
Script Help Any function for getting if a cabinet's closed?
Mooserider Offline
Member

Posts: 64
Threads: 11
Joined: Jan 2011
Reputation: 2
#1
Any function for getting if a cabinet's closed?

Hellooo everyone Smile In the level I'm working on I need to make it so that if the player gets inside a cabinet and closes the door a function is called. However, GetSwingDoorClosed won't work for it and neither will the method usually used for pulling levers. I couldn't find the answer anywhere else so it'd be awesome if someone knows here Tongue If all else fails I'll use a collide callback with the cabinet's doors but I'd rather do something a bit less messy. Undecided

Working on a FC: "Don't Let Go "
03-16-2012, 03:59 PM
Find
Equil Offline
Member

Posts: 94
Threads: 8
Joined: Sep 2010
Reputation: 0
#2
RE: Any function for getting if a cabinet's closed?

I just tested this with this script:

void OnStart() {

    SetEntityPlayerInteractCallback("cabinet_nice_1", "Cabinet", false);

}

void Cabinet(string &in asEntity) {

    if(GetSwingDoorState("cabinet_nice_1") == -1) {
    AddDebugMessage("CLOSED", false);
    }
    
    if(GetSwingDoorState("cabinet_nice_1") == 1) {
    AddDebugMessage("OPEN", false);
    }
    
}

I'm not really sure about this myself. But it seemed to work to an extent. I got both debug messages to appear when the cabinet was respectively open/closed. It also seems to work only when both is closed, the "CLOSED" message stopped appearing when I left one side open.
(This post was last modified: 03-17-2012, 12:18 PM by Equil.)
03-16-2012, 05:16 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#3
RE: Any function for getting if a cabinet's closed?

Script area callbacks might be your best choice. Since the GetSwingDoorState function returns an integer, there's no accounting for intermediate values. That is to say: Even if your door is open halfway, it still might be considered "closed".

03-16-2012, 05:56 PM
Find
Mooserider Offline
Member

Posts: 64
Threads: 11
Joined: Jan 2011
Reputation: 2
#4
RE: Any function for getting if a cabinet's closed?

Okay, thanks guise ^_^

Working on a FC: "Don't Let Go "
03-17-2012, 06:52 AM
Find
Stepper321 Offline
Senior Member

Posts: 263
Threads: 26
Joined: Nov 2011
Reputation: 8
#5
RE: Any function for getting if a cabinet's closed?

You could make it with Collision Areas Smile?

Signature to awesome to be displayed.
03-17-2012, 07:01 PM
Find




Users browsing this thread: 1 Guest(s)