Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //BIE_Imports.z
- import "std.zh"
- import "ffcscript.zh"
- //import "string.zh" //this is imported by default now
- import "ghost.zh"
- import "tango.zh"
- import "BIE_Variables.z"
- import "BIE_Functions.z"
- import "BIE_FFC.z"
- import "BIE_Items.z"
- import "BIE_Global.z"
- //BIE_Variable.z
- //DMap variables
- const int DMT_INTERIOR = 2;
- const int DMT_OVERWORLD = 1;
- const int DMT_DUNGEON = 0;
- int CURRENTDMAP = 0;
- //Day/Night cycle variables
- const int SUNRISE = 1;
- const int DAY = 0;
- const int SUNSET = 2;
- const int NIGHT = 3;
- const int DAY_PAL = 0;
- const int SUNRISET_PAL = 32;
- const int NIGHT_PAL = 33;
- const int NIGHT_OVERLAY_LAYER = 6;
- int CYCLE = 0;
- //In-game clock variables
- const int CLOCK_SECONDS = 0;
- const int CR_SECONDS = 30;
- const int CLOCK_MINUTES = 1;
- const int CR_MINUTES = 29;
- const int CLOCK_HOURS = 2;
- const int CR_HOURS = 28;
- const int CLOCK_DAYS = 3;
- const int CLOCK_MAX = 4;
- int InGameClock[4]={0, 0, 0, 1};
- //follower[0] variables
- int Binx = 17; //Item that makes the FFC follower[0] follow you
- int Caroline = 18;
- int PartySwitcher = 255;
- int follower[0]Caroline = 32; //The number of the FFC used. This script will "hijack" this one, so don't use it for anything else on screens when you expect the player to have a follower[0].
- int follower[0]Binx = 31;
- int firstfollower[0]CarolineCombo = 23568; //combo of the first combo. In order, the concecutive combos must be "still up", "still down", "still left", "still right", "moving up", "moving down", "moving left", "moving right".
- int firstfollower[0]BinxCombo = 24568;
- int csetOffollower[0]Caroline = 6;
- int csetOffollower[0]Binx = 6;
- bool firstCheck = false; //leave this alone
- ffc follower[1];
- int pastX;
- int currentX;
- int followerX[13];
- int pastY;
- int currentY;
- int followerY[13];
- int index;
- //BIE_FUnctions.z
- void DayNightCycle()
- {
- dmapdata dm = Game->LoadDMapData(Game->GetCurDMap());
- int type = dm->Type;
- if ( CURRENTDMAP != Game->GetCurDMap() || CURRENTSCREEN != Game->GetCurScreen() )
- {
- TraceNL();
- TraceS("Detected DMap Type: "); Trace(type);
- CURRENTDMAP = Game->GetCurDMap();
- CURRENTSCREEN = Game->GetCurScreen();
- }
- if ( type == DMT_INTERIOR )
- {
- TraceS("Interior DMap found by DayNightCycle()"); return;
- }
- if ( type == DMT_DUNGEON )
- {
- TraceNL(); TraceS("Dungeon DMap found by DayNightCycle()"); return;
- }
- else
- {
- if (InGameClock[CLOCK_HOURS] <= 5)
- {
- if (CYCLE != SUNRISE)
- {
- CYCLE = SUNRISE;
- TraceNL(); Game->DMapPalette[CURRENTDMAP] = SUNRISET_PAL;
- return;
- }
- }
- else if (InGameClock[CLOCK_HOURS] <= 11)
- {
- if (CYCLE != DAY)
- {
- CYCLE = DAY;
- Game->DMapPalette[CURRENTDMAP] = DAY_PAL;
- return;
- }
- }
- else if (InGameClock[CLOCK_HOURS] <= 17)
- {
- if (CYCLE != SUNSET)
- {
- CYCLE = SUNSET;
- Game->DMapPalette[CURRENTDMAP] = SUNRISET_PAL;
- return;
- }
- }
- else
- {
- if (CYCLE != NIGHT)
- {
- CYCLE = NIGHT;
- Game->DMapPalette[CURRENTDMAP] = NIGHT_PAL;
- return;
- }
- }
- return;
- }
- }
- void UpdateInGameClock()
- {
- Game->Counter[CR_SECONDS] = InGameClock[CLOCK_SECONDS];
- Game->Counter[CR_MINUTES] = InGameClock[CLOCK_MINUTES];
- Game->Counter[CR_HOURS] = InGameClock[CLOCK_HOURS];
- }
- void InGameClock()
- {
- InGameClock[CLOCK_SECONDS] +=2;
- if ( InGameClock[CLOCK_SECONDS] < 59 )
- {
- InGameClock[CLOCK_SECONDS] = 0;
- ++InGameClock[CLOCK_MINUTES];
- }
- if ( InGameClock[CLOCK_MINUTES] > 59 )
- {
- InGameClock[CLOCK_MINUTES] = 0;
- ++InGameClock[CLOCK_HOURS];
- }
- if ( InGameClock[CLOCK_HOURS] > 23 )
- {
- InGameClock[CLOCK_HOURS] = 0;
- ++InGameClock[CLOCK_DAYS];
- }
- }
- //Note that the following functions haven't been tested or are currently broken
- void SwitchCharacters()
- {
- if (Link->Item[PartySwitcher] == true && Link->PressEx2)
- {
- if (Link->Item[Binx] == true)
- {
- Link->Item[Caroline] = true;
- Link->Item[Binx] = false;
- }
- else if (Link->Item[Caroline] == true)
- {
- Link->Item[Caroline] = false;
- Link->Item[Binx] = true;
- }
- }
- }
- void Ex1Jump()
- {
- if (Link->Z == 0 && Link->PressEx1)
- {
- Game->PlaySound(SFX_JUMP);
- Link->Jump = 2;
- }
- }
- void AdventureParty()
- {
- //follower[0] global
- if(Link->Item[Binx] == true && Link->Item[PartySwitcher] == true)
- {
- if(Link->Action != LA_SCROLLING && firstCheck == false)
- {
- follower[0] = Screen->LoadFFC(follower[0]Caroline);
- follower[0]->Data = firstfollower[0]CarolineCombo;
- follower[0]->CSet = csetOffollower[0]Caroline;
- pastX = Link->X;
- follower[0]->X = Link->X;
- pastY = Link->Y;
- follower[0]->Y = Link->Y;
- for ( int i = 0; i < 13; i++ )
- {
- followerX[i] = Link->X;
- followerY[i] = Link->Y;
- }
- firstCheck = true;
- }
- if(Link->Action != LA_SCROLLING)
- {
- if((Link->InputUp || Link->InputDown || Link->InputRight || Link->InputLeft)&&(!(Link->InputA || Link->InputB))){
- pastX = follower[0]->X;
- follower[0]->X = followerX[0];
- for(index=0; index<12; index++)
- {
- followerX[index] = followerX[index + 1];
- }
- followerX[12] = Link->X;
- pastY = follower[0]->Y;
- follower[0]->Y = followerY[0];
- for(index=0; index<12; index++)
- {
- followerY[index] = followerY[index + 1];
- }
- followerY[12] = Link->Y;
- }
- if(follower[0]->Y > pastY)
- {
- follower[0]->Data = firstfollower[0]CarolineCombo + 5;
- }
- else if(follower[0]->Y < pastY)
- {
- follower[0]->Data = firstfollower[0]CarolineCombo + 4;
- }
- else if(follower[0]->X > pastX)
- {
- follower[0]->Data = firstfollower[0]CarolineCombo + 7;
- }
- else if(follower[0]->X < pastX)
- {
- follower[0]->Data = firstfollower[0]CarolineCombo + 6;
- }
- if(!(Link->InputUp || Link->InputDown || Link->InputRight || Link->InputLeft))
- {
- if((follower[0]->Data == (firstfollower[0]CarolineCombo + 4))||(follower[0]->Data == (firstfollower[0]CarolineCombo + 5))||(follower[0]->Data == (firstfollower[0]CarolineCombo + 6))||(follower[0]->Data == (firstfollower[0]CarolineCombo + 7)))
- {
- follower[0]->Data = follower[0]->Data - 4;
- }
- else if((follower[0]->Data == (firstfollower[0]CarolineCombo + 3))||(follower[0]->Data == (firstfollower[0]CarolineCombo + 2))||(follower[0]->Data == (firstfollower[0]CarolineCombo + 1))||(follower[0]->Data == (firstfollower[0]CarolineCombo)))
- {
- }
- else{
- follower[0]->Data = firstfollower[0]CarolineCombo;
- }
- }
- }
- if(Link->Action == LA_SCROLLING){
- firstCheck = false;
- }
- else if(Link->Item[Caroline] == true){
- if(Link->Action != LA_SCROLLING && firstCheck == false)
- {
- follower[0] = Screen->LoadFFC(follower[0]Binx);
- follower[0]->Data = firstfollower[0]BinxCombo;
- follower[0]->CSet = csetOffollower[0]Binx;
- pastX = Link->X;
- follower[0]->X = Link->X;
- pastY = Link->Y;
- follower[0]->Y = Link->Y;
- for ( int i = 0; i < 13; i++ ){
- followerX[i] = Link->X;
- followerY[i] = Link->Y;
- }
- firstCheck = true;
- }
- if(Link->Action != LA_SCROLLING)
- {
- if((Link->InputUp || Link->InputDown || Link->InputRight || Link->InputLeft)&&(!(Link->InputA || Link->InputB))){
- pastX = follower[0]->X;
- follower[0]->X = followerX[0];
- for(index=0; index<12; index++)
- {
- followerX[index] = followerX[index + 1];
- }
- followerX[12] = Link->X;
- pastY = follower[0]->Y;
- follower[0]->Y = followerY[0];
- for(index=0; index<12; index++)
- {
- followerY[index] = followerY[index + 1];
- }
- followerY[12] = Link->Y;
- }
- if(follower[0]->Y > pastY)
- {
- follower[0]->Data = firstfollower[0]BinxCombo + 5;
- }
- else if(follower[0]->Y < pastY)
- {
- follower[0]->Data = firstfollower[0]BinxCombo + 4;
- }
- else if(follower[0]->X > pastX)
- {
- follower[0]->Data = firstfollower[0]BinxCombo + 7;
- }
- else if(follower[0]->X < pastX)
- {
- follower[0]->Data = firstfollower[0]BinxCombo + 6;
- }
- if(!(Link->InputUp || Link->InputDown || Link->InputRight || Link->InputLeft)){
- if((follower[0]->Data == (firstfollower[0]BinxCombo + 4))||(follower[0]->Data == (firstfollower[0]BinxCombo + 5))||(follower[0]->Data == (firstfollower[0]BinxCombo + 6))||(follower[0]->Data == (firstfollower[0]BinxCombo + 7)))
- {
- follower[0]->Data = follower[0]->Data - 4;
- }
- else if((follower[0]->Data == (firstfollower[0]BinxCombo + 3))||(follower[0]->Data == (firstfollower[0]BinxCombo + 2))||(follower[0]->Data == (firstfollower[0]BinxCombo + 1))||(follower[0]->Data == (firstfollower[0]BinxCombo)))
- {
- }
- else{
- follower[0]->Data = firstfollower[0]BinxCombo;
- }
- }
- }
- if(Link->Action == LA_SCROLLING){
- firstCheck = false;
- }
- }
- }
- }
- //BIE_FFC.z is currently blank
- //BIE_Items.z is currently blank
- //BIE_Global.z
- global script slot_2
- {
- void run()
- {
- while(true)
- {
- InGameClock();
- UpdateInGameClock();
- DayNightCycle();
- Ex1Jump();
- SwitchCharacters();
- AdventureParty();
- Waitframe();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement