DaAinGame
Member
Posts: 90
Threads: 11
Joined: Mar 2012
Reputation:
4
|
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.
|
|
03-20-2012, 10:44 PM |
|
palistov
Posting Freak
Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation:
57
|
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 |
|
DaAinGame
Member
Posts: 90
Threads: 11
Joined: Mar 2012
Reputation:
4
|
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.
|
|
03-21-2012, 12:26 AM |
|