Originally Posted by
pikaguy900
3: Is there a way to make a Global Script run and stop whenever you want it?
Yeeeah... Stungun, at PureZC, mentioned a way to make a Metroid-style escape timer. Only problem is..... I need it to begin at a certain point and end at another certain point. If they Global Scripts only run when you start a quest.... That will really ruin the quest. Thanks for the help. :)
Here, this is what I meant. Using the below code:
Use the script foo as one of your global scripts.
Make an ffc in the room which you want the timer to start in. Give it the ffc script start_timer, with the following argument values:
D0: How long before the timer runs out.
D1: Which DMap Link will warp to when the timer runs out.
D2: Which Screen Link will warp to when the timer runs out.
Make an ffc in the room which you want the timer to stop in. Give it the ffc script stop_timer.
Code:
global script foo {
int time = 0;
int max_time = 0;
int warp_dmap = 0;
int warp_screen = 0;
bool time_on = false;
void run() {
While(true) {
if(time_on) {
time += 1;
if(time >= max_time) {
Link->Warp(warp_dmap, warp_screen);
StopTimer();
}
}
Waitframe();
}
}
void StartTimer(int time, int dmap, int screen) {
time_on = true;
time = 0;
max_time = time;
warp_dmap = dmap;
warp_screen = screen;
}
void StopTimer() {
time_on = false;
}
}
ffc script start_timer {
void run(int time, int dmap, int screen) {
foo.StartTimer(time, dmap, screen);
}
}
ffc script stop_timer {
void run() {
foo.StopTimer();
}
}
This
should work, but I haven't tested it. So basically, upon entering the room with the first ffc, you have
x amount of time to reach the room with the second ffc, or Link will warp to the specified room.
Hopefully, this
is what you're looking for.