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 If statement + locked door
DaAinGame Offline
Member

Posts: 90
Threads: 11
Joined: Mar 2012
Reputation: 4
#1
If statement + locked door

I feel like this is rather minor to make an entire thread over but I didn't find it anywhere else. Its rather simple what I'm trying to do. If a door is locked and it is interacted with, it displays a message.

if((GetSwingDoorLocked("cellar_wood01_3")==true) && (GetPropIsInteractedWith("cellar_wood01_3")==true))
{
SetMessage("Broke", "Jammed", 3);
}

That script creates no errors, but it does not display the message. I'm 99.99% positive its not a .lang issue either, as all the other messages work. The only thing I could come up with is that I shouldn't use GetPropIsInteractedWith but I don't know what else I could use.

Realm Of Another Chapter 1: http://www.frictionalgames.com/forum/thread-14142.html
Realm Of Another Chapter 2: Postponed
Adder Halls: 5%
03-20-2012, 10:44 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#2
RE: If statement + locked door

My guess is that your parameters for the function to run upon the player interacting with the door are incorrect. Is the interaction scripted using SetEntityPlayerInteractCallback() or using SetEntityCallbackFunc()? The parameters are different for each interaction. The first uses a single parameter, the entity name, while the second uses two -- the entity name and the type of interaction.

When checking for truth or falsehood, you don't need to assert that your Boolean value equals true or false. You can simply use



if(GetSwingDoorLocked("cellar_wood01_3") && GetPropIsInteractedWith("cellar_wood01_3")) // code here


Also, you are correct -- there isn't any need to check if the prop is interacted with. Since the function is run when the player interacts with the door, GetPropIsInteractedWith will always be true.

03-21-2012, 12:02 AM
Find
DaAinGame Offline
Member

Posts: 90
Threads: 11
Joined: Mar 2012
Reputation: 4
#3
RE: If statement + locked door

I fixed it, but I used a slightly different manner of doing it. Anyways thanks for the reply, going to go ahead and release a somewhat of a beta now.

Realm Of Another Chapter 1: http://www.frictionalgames.com/forum/thread-14142.html
Realm Of Another Chapter 2: Postponed
Adder Halls: 5%
03-21-2012, 12:26 AM
Find




Users browsing this thread: 1 Guest(s)