Advertisement
ZoriaRPG

ZScript: Simple BobOmb

May 19th, 2017
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.18 KB | None | 0 0
  1. //BobOmb for EotM - May 2017
  2. //By: ZoriaRPG
  3. //19th May, 2017
  4. //v0.1
  5.  
  6. //Set all npc defences to Stun
  7.  
  8. ffc script bombomb{
  9.     void run(int enem_id, int misc_id, int misc_cset, int flash_cset){
  10.         npc n; int q; int frame = 60;
  11.         while(true){
  12.             if ( frame > 0 ) frame--;
  13.             else frame = 60;
  14.             //find any bobomb npcs
  15.             for ( q = Screen->NumNPCs(); q > 0; q-- ) {
  16.                 n = Screen->LoadNPC(q);
  17.                 if ( n->ID == enem_id ) {
  18.                     //found one, check its stun
  19.                     if ( n->Stun > 1 ) {
  20.                         //check its timer
  21.                         if ( n->Misc[misc_id] == 0 ) {
  22.                             //its not yet flashing, so set its timer.
  23.                             n->Misc[misc_id] = 60;
  24.                             n->Misc[misc_cset] = n->CSet;
  25.                         }
  26.                         if ( n->Misc[misc_id] > 0 ) {
  27.                             if ( n->Misc[misc_id] < 30 ) {
  28.                                 //Make it flash
  29.                                 n->CSet = flash_cset;
  30.                             }
  31.                             else n->CSet = n->Misc[misc_cset];
  32.                         }
  33.                     }
  34.                     if ( n->Stun == 1 ) {
  35.                         //time to explode
  36.                         n->Attributes[1] = NPCA2_EXPLODE;
  37.                         n->HP = 0;
  38.                     }
  39.                 }
  40.             }
  41.             Waitframe();
  42.         }
  43.     }
  44. }
  45.  
  46. const int NPC_BOBOMB = 0;
  47. const int BOBOMB_FFC_SLOT = 30;
  48. const int BOBOMB_FFC_DATA = 1;
  49. const int BOBOMB_FFC_D_TIMER_SLOT = 14;
  50. const int BOBOMB_FFC_D_CSET_SLOT = 13;
  51. const int BOBOMB_FFC_FLASH_CSET = 6;
  52.  
  53. global script test-bobomb{
  54.     void run(){
  55.         while(true){
  56.             BobOmb(NPC_BOBOMB, BOBOMB_FFC_SLOT, BOBOMB_FFC_DATA, BOBOMB_FFC_D_TIMER_SLOT, BOBOMB_FFC_D_CSET_SLOT, BOBOMB_FFC_FLASH_CSET);
  57.             Waitdraw();
  58.             Waitframe();
  59.         }
  60.     }
  61. }
  62.        
  63. //Globally find any bob ombs. If any are on the screen and the script is not running, run it.
  64. void BobOmb(int npc_id, int ffc_slot, int ffc_data, int misc_timer, int misc_cset_slot, int flash_cset){
  65.     int ff="bobomb"; npc n; int fff = Game->GetFFCScript(ff);
  66.     if ( fff < 1 ) return;
  67.     ffc f = Screen->LoadFFC(ffc_slot);
  68.     if ( f->Script == ffc ) return;
  69.     for ( int q = Screen->NumNPCs(); q > 0; q-- ) {
  70.         //check or bobombs
  71.         n = Screen->LoadNPC(q);
  72.         if ( n->ID == npc_id ) {
  73.             if ( f->Script != fff ) {
  74.                 f->Data = ffc_data;
  75.                 f->InitD[0] = npc_id;
  76.                 f->InitD[1] = misc_timer;
  77.                 f->InitD[2] = misc_cset_slot;
  78.                 f->InitD[3] = flash_cset;
  79.                 f->Script = fff;
  80.             }
  81.         }
  82.     }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement