ZoriaRPG

ItemHoldupMessage.zh v1.0

Aug 1st, 2017
86
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///////////////////////////
  2. /// Item Hold Up Header ///
  3. /// v1.0 for ZC 2.50.x  ///
  4. /// 2nd August, 2017    ///
  5. /// By: ZoriaRPG        ///
  6. ///////////////////////////
  7.  
  8. //!!!!!!!!!!!!!!!!!!!!!
  9. //! Settings  
  10.  
  11. const int ITEM_HOLDUP_ZH__LA_HOLDUP_HANDS = 1; //The number of hands to use for the default hold-up animation.
  12. const int ITEM_HOLDUP_ZH__SFX_HOLD_ITEM_FANFARE = 20; //Change to the sound that you want.
  13.  
  14.  
  15. //!!!!!!!!!!!!!!!!!!!!!
  16. //! Scripts
  17.  
  18. ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  19. /// Item Script that Runs The FFCs
  20. /// D0: THe integer portion is the string to use, and the decimal portion is the item to display
  21. ///     during the hold-up animation:
  22. /// Example: 27.0016
  23. ///     This will use String 27, and display Item 16 in the hold-up animation.
  24.  
  25. item script PickMessageFFCLauncher
  26. {
  27.     void run(int string_itmID)
  28.     {
  29.         bool foundff;
  30.         int __item_message_string = string_itmID << 0;
  31.         int this_item_id = ( string_itmID - __item_message_string ) * 10000;
  32.         int _____ffscript_id; int ___err_aborting[]="Aborting item hold-up.";
  33.  
  34.         if ( this_item_id > 0 && this_item_id < 256 )
  35.         {
  36.             if ( Link->Action == LA_DIVING )
  37.             {
  38.                 int ff[]="FFC_DiveHoldUp";
  39.                 _____ffscript_id = Game->GetFFCScript(ff);
  40.                 if ( _____ffscript_id < 1 )
  41.                 {
  42.                     int ___errff[]="Cound not find the script: ";
  43.                     TraceNL(); TraceS(___errff); TraceS(ff); TraceNL(); TraceS(___err_aborting); TraceNL();
  44.                     Quit();
  45.                 }
  46.                    
  47.                 for ( int q = 32; q > 0; q-- )
  48.                 {
  49.                     ffc f = Screen->LoadFFC(q);
  50.                     if ( f->Data == 0 )
  51.                     {
  52.                         if ( f->Script == 0 )
  53.                         {
  54.                             foundff = true;
  55.                             f->Data = 1;
  56.                             f->Script = Game->GetFFCScript(_____ffscript_id);
  57.                             f->InitD[0] = this_item_id;
  58.                             f->InitD[1] = __item_message_string;
  59.                             break;
  60.                         }
  61.                     }
  62.                 }
  63.                 if ( !foundff )
  64.                 {
  65.                     int ferr[]="Cound not find a free ffc slot to run the ffc script for item script PickMessageFFCLauncher. ";
  66.                     TraceNL(); TraceS(ferr); Trace(___err_aborting); TraceNL();
  67.                 }
  68.                 Quit();
  69.             }
  70.            
  71.             else if ( Link->Action == LA_SWIMMING  )
  72.             {
  73.                 int ff[]="FFC_SwimHoldUp";
  74.                 _____ffscript_id = Game->GetFFCScript(ff);
  75.                 if ( _____ffscript_id < 1 ) {
  76.                     int ___errff[]="Cound not find the script: ";
  77.                     TraceNL(); TraceS(___errff); TraceS(ff); TraceNL(); TraceS(___err_aborting); TraceNL();
  78.                     Quit();
  79.                 }
  80.                 for ( int q = 32; q > 0; q-- )
  81.                 {
  82.                     ffc f = Screen->LoadFFC(q);
  83.                     if ( f->Data == 0 )
  84.                     {
  85.                         if ( f->Script == 0 )
  86.                         {
  87.                             foundff = true;
  88.                             f->Data = 1;
  89.                             f->Script = Game->GetFFCScript(_____ffscript_id);
  90.                             f->InitD[0] = this_item_id;
  91.                             f->InitD[1] = __item_message_string;
  92.                             break;
  93.                         }
  94.                     }
  95.                 }
  96.                 if ( !foundff )
  97.                 {
  98.                     int ferr[]="Cound not find a free ffc slot to run the ffc script for item script PickMessageFFCLauncher. ";
  99.                     TraceNL(); TraceS(ferr); Trace(___err_aborting); TraceNL();
  100.                 }
  101.                 Quit();
  102.             }
  103.        
  104.             else
  105.             {
  106.                 int ff[]="FFC_ItemHoldUp";
  107.                 _____ffscript_id = Game->GetFFCScript(ff);
  108.                 if ( _____ffscript_id < 1 ) {
  109.                     int ___errff[]="Cound not find the script: ";
  110.                     TraceNL(); TraceS(___errff); TraceS(ff); TraceNL(); TraceS(___err_aborting); TraceNL();
  111.                     Quit();
  112.                 }
  113.                 for ( int q = 32; q > 0; q-- )
  114.                 {
  115.                     ffc f = Screen->LoadFFC(q);
  116.                     if ( f->Data == 0 )
  117.                     {
  118.                         if ( f->Script == 0 )
  119.                         {
  120.                             foundff = true;
  121.                             f->Data = 1;
  122.                             f->Script = Game->GetFFCScript(_____ffscript_id);
  123.                             f->InitD[0] = this_item_id;
  124.                             f->InitD[1] = __item_message_string;
  125.                             break;
  126.                         }
  127.                     }
  128.                 }
  129.                 if ( !foundff )
  130.                 {
  131.                     int ferr[]="Cound not find a free ffc slot to run the ffc script for item script PickMessageFFCLauncher";
  132.                     TraceNL(); TraceS(ferr); Trace(___err_aborting); TraceNL();
  133.                 }
  134.                 Quit();
  135.             }
  136.         }
  137.         else {
  138.             TraceNL();
  139.             int ____err_itm_id[]="The input for the item ID to display in the script PickMessageFFCLauncher is not valid!";
  140.             int ____err_itm_id2[]="The value that was entered was: ";
  141.             int ____err_itm_id3[]="The valid range is 1 to 255.";
  142.             TraceS(____err_itm_id); TraceS(____err_itm_id2);
  143.             Trace(this_item_id); TraceNL(); TraceS(____err_itm_id3); Trace(___err_aborting); TraceNL();
  144.             //Display the message without holding up the item.
  145.             Screen->Message(__item_message_string);
  146.         }
  147.     }
  148. }
  149.  
  150. ////////////////////////////////////////////////////////////////////
  151. /// FFC Scripts
  152. /// These drive the effects for item hold-up and message display,
  153. /// and are called automatically by the launcher.
  154. /// DO NOT PLACE THESE ON A SCREEN!
  155.  
  156. ffc script FFC_SwimHoldUp{
  157.     void run(int itm, int __item_message_string)
  158.     {
  159.         Waitframe();    // An initial waitframe so that the item pick-up script is fully closed,
  160.                 // and so that the item collect script  effects finish running before
  161.                 // we do anything else.
  162.                
  163.         if ( ITEM_HOLDUP_ZH__SFX_HOLD_ITEM_FANFARE > 0 && ITEM_HOLDUP_ZH__SFX_HOLD_ITEM_FANFARE < 255)
  164.         {
  165.             Game->PlaySound(ITEM_HOLDUP_ZH__SFX_HOLD_ITEM_FANFARE);
  166.         }
  167.         Link->Action = LA_HOLD1WATER + (ITEM_HOLDUP_ZH__LA_HOLDUP_HANDS-1);
  168.         Link->HeldItem = itm;
  169.         //do-while loop to delay the message display until the hold-up animation eneds.
  170.         do{
  171.             Waitframe();
  172.         } while( Link->Action == LA_HOLD1WATER || Link->Action == LA_HOLD2WATER );
  173.         Screen->Message(__item_message_string);
  174.         this->Data = 0;
  175.         this->Script = 0;
  176.         Quit();
  177.     }
  178. }
  179.  
  180. ffc script FFC_DiveHoldUp{
  181.     void run(int itm, int __item_message_string){
  182.        
  183.         do {
  184.             Waitframe();
  185.         } while(Link->Action == LA_DIVING);
  186.        
  187.         do {
  188.             Waitframe();
  189.         } while( Link->Action == LA_HOLD1WATER || Link->Action == LA_HOLD2WATER );
  190.        
  191.         //ZC Automatically Holds Up all dive items, and plays the Item Fanfare SFX (SFX: 20, hardcoded).
  192.        
  193.         Screen->Message(__item_message_string);
  194.         this->Data = 0;
  195.         this->Script = 0;
  196.         Quit();
  197.     }
  198. }
  199.  
  200.  
  201. ffc script FFC_ItemHoldUp{
  202.     void run(int itm, int __item_message_string){
  203.        
  204.         // This do-while loop is to ensure that the message does not obscure the item during the hold-up animation.
  205.         do {
  206.             Waitframe();
  207.         } while(Link->Action == LA_HOLD1LAND || Link->Action == LA_HOLD2LAND);
  208.        
  209.         if ( ITEM_HOLDUP_ZH__SFX_HOLD_ITEM_FANFARE > 0 && ITEM_HOLDUP_ZH__SFX_HOLD_ITEM_FANFARE < 255)
  210.         {
  211.             Game->PlaySound(ITEM_HOLDUP_ZH__SFX_HOLD_ITEM_FANFARE);
  212.         }
  213.        
  214.         Screen->Message(__item_message_string);
  215.         this->Data = 0;
  216.         this->Script = 0;
  217.         Quit();
  218.     }
  219. }
  220. //Maddening, isn't it? -Z
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.

×