ZoriaRPG

Binx Global Fix

Jun 22nd, 2018
119
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //BIE_Imports.z
  2. import "std.zh"
  3. import "ffcscript.zh"
  4. //import "string.zh" //this is imported by default now
  5. import "ghost.zh"
  6. import "tango.zh"
  7. import "BIE_Variables.z"
  8. import "BIE_Functions.z"
  9. import "BIE_FFC.z"
  10. import "BIE_Items.z"
  11. import "BIE_Global.z"
  12.  
  13. //BIE_Variable.z
  14. //DMap variables
  15. const int DMT_INTERIOR = 2;
  16. const int DMT_OVERWORLD = 1;
  17. const int DMT_DUNGEON = 0;
  18. int CURRENTDMAP = 0;
  19.  
  20. //Day/Night cycle variables
  21. const int SUNRISE = 1;
  22. const int DAY = 0;
  23. const int SUNSET = 2;
  24. const int NIGHT = 3;
  25. const int DAY_PAL = 0;
  26. const int SUNRISET_PAL = 32;
  27. const int NIGHT_PAL = 33;
  28. const int NIGHT_OVERLAY_LAYER = 6;
  29. int CYCLE = 0;
  30.  
  31. //In-game clock variables
  32. const int CLOCK_SECONDS = 0;
  33. const int CR_SECONDS = 30;
  34. const int CLOCK_MINUTES = 1;
  35. const int CR_MINUTES = 29;
  36. const int CLOCK_HOURS = 2;
  37. const int CR_HOURS = 28;
  38. const int CLOCK_DAYS = 3;
  39. const int CLOCK_MAX = 4;
  40. int InGameClock[4]={0, 0, 0, 1};
  41.  
  42.  
  43. //follower[0] variables
  44. int Binx = 17; //Item that makes the FFC follower[0] follow you
  45. int Caroline = 18;
  46. int PartySwitcher = 255;
  47. 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].
  48. int follower[0]Binx = 31;
  49. 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".
  50. int firstfollower[0]BinxCombo = 24568;
  51. int csetOffollower[0]Caroline = 6;
  52. int csetOffollower[0]Binx = 6;
  53. bool firstCheck = false; //leave this alone
  54. ffc follower[1];
  55. int pastX;
  56. int currentX;
  57. int followerX[13];
  58. int pastY;
  59. int currentY;
  60. int followerY[13];
  61. int index;
  62.  
  63. //BIE_FUnctions.z
  64. void DayNightCycle()
  65. {
  66.     dmapdata dm = Game->LoadDMapData(Game->GetCurDMap());
  67.     int type = dm->Type;  
  68.    
  69.    
  70.     if ( CURRENTDMAP != Game->GetCurDMap() || CURRENTSCREEN != Game->GetCurScreen() )
  71.     {
  72.    
  73.         TraceNL();
  74.         TraceS("Detected DMap Type: "); Trace(type);
  75.         CURRENTDMAP = Game->GetCurDMap();
  76.         CURRENTSCREEN = Game->GetCurScreen();
  77.     }
  78.    
  79.     if ( type == DMT_INTERIOR )
  80.     {
  81.         TraceS("Interior DMap found by DayNightCycle()"); return;
  82.     }
  83.     if ( type == DMT_DUNGEON )
  84.     {
  85.         TraceNL(); TraceS("Dungeon DMap found by DayNightCycle()"); return;
  86.     }
  87.     else
  88.     {
  89.         if (InGameClock[CLOCK_HOURS] <= 5)
  90.         {
  91.             if (CYCLE != SUNRISE)
  92.             {
  93.                 CYCLE = SUNRISE;
  94.                 TraceNL(); Game->DMapPalette[CURRENTDMAP] = SUNRISET_PAL;
  95.                 return;
  96.             }
  97.         }
  98.         else if (InGameClock[CLOCK_HOURS] <= 11)
  99.         {
  100.             if (CYCLE != DAY)
  101.             {
  102.        
  103.                 CYCLE = DAY;
  104.                 Game->DMapPalette[CURRENTDMAP] = DAY_PAL;
  105.                 return;
  106.             }
  107.         }
  108.         else if (InGameClock[CLOCK_HOURS] <= 17)
  109.         {
  110.             if (CYCLE != SUNSET)
  111.             {
  112.                 CYCLE = SUNSET;
  113.                 Game->DMapPalette[CURRENTDMAP] = SUNRISET_PAL;
  114.                 return;
  115.             }
  116.         }
  117.         else
  118.         {
  119.             if (CYCLE != NIGHT)
  120.             {
  121.                 CYCLE = NIGHT;
  122.                 Game->DMapPalette[CURRENTDMAP] = NIGHT_PAL;
  123.                 return;
  124.             }
  125.         }
  126.         return;    
  127.     }    
  128. }
  129.  
  130. void UpdateInGameClock()
  131. {
  132.    Game->Counter[CR_SECONDS] = InGameClock[CLOCK_SECONDS];
  133.    Game->Counter[CR_MINUTES] = InGameClock[CLOCK_MINUTES];
  134.    Game->Counter[CR_HOURS] = InGameClock[CLOCK_HOURS];  
  135. }
  136.  
  137. void InGameClock()
  138. {
  139.         InGameClock[CLOCK_SECONDS] +=2;
  140.     if ( InGameClock[CLOCK_SECONDS] < 59 )
  141.     {
  142.         InGameClock[CLOCK_SECONDS] = 0;
  143.         ++InGameClock[CLOCK_MINUTES];
  144.     }
  145.     if ( InGameClock[CLOCK_MINUTES] > 59 )
  146.     {
  147.         InGameClock[CLOCK_MINUTES] = 0;
  148.         ++InGameClock[CLOCK_HOURS];
  149.     }
  150.     if ( InGameClock[CLOCK_HOURS] > 23 )
  151.     {
  152.         InGameClock[CLOCK_HOURS] = 0;
  153.         ++InGameClock[CLOCK_DAYS];
  154.     }
  155. }
  156. //Note that the following functions haven't been tested or are currently broken
  157. void SwitchCharacters()
  158. {
  159.         if (Link->Item[PartySwitcher] == true && Link->PressEx2)
  160.         {
  161.             if (Link->Item[Binx] == true)
  162.                 {
  163.                 Link->Item[Caroline] = true;
  164.                 Link->Item[Binx] = false;
  165.                 }
  166.                
  167.             else if (Link->Item[Caroline] == true)
  168.                 {
  169.                 Link->Item[Caroline] = false;
  170.                 Link->Item[Binx] = true;
  171.                 }
  172.         }
  173. }
  174.  
  175. void Ex1Jump()
  176. {
  177.     if (Link->Z == 0 && Link->PressEx1)
  178.             {
  179.                 Game->PlaySound(SFX_JUMP);
  180.                 Link->Jump = 2;
  181.             }
  182. }
  183.  
  184. void AdventureParty()
  185. {
  186.     //follower[0] global
  187.     if(Link->Item[Binx] == true && Link->Item[PartySwitcher] == true)
  188.     {
  189.         if(Link->Action != LA_SCROLLING && firstCheck == false)
  190.         {
  191.         follower[0] = Screen->LoadFFC(follower[0]Caroline);
  192.         follower[0]->Data = firstfollower[0]CarolineCombo;
  193.         follower[0]->CSet = csetOffollower[0]Caroline;
  194.  
  195.         pastX = Link->X;
  196.         follower[0]->X = Link->X;
  197.         pastY = Link->Y;
  198.         follower[0]->Y = Link->Y;
  199.  
  200.         for ( int i = 0; i < 13; i++ )
  201.         {
  202.             followerX[i] = Link->X;
  203.             followerY[i] = Link->Y;
  204.         }
  205.  
  206.         firstCheck = true;
  207.         }
  208.         if(Link->Action != LA_SCROLLING)
  209.         {
  210.         if((Link->InputUp || Link->InputDown || Link->InputRight || Link->InputLeft)&&(!(Link->InputA || Link->InputB))){
  211.             pastX = follower[0]->X;
  212.             follower[0]->X = followerX[0];
  213.             for(index=0; index<12; index++)
  214.             {
  215.             followerX[index] = followerX[index + 1];
  216.             }
  217.             followerX[12] = Link->X;
  218.  
  219.             pastY = follower[0]->Y;
  220.             follower[0]->Y = followerY[0];
  221.             for(index=0; index<12; index++)
  222.             {
  223.             followerY[index] = followerY[index + 1];
  224.             }
  225.             followerY[12] = Link->Y;
  226.         }
  227.  
  228.         if(follower[0]->Y > pastY)
  229.         {
  230.             follower[0]->Data = firstfollower[0]CarolineCombo + 5;
  231.         }
  232.         else if(follower[0]->Y < pastY)
  233.         {
  234.             follower[0]->Data = firstfollower[0]CarolineCombo + 4;
  235.         }
  236.         else if(follower[0]->X > pastX)
  237.         {
  238.             follower[0]->Data = firstfollower[0]CarolineCombo + 7;
  239.         }
  240.         else if(follower[0]->X < pastX)
  241.         {
  242.             follower[0]->Data = firstfollower[0]CarolineCombo + 6;
  243.         }
  244.         if(!(Link->InputUp || Link->InputDown || Link->InputRight || Link->InputLeft))
  245.         {
  246.             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)))
  247.             {
  248.             follower[0]->Data = follower[0]->Data - 4;
  249.             }
  250.             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)))
  251.             {
  252.                
  253.             }
  254.             else{
  255.             follower[0]->Data = firstfollower[0]CarolineCombo;
  256.             }
  257.         }
  258.             }
  259.         if(Link->Action == LA_SCROLLING){
  260.         firstCheck = false;
  261.             }
  262.    else if(Link->Item[Caroline] == true){
  263.         if(Link->Action != LA_SCROLLING && firstCheck == false)
  264.         {
  265.         follower[0] = Screen->LoadFFC(follower[0]Binx);
  266.         follower[0]->Data = firstfollower[0]BinxCombo;
  267.         follower[0]->CSet = csetOffollower[0]Binx;
  268.  
  269.         pastX = Link->X;
  270.         follower[0]->X = Link->X;
  271.         pastY = Link->Y;
  272.         follower[0]->Y = Link->Y;
  273.  
  274.         for ( int i = 0; i < 13; i++ ){
  275.             followerX[i] = Link->X;
  276.             followerY[i] = Link->Y;
  277.         }
  278.  
  279.         firstCheck = true;
  280.         }
  281.         if(Link->Action != LA_SCROLLING)
  282.         {
  283.         if((Link->InputUp || Link->InputDown || Link->InputRight || Link->InputLeft)&&(!(Link->InputA || Link->InputB))){
  284.             pastX = follower[0]->X;
  285.             follower[0]->X = followerX[0];
  286.             for(index=0; index<12; index++)
  287.             {
  288.             followerX[index] = followerX[index + 1];
  289.             }
  290.             followerX[12] = Link->X;
  291.  
  292.             pastY = follower[0]->Y;
  293.             follower[0]->Y = followerY[0];
  294.             for(index=0; index<12; index++)
  295.             {
  296.             followerY[index] = followerY[index + 1];
  297.             }
  298.             followerY[12] = Link->Y;
  299.         }
  300.  
  301.         if(follower[0]->Y > pastY)
  302.         {
  303.             follower[0]->Data = firstfollower[0]BinxCombo + 5;
  304.         }
  305.         else if(follower[0]->Y < pastY)
  306.         {
  307.             follower[0]->Data = firstfollower[0]BinxCombo + 4;
  308.         }
  309.         else if(follower[0]->X > pastX)
  310.         {
  311.             follower[0]->Data = firstfollower[0]BinxCombo + 7;
  312.         }
  313.         else if(follower[0]->X < pastX)
  314.         {
  315.             follower[0]->Data = firstfollower[0]BinxCombo + 6;
  316.         }
  317.         if(!(Link->InputUp || Link->InputDown || Link->InputRight || Link->InputLeft)){
  318.             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)))
  319.             {
  320.             follower[0]->Data = follower[0]->Data - 4;
  321.             }
  322.             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)))
  323.             {
  324.                
  325.             }
  326.             else{
  327.             follower[0]->Data = firstfollower[0]BinxCombo;
  328.             }
  329.         }
  330.       }
  331.       if(Link->Action == LA_SCROLLING){
  332.       firstCheck = false;
  333.       }
  334.     }            
  335.   }
  336. }
  337.  
  338. //BIE_FFC.z is currently blank
  339.  
  340. //BIE_Items.z is currently blank
  341.  
  342. //BIE_Global.z
  343. global script slot_2
  344. {
  345.     void run()
  346.     {    
  347.  
  348.         while(true)
  349.         {  
  350.             InGameClock();
  351.             UpdateInGameClock();
  352.             DayNightCycle();
  353.             Ex1Jump();
  354.             SwitchCharacters();
  355.             AdventureParty();
  356.            
  357.             Waitframe();
  358.         }
  359.     }
  360. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×