User Tag List

Results 1 to 5 of 5

Thread: Blue/Red Switch Gates

  1. #1
    Developer
    ZC Developer

    Join Date
    Aug 2006
    Location
    Australia
    Age
    37
    Posts
    2,777
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,851
    Level
    25
    vBActivity - Bars
    Lv. Percent
    37.74%

    Blue/Red Switch Gates

    Code:
    //
    // "Blue/Red Gates"
    // As seen in "A Link to the Past".
    // 
    // d0: the combo ID of the open gate.
    // d1: the combo ID of the closed gate.
    // d2: the combo ID of the Switch Orb.
    //
    // Flags:
    // * Run Script on Screen Init
    // Screen Variables Used:
    // * Screen 0, d0
    // Limitations:
    // * Only one Switch Orb allowed per screen!
    //
    ffc script BlueRedGates {
      void run(int bluegate, int redgate, int offorb) {
        int blue = Game->GetScreenD(0, 0);
        int orb = -1;
        bool switched = false;
        for (int i = 0; i<=176; i++) {
          if (Screen->ComboD[i]==offorb) orb=i;
        }
        while(true) {
          if (blue==1 || switched) {
            for (int i = 0; i<=176; i++) {
              if (Screen->ComboD[i]==bluegate) Screen->ComboD[i]=redgate;
              else if (Screen->ComboD[i]==redgate) Screen->ComboD[i]=bluegate;
            }
          }
          switched = false;
          while (!switched) {
            Waitframe();
            if (orb>=0 && Screen->ComboD[orb]!=offorb)
            {
                Waitframes(10);
    	    switched=true;
    	    Screen->ComboD[orb]=offorb;
                if (blue>0) {
                  blue=0;
                } else {
                  blue=1;
                }
                Game->SetScreenD(0, 0, blue);
            }
          }
        }
      }
    }
    Notes:

    * The switch gate status is stored in screen variable d0 on screen 0 of the current DMap. This can be replaced with a global variable if you so desire.

    * The "Switch Orb" is a combo whose ID is equal to d2. It assumes that there is only one of these combos on the screen, and that when the screen's Secret Combos are triggered, this combo will be changed.

    When the Switch Orb's combo changes (presumably to a "lit orb" combo), the script will restore it to its original combo after ten frames. This script currently does not alter the CSet of the Switch Orb, because hey, I don't know what tileset you're using.

    * Currently, this can only affect two types of combos per screen. If you want a script that raises/lowers multiple varieties of combos simultaneously, some alteration is required.

  2. #2
    Keese
    Join Date
    Mar 2007
    Age
    30
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    833
    Level
    10
    vBActivity - Bars
    Lv. Percent
    9.54%

    Re: Blue/Red Switch Gates

    Are you supposed to put flags on the gates? When I tried that and hit the switch, the gate that was originally up came down, and then changed into the combo that was before the closed gate. I doubt that is what is supposed to happen.

    Anyway, once I get this working, it will let me make my version of the Tower of Hera. (That is what everyone using a set with LTTP tiles will probably do with this. Doubtless some other people will make something crazy like a 6-floor Cerbat Shrine)

  3. #3
    Developer
    ZC Developer

    Join Date
    Aug 2006
    Location
    Australia
    Age
    37
    Posts
    2,777
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,851
    Level
    25
    vBActivity - Bars
    Lv. Percent
    37.74%

    Re: Blue/Red Switch Gates

    Quote Originally Posted by Pheonix View Post
    Are you supposed to put flags on the gates?
    What? Oh no, not at all. That's what the script is for!

  4. #4
    Keese
    Join Date
    Mar 2007
    Age
    30
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    833
    Level
    10
    vBActivity - Bars
    Lv. Percent
    9.54%

    Re: Blue/Red Switch Gates

    The second dungeon I'm making for NeoFirst is Winter Garden. There will be red/blue gates on all the screens I have made so far (I am not joking). However, despite setting it up exactly as it is set up in the little dungeon showing the red/blue gates, I still cannot get them to work. Rather annoying...

    Also, the script stops working if you exit and then reenter a room using the script. Not sure about warps, though.

  5. #5
    Developer
    ZC Developer

    Join Date
    Aug 2006
    Location
    Australia
    Age
    37
    Posts
    2,777
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,851
    Level
    25
    vBActivity - Bars
    Lv. Percent
    37.74%

    Re: Blue/Red Switch Gates

    Hmm... I suppose you're right. I've made a fix to the script just now.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social