Advertisement
ZoriaRPG

Hit All Triggers Within Desired TIme (FFC or Screen Script)

Jan 5th, 2019
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.31 KB | None | 0 0
  1. ////////////////////////////////////////////
  2. /// Hit all Triggers Within Desired Time ///
  3. /// v0.3                                 ///
  4. /// 5th January, 2019                    ///
  5. /// By: ZoriaRPG                         ///
  6. /// For: ywkls                           ///
  7. ////////////////////////////////////////////
  8. ffc script hitAllTriggersTimed
  9. {
  10.     void run(int window_opportunity)
  11.     {
  12.         int trigger_pos[528]; //176 types, 176 flags 176 inh flags
  13.         int trigger_pos_clone[528]; //176 types, 176 flags 176 inh flags
  14.         int count = 0; //if count is < 0, then we hit all triggers
  15.         int newcount = 0; //if count is < 0, then we hit all triggers
  16.         int types[]={-1}; //List al/l types here.
  17.         int flags[]={-1}; //list all placed flags here
  18.         int iflags[]={-1}; //list all placed inh. flas here
  19.         int q = 0; int w = 0; //main loop, secondary loop
  20.         //set-up and store all appropriate types and flags
  21.         for ( q = 0; q < 176; +q )
  22.         {
  23.             //q is always position
  24.             for ( w = SizeOfArray(types)-1; w >= 0; --w )
  25.             {
  26.                 if ( Screen->ComboT[q] == types[w] )
  27.                 {
  28.                     trigger_pos[q] = Screen->ComboT[q];
  29.                     ++count;
  30.                 }
  31.             }
  32.             for ( w = SizeOfArray(flags)-1; w >= 0; --w )
  33.             {
  34.                 if ( Screen->ComboF[q] == flags[w] )
  35.                 {
  36.                     trigger_pos[q+176] = Screen->ComboF[q];
  37.                     ++count;
  38.                 }
  39.             }
  40.             for ( w = SizeOfArray(iflags)-1; w >= 0; --w )
  41.             {
  42.                 if ( Screen->ComboI[q] == iflags[w] )
  43.                 {
  44.                     trigger_pos[q+352] = Screen->ComboF[q];
  45.                     ++count;
  46.                 }
  47.             }
  48.         }
  49.         for ( q = 0; q < 528; ++q ) trigger_pos_clone[q] = trigger_pos[q]; //to allow a delay and require ll of them
  50.         newcount = count;
  51.         //loop, checking if all triggers have changed
  52.         while(1)
  53.         {
  54.             for ( q = 0; q < 176; ++q )
  55.             {
  56.                 if ( trigger_pos_clone[q] )
  57.                 {
  58.                     if ( Screen->ComboT[q] == trigger_pos_clone[q] ) continue;
  59.                     else
  60.                     {
  61.                         trigger_pos_clone[q] = 0;
  62.                         --newcount;
  63.                     }
  64.                 }
  65.                 if ( trigger_pos_clone[q+176] )
  66.                 {
  67.                     if ( Screen->ComboF[q] == trigger_pos_clone[q+176] ) continue;
  68.                     else
  69.                     {
  70.                         trigger_pos_clone[q+176] = 0;
  71.                         --newcount;
  72.                     }
  73.                 }
  74.                 if ( trigger_pos_clone[q+352] )
  75.                 {
  76.                     if ( Screen->ComboI[q] == trigger_pos_clone[q+352] ) continue;
  77.                     else
  78.                     {
  79.                         trigger_pos_clone[q+352] = 0;
  80.                         --newcount;
  81.                     }
  82.                 }
  83.             }
  84.             if ( newcount <= 0 ) break;
  85.             else
  86.             {
  87.                 if ( window_opportunity <= 0 )
  88.                 {
  89.                     //Didn't do it within the desired time, so reset the conditions.
  90.                     window_opportunity = this->InitD[0];
  91.                     for ( q = 0; q < 528; ++q )
  92.                     {
  93.                         trigger_pos_clone[q] = trigger_pos[q]; //to allow a delay and require ll of them
  94.                         if ( q < 176 ) Screen->ComboT[q] = trigger_pos[q]; //reset types
  95.                         if ( q < 352 )Screen->ComboF[q-176] = trigger_pos[q]; //reset flags;
  96.                         Screen->ComboI[q-352] = trigger_pos[q]; //reset iflags
  97.                     }
  98.                    
  99.                     newcount = count;
  100.                 }
  101.                 else if ( Link->Action == LA_SCROLLING ) //Reset as Link leaves the screen--I hope.
  102.                 {
  103.                     Screen->ComboT[q] = trigger_pos[q]; //reset types
  104.                     Screen->ComboF[q] = trigger_pos[q+176]; //reset flags;
  105.                     Screen->ComboI[q] = trigger_pos[q+352]; //reset iflags
  106.                 }
  107.                 else --window_opportunity;
  108.             }
  109.            
  110.             Waitframe();
  111.         }
  112.         //EXECUTE whqatever you want to happen when all triggers are cxleared, here.
  113.            
  114.     }
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement