Jump to content
  • 0

Fnaf style door


Skemech

Question

I'm trying to use acs to make a door that you can toggle on and off seperately... wtf am I doing wrong?

image_2023-10-26_022102566.png.dfc003ab17320d3cdb73ed02e9a49f2d.png

Share this post


Link to post

4 answers to this question

Recommended Posts

  • 1

You'll want to use a 'void' script, since your bool variable is initialized globally.

 

You can also use 'if / else' logic instead of two 'ifs' if you're just checking if a bool is true or false.

 

Fixed script (tested this on my end and it works fine):

#include "zcommon.acs"

bool flag = TRUE;

script 1 (void) {
	if (flag == TRUE) {
		Door_Open(1, 32, 0);
		flag = FALSE;
	}

	else {
		Door_Close(1,32,0);
		flag = TRUE;
	}

}

 

Edited by SirPootis

Share this post


Link to post
  • 0

The "kys" is a placeholder, I just needed to put something fast so I could test the door... the door wasn't a success

Share this post


Link to post
  • 0
21 minutes ago, SirPootis said:

You'll want to use a 'void' script, since your bool variable is initialized globally.

 

You can also use 'if / else' logic instead of two 'ifs' if you're just checking if a bool is true or false.

 

Fixed script (tested this on my end and it works fine):


#include "zcommon.acs"

bool flag = TRUE;

script 1 (void) {
	if (flag == TRUE) {
		Door_Open(1, 32, 0);
		flag = FALSE;
	}

	else {
		Door_Close(1,32,0);
		flag = TRUE;
	}

}

 

 

===========

 

"ELSE" OMFG "ELSE"?!?!?

 

I can't believe I didn't think about it, thank you a million, it worked bro, god ur a real one for that

Share this post


Link to post
Guest
This topic is now closed to further replies.
×
×
  • Create New...