Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///////////////////////////
- /// Item Hold Up Header ///
- /// v1.0 for ZC 2.50.x ///
- /// 2nd August, 2017 ///
- /// By: ZoriaRPG ///
- ///////////////////////////
- //!!!!!!!!!!!!!!!!!!!!!
- //! Settings
- const int ITEM_HOLDUP_ZH__LA_HOLDUP_HANDS = 1; //The number of hands to use for the default hold-up animation.
- const int ITEM_HOLDUP_ZH__SFX_HOLD_ITEM_FANFARE = 20; //Change to the sound that you want.
- //!!!!!!!!!!!!!!!!!!!!!
- //! Scripts
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////
- /// Item Script that Runs The FFCs
- /// D0: THe integer portion is the string to use, and the decimal portion is the item to display
- /// during the hold-up animation:
- /// Example: 27.0016
- /// This will use String 27, and display Item 16 in the hold-up animation.
- item script PickMessageFFCLauncher
- {
- void run(int string_itmID)
- {
- bool foundff;
- int __item_message_string = string_itmID << 0;
- int this_item_id = ( string_itmID - __item_message_string ) * 10000;
- int _____ffscript_id; int ___err_aborting[]="Aborting item hold-up.";
- if ( this_item_id > 0 && this_item_id < 256 )
- {
- if ( Link->Action == LA_DIVING )
- {
- int ff[]="FFC_DiveHoldUp";
- _____ffscript_id = Game->GetFFCScript(ff);
- if ( _____ffscript_id < 1 )
- {
- int ___errff[]="Cound not find the script: ";
- TraceNL(); TraceS(___errff); TraceS(ff); TraceNL(); TraceS(___err_aborting); TraceNL();
- Quit();
- }
- for ( int q = 32; q > 0; q-- )
- {
- ffc f = Screen->LoadFFC(q);
- if ( f->Data == 0 )
- {
- if ( f->Script == 0 )
- {
- foundff = true;
- f->Data = 1;
- f->Script = Game->GetFFCScript(_____ffscript_id);
- f->InitD[0] = this_item_id;
- f->InitD[1] = __item_message_string;
- break;
- }
- }
- }
- if ( !foundff )
- {
- int ferr[]="Cound not find a free ffc slot to run the ffc script for item script PickMessageFFCLauncher. ";
- TraceNL(); TraceS(ferr); Trace(___err_aborting); TraceNL();
- }
- Quit();
- }
- else if ( Link->Action == LA_SWIMMING )
- {
- int ff[]="FFC_SwimHoldUp";
- _____ffscript_id = Game->GetFFCScript(ff);
- if ( _____ffscript_id < 1 ) {
- int ___errff[]="Cound not find the script: ";
- TraceNL(); TraceS(___errff); TraceS(ff); TraceNL(); TraceS(___err_aborting); TraceNL();
- Quit();
- }
- for ( int q = 32; q > 0; q-- )
- {
- ffc f = Screen->LoadFFC(q);
- if ( f->Data == 0 )
- {
- if ( f->Script == 0 )
- {
- foundff = true;
- f->Data = 1;
- f->Script = Game->GetFFCScript(_____ffscript_id);
- f->InitD[0] = this_item_id;
- f->InitD[1] = __item_message_string;
- break;
- }
- }
- }
- if ( !foundff )
- {
- int ferr[]="Cound not find a free ffc slot to run the ffc script for item script PickMessageFFCLauncher. ";
- TraceNL(); TraceS(ferr); Trace(___err_aborting); TraceNL();
- }
- Quit();
- }
- else
- {
- int ff[]="FFC_ItemHoldUp";
- _____ffscript_id = Game->GetFFCScript(ff);
- if ( _____ffscript_id < 1 ) {
- int ___errff[]="Cound not find the script: ";
- TraceNL(); TraceS(___errff); TraceS(ff); TraceNL(); TraceS(___err_aborting); TraceNL();
- Quit();
- }
- for ( int q = 32; q > 0; q-- )
- {
- ffc f = Screen->LoadFFC(q);
- if ( f->Data == 0 )
- {
- if ( f->Script == 0 )
- {
- foundff = true;
- f->Data = 1;
- f->Script = Game->GetFFCScript(_____ffscript_id);
- f->InitD[0] = this_item_id;
- f->InitD[1] = __item_message_string;
- break;
- }
- }
- }
- if ( !foundff )
- {
- int ferr[]="Cound not find a free ffc slot to run the ffc script for item script PickMessageFFCLauncher";
- TraceNL(); TraceS(ferr); Trace(___err_aborting); TraceNL();
- }
- Quit();
- }
- }
- else {
- TraceNL();
- int ____err_itm_id[]="The input for the item ID to display in the script PickMessageFFCLauncher is not valid!";
- int ____err_itm_id2[]="The value that was entered was: ";
- int ____err_itm_id3[]="The valid range is 1 to 255.";
- TraceS(____err_itm_id); TraceS(____err_itm_id2);
- Trace(this_item_id); TraceNL(); TraceS(____err_itm_id3); Trace(___err_aborting); TraceNL();
- //Display the message without holding up the item.
- Screen->Message(__item_message_string);
- }
- }
- }
- ////////////////////////////////////////////////////////////////////
- /// FFC Scripts
- /// These drive the effects for item hold-up and message display,
- /// and are called automatically by the launcher.
- /// DO NOT PLACE THESE ON A SCREEN!
- ffc script FFC_SwimHoldUp{
- void run(int itm, int __item_message_string)
- {
- Waitframe(); // An initial waitframe so that the item pick-up script is fully closed,
- // and so that the item collect script effects finish running before
- // we do anything else.
- if ( ITEM_HOLDUP_ZH__SFX_HOLD_ITEM_FANFARE > 0 && ITEM_HOLDUP_ZH__SFX_HOLD_ITEM_FANFARE < 255)
- {
- Game->PlaySound(ITEM_HOLDUP_ZH__SFX_HOLD_ITEM_FANFARE);
- }
- Link->Action = LA_HOLD1WATER + (ITEM_HOLDUP_ZH__LA_HOLDUP_HANDS-1);
- Link->HeldItem = itm;
- //do-while loop to delay the message display until the hold-up animation eneds.
- do{
- Waitframe();
- } while( Link->Action == LA_HOLD1WATER || Link->Action == LA_HOLD2WATER );
- Screen->Message(__item_message_string);
- this->Data = 0;
- this->Script = 0;
- Quit();
- }
- }
- ffc script FFC_DiveHoldUp{
- void run(int itm, int __item_message_string){
- do {
- Waitframe();
- } while(Link->Action == LA_DIVING);
- do {
- Waitframe();
- } while( Link->Action == LA_HOLD1WATER || Link->Action == LA_HOLD2WATER );
- //ZC Automatically Holds Up all dive items, and plays the Item Fanfare SFX (SFX: 20, hardcoded).
- Screen->Message(__item_message_string);
- this->Data = 0;
- this->Script = 0;
- Quit();
- }
- }
- ffc script FFC_ItemHoldUp{
- void run(int itm, int __item_message_string){
- // This do-while loop is to ensure that the message does not obscure the item during the hold-up animation.
- do {
- Waitframe();
- } while(Link->Action == LA_HOLD1LAND || Link->Action == LA_HOLD2LAND);
- if ( ITEM_HOLDUP_ZH__SFX_HOLD_ITEM_FANFARE > 0 && ITEM_HOLDUP_ZH__SFX_HOLD_ITEM_FANFARE < 255)
- {
- Game->PlaySound(ITEM_HOLDUP_ZH__SFX_HOLD_ITEM_FANFARE);
- }
- Screen->Message(__item_message_string);
- this->Data = 0;
- this->Script = 0;
- Quit();
- }
- }
- //Maddening, isn't it? -Z
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement