ZoriaRPG

Somaria Pit Code

Jul 24th, 2017
102
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. ffc script Pit{
  3.     void run(int respawn_screen_init){
  4.         int a[256]; bool falling; bool pit; bool onpitedge;
  5.        
  6.         Waitframes(5);
  7.        
  8.         //Store where Link was on screen init:
  9.         a[50] = Link->X; a[51] = Link->Y;
  10.        
  11.         while(true){
  12.             if ( !falling && !onpitedge && !Link->Misc[ON_PLATFORM] ) { a[10] = Link->X; a[11] = Link->Y; }
  13.             if ( falling ) { a[12] = a[10]; a[13] = a[11]; }
  14.             //Store Link's X/Y in the array, so that we have a respawn location.
  15.             //Find combos with a type of HOOKSHOT_ONLY and an Inherent Flag of CI_PIT.
  16.             for ( a[0] = 0; a[0] < 176; a[0]++ ) {
  17.                 if ( ComboT[a[0]] == CT_HOOKSHOT || ComboT[a[0]] == CT_LADDER || ComboT[a[0]] == CT_LADDERHOOKSHOT || ComboI[a[0]] == CT_PIT ) {
  18.                     if ( DistX(a[0],14) && DistY(a[0],14) && !DistY(a[0],9) && !DistX(a[0],9) ) onpitedge = true;
  19.                     else onpitedge = false;
  20.                     if ( DistX(a[0],8) && DistY(a[0],8) {
  21.                         if ( !NumLWeaponsOf(LW_HOOKSHOT) ) {
  22.                             if ( Link->Z <= 0 && !Link->Jump ) {
  23.                                 falling = true;
  24.                             }
  25.                         }
  26.                     }
  27.                 }
  28.             }
  29.            
  30.                
  31.             if ( falling ) {
  32.                 NoAction();
  33.                
  34.                 Link->X = ComboX(a[0]); Link->Y = ComboY(a[0]);
  35.                
  36.                 a[4] = ComboX(a[0]); a[5] = ComboY(a[0]);
  37.                 a[8] = 16; //Scale
  38.                 //Waitframe(); //Not needed if we're going it after Waitdraw()
  39.                 a[20] = Link->Tile; //Set before hs becomes invisible and this value turns to shyte.
  40.                
  41.                 // We need to avoid storing this if the new location is a platform.  This is important, primarily
  42.                 //because he can walk off the edge of a platform manually, and he'd fall in an endless loop.
  43.                
  44.                 //This might mean that either the platform ffc needs higher priority than this, so that the Link->Misc
  45.                 //value is set, or that we need to check if he is on a platform in the pits ffc, too.
  46.                
  47.                
  48.                
  49.                 if ( !effects ) {
  50.                     effects = true;
  51.                     Game->PlaySound(SFX_FALL_PIT);
  52.                     Link->HP -= PIT_DAMAGE;
  53.                 }
  54.                 for ( a[1] = 0; a[1] < PIT_FALLING_ANIM_DUR; a[1]++ ) {
  55.                     Screen_>DrawTile(2, a[4]; a[5]; a[20]; ... scale=a[8], ... true, OP_OPAQUE);
  56.                     if ( a[1] % 10 == 0 && a[8] > 0 ) a[8]--; //Trim the scale.
  57.                     Waitframe();
  58.                 }
  59.                 Waitframes(5);
  60.                 //Spawn Link Again
  61.                 for ( a[1] = 0; a[1] < PIT_RESPAWN_LINK_DUR; a[1]++ ) {
  62.                     if ( !respawn_screen_init )
  63.                         Link->X = a[12]; Link->Y = a[13];
  64.                     if ( respawn_screen_init )
  65.                         //If d0 is set, we read a[50] and a[51] for the values to use when respawning him.
  66.                         Link->X = a[50]; Link->Y = a[51];
  67.                     if ( a[1] % 4 != 0 ) Link->Invisible = true;
  68.                     else Link->Invisible = false;
  69.                     Waitframe();
  70.                 }
  71.                 falling = false;
  72.                 effects = false;
  73.                     //Freeze Link
  74.                     //Store his x/y
  75.                     //Center the x/y over the combo
  76.                     //Make Link invisible,
  77.                     //Draw his tile in a loop, growing smaller
  78.                     //Play falling sound
  79.                     //hurt him
  80.                     //Wait a few frames
  81.                     //Spawn him
  82.                     //make him flicker by using a for loop, in which at % == 0 he is visible, and ! % == 0 he is invisible
  83.                         //for 30 frames, during which his collision is off.
  84.                 }
  85.             Waitframe();
  86.         }
  87.     }
  88. }
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.

×