Having some problems with a line of code:
Object 0 is a door. I have the below code under "interact with object", interacting with the door causes it to open. I have this set up with a room variable, so that once you open it, if you interact with it again, it closes.
if (frontdoorright == 0){
SetObjectView(0,10);
AnimateObjectEx(0,0,4,0,0,1);
frontdoorleft = 1;
}
else if (frontdoorright == 1){
SetObjectView(0,10);
AnimateObjectEx(0,0,4,0,1,1);
frontdoorleft = 0;
}
Now, the problem is: the door starts out closed, and once you interact with it, the animation of the door opening plays. However, if you click it again, the same animation plays, the door opens.
The Below code is for the other door next to it. This code works fine, click it once, it opens, click it a second time, it closes.
if (frontdoorleft == 0){
SetObjectView(1,10);
AnimateObjectEx(1,1,4,0,0,1);
frontdoorleft = 1;
}
else if (frontdoorleft == 1){
SetObjectView(1,10);
AnimateObjectEx(1,1,4,0,1,1);
frontdoorleft = 0;
}
I'm hoping someone can point out what I'm doing wrong, I've been playing with this for an hour.
You use the same variable (frontdoorleft) for both doors?
Nay; each door has it's own respective variable:
object 0 = frontdoorright
object 1 = frontdoorleft
Yes, but you're confusing the two.
The top code checks frontdoorright, but sets frontdoorLEFT.
:-\
Well, I thank both of you gentlemen for you help, and I sincerely apologize for being a dumbass.
I must be tired or something...