Advertisement
ZoriaRPG

ZC Use Items While Swimming (Theoretical)

Nov 19th, 2016
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.30 KB | None | 0 0
  1. //Use items while swimming
  2.  
  3. const int FFC_LINK_USE_ITEMS_WHILE_SWIMMING = 1;
  4. const int SWIM_PRESS_A = 1;
  5. const int SWIM_PRESS_B = 2;
  6. const int I_DIVE = 254;
  7. const int I_PADDLE = 255;
  8.  
  9. void UseItemsWhileSwimming(){
  10.     if ( Link->Action == LA_SWIMMING && Link->PressA && GetEquipmentA() != I_DIVE && GetEquipmentA() != I_PADDLE ) {
  11.         RunFFCScript(FFC_LINK_USE_ITEMS_WHILE_SWIMMING, SWIM_PRESS_A);
  12.     }
  13.     if ( Link->Action == LA_SWIMMING && Link->PressA && GetEquipmentB() != I_DIVE && GetEquipmentB() != I_PADDLE ) {
  14.         RunFFCScript(FFC_LINK_USE_ITEMS_WHILE_SWIMMING, SWIM_PRESS_B);
  15.     }
  16. }
  17.  
  18. ffc script LinkUseItemsInWater{
  19.     void run(int press_button){
  20.         bool running = true;
  21.         while ( running ) {
  22.             if ( press_button == SWIM_PRESS_A ) {
  23.                 Link->Action = LA_NONE; //Link's tile may be wrong for one frame, so
  24.                             // We may need to substitute a tile for one frame to
  25.                             //match his swimming tile.
  26.                 Link->InputA = true;
  27.                 running = false;
  28.                 Waitframe(); //If we don;t wait here, the item won't activate.
  29.             }
  30.             if ( press_button == SWIM_PRESS_B ) {
  31.                 Link->Action = LA_NONE;
  32.                 Link->InputB = true;
  33.                 running = false;
  34.                 Waitframe();
  35.             }
  36.             Link->Action = LA_SWIMMING;
  37.             Waitframe();
  38.         }
  39.         Link->Action = LA_SWIMMING;
  40.         this->Data = 0;
  41.         this->Script = 0;
  42.         Quit();
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement