Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
FearNoEvil

Connecting actions and disabeling others

Recommended Posts

Basically how do you connect actions but also disable other actions in the same script. Let's say the player presses a button to lower platform 1, platform 1 lowers, but the button for platform 2 is now unusable, and vice versa. I'm reading the wiki but I'm not grasping this.

 

Using switch/case function:

 

Script 1 (void)
{
 switch(Plat_DownByValue(3,6, 0, 17))
 {
  case 1:
  Plat_DownByValue(3, 6, 0, 17);
  break;
  }
  switch (Plat_DownByValue(4, 6, 0, 17))
  {
  case 1:
  Plat_DownByValue(4, 6, 0, 17);
  }

 

Share this post


Link to post

Ok ok. After some rest and a bit more reading I'm finally getting somewhere. I realize the errors of my ways so I scrapped the above script and made a new one.

 

#include "zcommon.acs"

bool platform1Lowered = false;
bool platform2Lowered = false;

Script 1 (int platformNumber)
{// One platform lowers the other gets disabled permanently, vice versa
    if (platformNumber == 1)
    {
        platform1Lowered = true;
        Plat_DownByValue(1,15,0,17);
    }
    else if (platformNumber == 2)
    {
        platform2Lowered = false;
    }


    if (platformNumber == 2)
    {
        platform2Lowered = true;
        Plat_DownByValue(2,15,0,17);
    }
    else if (platformNumber == 2)
    {
        platform1Lowered = false;
    }
}

 

It works sorta. The platforms lower after pressing their respective switches, but what I want is after pressing one switch, the other switch for the other platform is disabled permanently, i.e. the other switch doesn't flip and its platform does not lower. 

 

 

Share this post


Link to post

How about this? The second switch will still flip, but won't do anything. It would take more tinkering to make it so it doesn't. I just put this together in my head, so hopefully it's correct.

 

#include "zcommon.acs"

bool platform1Lowered = false;
bool platform2Lowered = false;

Script 1 (int platformNumber)
{
    if (platformNumber == 1 && platform1Lowered == false)
    {
        platform1Lowered = true;

        platform2Lowered = true;
        Plat_DownByValue(1,15,0,17);
    }


    else if (platformNumber == 2 && platform2Lowered == false )
    {

        platform1Lowered = true;
        platform2Lowered = true;
        Plat_DownByValue(2,15,0,17);
    }
}

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×