ZoriaRPG

Change Arrow Dir with Keypress for Aefre

Jul 8th, 2018
104
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Call before Waitdraw() in your global active script.
  2. ///Optimised function to allow controlling the direction of silver and gold arrows.
  3. void ArrowDirChange()
  4. {
  5.     int btn;
  6.     if ( Link->InputA )
  7.     {
  8.         if ( GetEquipmentA() == I_ARROW2 ) btn = 2;
  9.         if ( GetEquipmentB() == I_ARROW2 ) btn = 4;
  10.        
  11.     }
  12.     if ( Link->InputB )
  13.     {
  14.        
  15.         if ( GetEquipmentB() == I_ARROW3 ) btn = 3;
  16.         if ( GetEquipmentB() == I_ARROW3 ) btn = 6;
  17.     }
  18.     //silver
  19.     if ( btn ) //n0 mod by zero
  20.     {
  21.         if (!( btn % 2 ))
  22.         {
  23.             if ( Link->PressR )
  24.             {
  25.                 lweapon silv;
  26.                 for ( int q = Screen->NumLWeapons(); q > 0; --q )
  27.                 {
  28.                     silv = Screen->LoadWeapon(q);
  29.                     if ( silv->Damage >= 4 )
  30.                     {
  31.                         //only once.
  32.                         if ( silv->Misc[LW_MISC_SILARROW] ) break;
  33.                         else
  34.                         {
  35.                             if ( Link->PressLeft ) { ++silv->Misc[LW_MISC_SILARROW]; silv->Dir = DIR_LEFT; break;}
  36.                             if ( Link->PressRight ) { ++silv->Misc[LW_MISC_SILARROW]; silv->Dir = DIR_RIGHT;  break;}
  37.                             if ( Link->PressUp ) { ++silv->Misc[LW_MISC_SILARROW]; silv->Dir = DIR_UP;  break;}
  38.                             if ( Link->PressDown ) { ++silv->Misc[LW_MISC_SILARROW]; silv->Dir = DIR_DOWN;  break;}
  39.                             break;
  40.                         }
  41.                     }
  42.                 }
  43.             }
  44.         }
  45.        
  46.         if (!( btn % 3 )) //gold
  47.         {
  48.             if ( Link->PressR )
  49.             {
  50.                 lweapon gold;
  51.                 for ( int q = Screen->NumLWeapons(); q > 0; --q )
  52.                 {
  53.                     gold = Screen->LoadWeapon(q);
  54.                     if ( gold->Damage >= 8 )
  55.                     {
  56.                         if ( Link->PressLeft ) gold->Dir = DIR_LEFT;
  57.                         if ( Link->PressRight ) gold->Dir = DIR_RIGHT;
  58.                         if ( Link->PressUp ) gold->Dir = DIR_UP;
  59.                         if ( Link->PressDown ) gold->Dir = DIR_DOWN;
  60.                         break;
  61.                     }
  62.                 }
  63.             }
  64.         }
  65.     }
  66. }
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.

×