Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
MasterofJKD

2 key switches 1 door with ACS script.

Recommended Posts

I was trying to make a yellow key switch and a blue key switch to open 1 door through ACS. Does anyone know how to do this and if so where can I learn the commands to do it. Also as a side note, I was curious if anyone has made an ACS script tutorial like a youtube video or something that you can follow and it would teach you how to do basic and advanced command lines. Any help would be appreciated. Thank you.

Share this post


Link to post

For acs tutorials, I recommend Chubz on youtube. As for your question, do you mean the player needs both keys at the same time?

Share this post


Link to post

yes he needs both the blue and the yellow keycard and hit the respective switches for the door to open.
And I searched on Youtube, and sadly there was only basic acs commands.

Share this post


Link to post
MasterofJKD said:

I was trying to make a yellow key switch and a blue key switch to open 1 door through ACS.

One way to make this work is through 3 separate scripts, as follows:

int yellowkey;
int bluekey;

Script 1 (void) //Opens doon when player has both blue & yellow keys

{If (yellowkey && bluekey)

{
    Door_Open (tag, speed, lighttag);
}
else
    print(s:"You need both the yellow & blue keys.");
}

Script 2 (void) //When yellow key is picked up

{
    yellowkey == 1;
}

Script 3 (void) //When blue key is picked up

{
    bluekey == 1;
}

Share this post


Link to post

Three scripts is overkill; one is more than enough.

The following code assumes the door to open is tagged 7. Replace 7 with any other value you need, as appropriate. I've also numbered that script 1, you can use a different number if you need to.

int bothswitches = 0;

Script 1 (void)
{
   if (++bothswitches == 2)
   {
       Door_Open(7, 64)
   }
}
The variable declared outside of the script itself will not be reset when the script is run, so each time the script is called, it will be incremented by one and then compared to 2. The first time it is run, it'll be worth 1 and the test will fail. The second time it is run, it'll be worth 2 and the test will succeed, resulting in a door that opens.

Now, let's call that switch. Your blue and your yellow switch will both have the special 83:ACS_LockedExecute. First parameter is the script number, so 1 in this example. Second parameter is the current map, so use 0. Third and fourth parameters are for script arguments, but we don't need them here so leave them as 0. The final parameter is the lock number: use 130 on the blue switch, and 131 on the yellow switch.

Share this post


Link to post

Thank you guys so much for the scripting, but I still have 1 more question, where did you guys pick up the ACS knowledge. Or better yet how should I get started, I mean I know the basic Door_Open script and the deep water effect, and other simple scripts like floor_lower and such but not this advanced. How would I learn the "if" scripts and the like?
Sorry for the wall of text...

Share this post


Link to post
MasterofJKD said:

where did you guys pick up the ACS knowledge

Here.

Share this post


Link to post

Isn't it possible to use CheckInventory? Like

if(CheckInventory("YellowCard") && CheckInventory("BlueCard"))
	Door_Open(7, 64);
else
	print(s:"You need both the yellow & blue keys.");

Share this post


Link to post

If what you want to do is a door that needs two keys to open, the simplest solution is to use LOCKDEFS and use that new lock number.

What the OP wanted was a door that opens after two switches have been activated. It just so happens one of the switches is blue-locked, the other yellow-locked.

Share this post


Link to post

I went through that tutorial a little so I know a few more basics, is there a way to identify the linedef switches, and then have the script check if each switch has been activated before it opens the door. I'm trying to fill in the if(....) statement.

Share this post


Link to post

Use the script I gave you a few posts above. Make the switches not repeatable (they shouldn't be repeatable by default). Foolproof.

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  
×