ZoriaRPG

Faster Conveyor Belts for ZC v0.1.1 - 12-Nov-2016

Nov 12th, 2016
110
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /////////////////////////////
  2. /// Faster Conveyor Belts ///
  3. /// v0.1.1                ///
  4. /// 12-Nov-2016           ///
  5. /// By: ZoriaRPG          ///
  6. /////////////////////////////////////////////////////////////////////////////////
  7. /// Purpose: This allows creating conveyor belts that move *Link* faster than ///
  8. /// the stock ZC conveyors.                                                   ///
  9. ///                                                                           ///
  10. /// Future versions may support bombs, items, somaria blocks, and npcs.       ///
  11. /// I have *no plans* to add, or support creating *slower* conveyors with     ///
  12. /// this header.                                                              ///
  13. /////////////////////////////////////////////////////////////////////////////////
  14.  
  15. //FFC Version
  16.  
  17. ffc script FasterConveyors{
  18.     void run(int speed, int step){
  19.         int timer = speed;
  20.         while(true){
  21.             if ( Screen->ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVLEFT ) {
  22.                 if ( !timer ) timer = speed;
  23.                 if ( timer > 1 ) timer--;
  24.                 if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_LEFT, step, false) ) {
  25.                     Link->X--;
  26.                     timer = speed;
  27.                 }
  28.             }
  29.             else if ( Screen->ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVRIGHT ) {
  30.                 if ( !timer ) timer = speed;
  31.                 if ( timer > 1 ) timer--;
  32.                 if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_RIGHT, step, false) ) {
  33.                     Link->X++;
  34.                     timer = speed;
  35.                 }
  36.             }
  37.             else if ( Screen->ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVUP ) {
  38.                 if ( !timer ) timer = speed;
  39.                 if ( timer > 1 ) timer--;
  40.                 if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_UP, step, false)  ) {
  41.                     Link->Y--;
  42.                     timer = speed;
  43.                 }
  44.             }
  45.             else if ( Screen->ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVDOWN ) {
  46.                 if ( !timer ) timer = speed;
  47.                 if ( timer > 1 ) timer--;
  48.                 if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_DOWN, step, false) ) {
  49.                     Link->Y++;
  50.                     timer = speed;
  51.                 }
  52.             }
  53.             else timer = speed;
  54.             Waitframe();
  55.         }
  56.     }
  57. }
  58.  
  59. //Global Version
  60.  
  61. int ____GRAM[214747];
  62.  
  63. const int CONVEYOR_TIMER = 10020; //Index of ____GRAM.
  64. const int FAST_CONVEY_SPEED = 30;
  65. const int FAST_CONVEY_STEP = 1;
  66. const int CMB_FAST_CONVEY_RT = 1000; //Set to combo ID of Fast Conveyor (Right)
  67. const int CMB_FAST_CONVEY_LF = 1000; //Set to combo ID of Fast Conveyor (Left)
  68. const int CMB_FAST_CONVEY_UP = 1000; //Set to combo ID of Fast Conveyor (Up)
  69. const int CMB_FAST_CONVEY_DN = 1000; //Set to combo ID of Fast Conveyor (Down)
  70.  
  71. //Call as FasterConveyors(FAST_CONVEY_SPEED, FAST_CONVEY_STEP, ____GRAM, CONVEYOR_TIMER);
  72. void FasterConveyors(int speed, int step, int arr, int index){
  73.     if ( Screen->ComboD[ ComboAt(Link->X, Link->Y) ] == CMB_FAST_CONVEY_LF ) {
  74.         if ( !arr[index] ) arr[index] = speed;
  75.         if ( arr[index] > 1 ) arr[index]--;
  76.         if ( arr[index] == 1 && CanWalk(Link->X, Link->Y, DIR_LEFT, step, false) ) {
  77.             Link->X--;
  78.             arr[index] = speed;
  79.         }
  80.     }
  81.     else if ( Screen->ComboD[ ComboAt(Link->X, Link->Y) ] == CMB_FAST_CONVEY_RT ) {
  82.         if ( !arr[index] ) arr[index] = speed;
  83.         if ( arr[index] > 1 ) arr[index]--;
  84.         if ( arr[index] == 1 && CanWalk(Link->X, Link->Y, DIR_RIGHT, step, false) ) {
  85.             Link->X++;
  86.             arr[index] = speed;
  87.         }
  88.     }
  89.     else if ( Screen->ComboD[ ComboAt(Link->X, Link->Y) ] == CMB_FAST_CONVEY_UP ) {
  90.         if ( !arr[index] ) arr[index] = speed;
  91.         if ( arr[index] > 1 ) arr[index]--;
  92.         if ( arr[index] == 1 && CanWalk(Link->X, Link->Y, DIR_UP, step, false)  ) {
  93.             Link->Y--;
  94.             arr[index] = speed;
  95.         }
  96.     }
  97.     else if ( Screen->ComboD[ ComboAt(Link->X, Link->Y) ] == CMB_FAST_CONVEY_DN ) {
  98.         if ( !arr[index] ) arr[index] = speed;
  99.         if ( arr[index] > 1 ) arr[index]--;
  100.         if ( arr[index] == 1 && CanWalk(Link->X, Link->Y, DIR_DOWN, step, false) ) {
  101.             Link->Y++;
  102.             arr[index] = speed;
  103.         }
  104.     }
  105.     else arr[index] = speed;
  106. }
  107.  
  108. global script convey{
  109.     void run(){
  110.         while(true){
  111.             FasterConveyors(FAST_CONVEY_SPEED, FAST_CONVEY_STEP, ____GRAM, CONVEYOR_TIMER);
  112.             Waitdraw();
  113.             Waitframe();
  114.         }
  115.     }
  116. }
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.

×