Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /////////////////////////////
- /// Faster Conveyor Belts ///
- /// v0.1.1 ///
- /// 12-Nov-2016 ///
- /// By: ZoriaRPG ///
- /////////////////////////////////////////////////////////////////////////////////
- /// Purpose: This allows creating conveyor belts that move *Link* faster than ///
- /// the stock ZC conveyors. ///
- /// ///
- /// Future versions may support bombs, items, somaria blocks, and npcs. ///
- /// I have *no plans* to add, or support creating *slower* conveyors with ///
- /// this header. ///
- /////////////////////////////////////////////////////////////////////////////////
- //FFC Version
- ffc script FasterConveyors{
- void run(int speed, int step){
- int timer = speed;
- while(true){
- if ( Screen->ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVLEFT ) {
- if ( !timer ) timer = speed;
- if ( timer > 1 ) timer--;
- if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_LEFT, step, false) ) {
- Link->X--;
- timer = speed;
- }
- }
- else if ( Screen->ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVRIGHT ) {
- if ( !timer ) timer = speed;
- if ( timer > 1 ) timer--;
- if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_RIGHT, step, false) ) {
- Link->X++;
- timer = speed;
- }
- }
- else if ( Screen->ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVUP ) {
- if ( !timer ) timer = speed;
- if ( timer > 1 ) timer--;
- if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_UP, step, false) ) {
- Link->Y--;
- timer = speed;
- }
- }
- else if ( Screen->ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVDOWN ) {
- if ( !timer ) timer = speed;
- if ( timer > 1 ) timer--;
- if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_DOWN, step, false) ) {
- Link->Y++;
- timer = speed;
- }
- }
- else timer = speed;
- Waitframe();
- }
- }
- }
- //Global Version
- int ____GRAM[214747];
- const int CONVEYOR_TIMER = 10020; //Index of ____GRAM.
- const int FAST_CONVEY_SPEED = 30;
- const int FAST_CONVEY_STEP = 1;
- const int CMB_FAST_CONVEY_RT = 1000; //Set to combo ID of Fast Conveyor (Right)
- const int CMB_FAST_CONVEY_LF = 1000; //Set to combo ID of Fast Conveyor (Left)
- const int CMB_FAST_CONVEY_UP = 1000; //Set to combo ID of Fast Conveyor (Up)
- const int CMB_FAST_CONVEY_DN = 1000; //Set to combo ID of Fast Conveyor (Down)
- //Call as FasterConveyors(FAST_CONVEY_SPEED, FAST_CONVEY_STEP, ____GRAM, CONVEYOR_TIMER);
- void FasterConveyors(int speed, int step, int arr, int index){
- if ( Screen->ComboD[ ComboAt(Link->X, Link->Y) ] == CMB_FAST_CONVEY_LF ) {
- if ( !arr[index] ) arr[index] = speed;
- if ( arr[index] > 1 ) arr[index]--;
- if ( arr[index] == 1 && CanWalk(Link->X, Link->Y, DIR_LEFT, step, false) ) {
- Link->X--;
- arr[index] = speed;
- }
- }
- else if ( Screen->ComboD[ ComboAt(Link->X, Link->Y) ] == CMB_FAST_CONVEY_RT ) {
- if ( !arr[index] ) arr[index] = speed;
- if ( arr[index] > 1 ) arr[index]--;
- if ( arr[index] == 1 && CanWalk(Link->X, Link->Y, DIR_RIGHT, step, false) ) {
- Link->X++;
- arr[index] = speed;
- }
- }
- else if ( Screen->ComboD[ ComboAt(Link->X, Link->Y) ] == CMB_FAST_CONVEY_UP ) {
- if ( !arr[index] ) arr[index] = speed;
- if ( arr[index] > 1 ) arr[index]--;
- if ( arr[index] == 1 && CanWalk(Link->X, Link->Y, DIR_UP, step, false) ) {
- Link->Y--;
- arr[index] = speed;
- }
- }
- else if ( Screen->ComboD[ ComboAt(Link->X, Link->Y) ] == CMB_FAST_CONVEY_DN ) {
- if ( !arr[index] ) arr[index] = speed;
- if ( arr[index] > 1 ) arr[index]--;
- if ( arr[index] == 1 && CanWalk(Link->X, Link->Y, DIR_DOWN, step, false) ) {
- Link->Y++;
- arr[index] = speed;
- }
- }
- else arr[index] = speed;
- }
- global script convey{
- void run(){
- while(true){
- FasterConveyors(FAST_CONVEY_SPEED, FAST_CONVEY_STEP, ____GRAM, CONVEYOR_TIMER);
- Waitdraw();
- Waitframe();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement