PDA

View Full Version : Day and Night script.



Russ
11-27-2007, 11:46 AM
I just made (with some help) my first script! It allows you to have a day and night system! Here is the script:


global script daynight {
void run() {
int frames=0;
int daydmap1=;
int daydmap2=;
int twilightdmap1=;
int twilightdmap2=;
int nightdmap1=;
int nightdmap2=;
int morningdmap1=;
int morningdmap2=;
int screen;

while(Game->GetCurDMap() == daydmap1){
if(frames == 7200) {
screen = Game->GetCurScreen();
Link->PitWarp(twilightdmap1, screen);
frames = 0;
}
Waitframe(); frames++;
}


while(Game->GetCurDMap() == twilightdmap1){
if(frames == 1200) {
screen = Game->GetCurScreen();
Link->PitWarp(nightdmap1, screen);
frames = 0;
}
Waitframe(); frames++;
}


while(Game->GetCurDMap() == nightdmap1){
if(frames == 7200) {
screen = Game->GetCurScreen();
Link->PitWarp(morningdmap1, screen);
frames = 0;
}
Waitframe(); frames++;
}


while(Game->GetCurDMap() == morningdmap1){
if(frames == 1200) {
screen = Game->GetCurScreen();
Link->PitWarp(daydmap1, screen);
frames = 0;
}
Waitframe(); frames++;
}


while(Game->GetCurDMap() == daydmap2){
if(frames == 7200) {
screen = Game->GetCurScreen();
Link->PitWarp(twilightdmap2, screen);
frames = 0;
}
Waitframe(); frames++;
}


while(Game->GetCurDMap() == twilightdmap2){
if(frames == 1200) {
screen = Game->GetCurScreen();
Link->PitWarp(nightdmap2, screen);
frames = 0;
}
Waitframe(); frames++;
}


while(Game->GetCurDMap() == nightdmap2){
if(frames == 7200) {
screen = Game->GetCurScreen();
Link->PitWarp(morningdmap2, screen);
frames = 0;
}
Waitframe(); frames++;
}


while(Game->GetCurDMap() == morningdmap2){
if(frames == 1200) {
screen = Game->GetCurScreen();
Link->PitWarp(daydmap2, screen);
frames = 0;
}
Waitframe(); frames++;
}
}
}

Some setup is required. First, you have to make four dmaps. Allof them must be on the same map. One for day, one for evening, one for night, and one for morning. Then, input their number into the script here:

int daydmap1= ;
int daydmap2= ;
int twilightdmap1= ;
int twilightdmap2= ;
int nightdmap1= ;
int nightdmap2= ;
int morningdmap1= ;
int morningdmap2= ;

Yes, the script allows you to have two maps that cycle from day to night. After you input the dmap number, that's all you have to do. The script will keep you in the day for two minutes, then make it evening for 17 seconds, then night for two minutes, then morning for 17 seconds. Here is a test quest I made. Uses build 679: http://www.mediafire.com/download.php?1n3lth8oikw (http://www.mediafire.com/download.php?1n3lth8oikw).

Thanks DarkDragon, Joe123, and Gleeok for helping me make the script!

C-Dawg
11-27-2007, 12:21 PM
How does the script handle:

1. Warps on the DMAP? Does time pass while you're indoors?
2. Slashables like bushes that might be slashed before a change in time?

Russ
11-27-2007, 12:47 PM
How does the script handle:

1. Warps on the DMAP? Does time pass while you're indoors?
2. Slashables like bushes that might be slashed before a change in time?
Unfortuntly, currently it dosn't handle those. This is my first script, after all. It resets when you go to another dmap. If anyone knows how to make it keep track of time on another dmap, please tell me.

Joe123
11-27-2007, 01:03 PM
* Fixed a deficiency with warps by adding an overlay flag to tile, side, and whistle warp types. When this is set, any combo on the new screen that is 0 will be replaced with whatever combo is in that position on the old screen. This allows combos to carry over (slashed bushes, for example)
perhaps?

I was more worried about how it'd work with items left in the areas personally.