Miniboss Portal
In the gameboy Zelda games, killing a miniboss will result in a portal opening between the miniboss's room and the dungeon entrance. This script allows you to do this in your own quest.
Script
import "std.zh"
int setbit(int v, int num, bool b) {
int mask = Pow(2, num);
if(b) {
return (v | mask);
} else {
if(getbit(v,num))
return(v - mask);
else
return(v);
}
}
bool getbit(int v, int num) {
if(num <= 0) return(false);
int ret = v >> num;
return((ret & 1b) == 1);
}
ffc script minibosswarp {
void run(int lev, int wt) {
int tx;
int ty;
tx = this->X;
ty = this->Y;
this->X = -16;
this->Y = -16;
//Change this to how you determine the miniboss is dead
while(getbit(mb_defeated, lev) == false) {
Waitframe();
}
this->X = tx;
this->Y = ty;
//Game->PlaySound(32);
//In case he's standing on top of the warp when it appears
while(Link->X + 8 >= this->X && Link->X <= this->X + 8 && Link->Y + 8 >= this->Y && Link->Y <= this->Y + 8) {
Waitframe();
}
while(Link->X + 8 < this->X || Link->X > this->X + 8 || Link->Y + 8 < this->Y || Link->Y > this->Y + 8) {
Waitframe();
}
Link->X = this->X;
Link->Y = this->Y;
Link->Action = LA_FROZEN;
Link->Dir = DIR_DOWN;
int i;
for(i = 6; i >= 0; i--) {
Link->Dir = DIR_LEFT;
Waitframes(i);
Link->Dir = DIR_UP;
Waitframes(i);
Link->Dir = DIR_RIGHT;
Waitframes(i);
Link->Dir = DIR_DOWN;
Waitframes(i);
}
Link->Action = LA_NONE;
Screen->ComboD[ComboAt(Link->X, Link->Y)] = wt;
Waitframe();
}
}
Arguments
- The "level" of the miniboss. Used to determine whether or not the portal should appear at all.
- The combo of a "Sensitive Warp" combo to do the actual warp. Should match your floor.
Notes
- Although I use a bitfield in my script to determine if a given miniboss is dead (get/setbit()), you can change the method if you already use a different method.
- Don't warp Link to ontop of the other portal, since it will then trigger, and Link'll get stuck in an infinite loop.
Screen shots





