_L_
08-31-2007, 08:13 AM
//
// "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.
// "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.