ZoriaRPG

ZScript: BobOmb v0.2

May 19th, 2017
98
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import "std.zh"
  2.  
  3. //////////////////////////////////
  4. /// BobOmb for EotM - May 2017 ///
  5. /// By: ZoriaRPG               ///
  6. /// 19th May, 2017             ///
  7. /// v0.2                       ///
  8. //////////////////////////////////
  9. //! Set all npc defences to Stun
  10.  
  11. ffc script bobomb{
  12.     void run(int enem_id, int misc_id, int misc_cset, int flash_cset){
  13.         npc n; int q;
  14.         itemdata id = Game->LoadItemData(I_BOMB);
  15.         int pow = id->Power;
  16.         while(true){
  17.             //find any bobomb npcs
  18.             for ( q = Screen->NumNPCs(); q > 0; q-- ) {
  19.                 n = Screen->LoadNPC(q);
  20.                 if ( n->ID == enem_id ) {
  21.                     //n->Attributes[1] = NPCA2_EXPLODE; //Set its death attribute.
  22.                     //found one, check its stun
  23.                     if ( n->Stun > 1 ) {
  24.                         //check its timer
  25.                         if ( n->Misc[misc_id] == 0 ) {
  26.                             //its not yet flashing, so set its timer.
  27.                             n->Misc[misc_id] = 120;
  28.                             n->Misc[misc_cset] = n->CSet;
  29.                         }
  30.                         if ( n->Misc[misc_id] > 0 ) {
  31.                             n->Misc[misc_id]--;
  32.                             if ( n->Misc[misc_id] % 5 == 0 ) {
  33.                                 //Make it flash
  34.                                 n->CSet = flash_cset;
  35.                             }
  36.                             else n->CSet = n->Misc[misc_cset];
  37.                         }
  38.                     }
  39.                     if ( n->Stun == 1 ) {
  40.                         //time to explode
  41.                         eweapon e = Screen->CreateEWeapon(EW_SBOMBBLAST);
  42.                         e->Damage = pow;
  43.                         e->X = n->X; e->Y = n->Y;
  44.                         n->HP = -9999;
  45.                     }
  46.                 }
  47.             }
  48.             Waitframe();
  49.         }
  50.     }
  51. }
  52.  
  53. const int NPC_BOBOMB = 177;
  54. const int BOBOMB_FFC_SLOT = 30;
  55. const int BOBOMB_FFC_DATA = 1;
  56. const int BOBOMB_FFC_D_TIMER_SLOT = 14;
  57. const int BOBOMB_FFC_D_CSET_SLOT = 13;
  58. const int BOBOMB_FFC_FLASH_CSET = 8;
  59.  
  60. global script test_bobomb{
  61.     void run(){
  62.         while(true){
  63.             BobOmb(NPC_BOBOMB, BOBOMB_FFC_SLOT, BOBOMB_FFC_DATA, BOBOMB_FFC_D_TIMER_SLOT, BOBOMB_FFC_D_CSET_SLOT, BOBOMB_FFC_FLASH_CSET);
  64.             Waitdraw();
  65.             Waitframe();
  66.         }
  67.     }
  68. }
  69.        
  70. //Globally find any bobombs. If any are on the screen and the script is not running, run it.
  71. void BobOmb(int npc_id, int ffc_slot, int ffc_data, int misc_timer, int misc_cset_slot, int flash_cset){
  72.     int ff[]="bobomb"; npc n; int fff = Game->GetFFCScript(ff);
  73.     if ( fff < 1 ) return;
  74.     ffc f = Screen->LoadFFC(ffc_slot);
  75.     if ( f->Script == fff ) return;
  76.     for ( int q = Screen->NumNPCs(); q > 0; q-- ) {
  77.         //check or bobombs
  78.         n = Screen->LoadNPC(q);
  79.         if ( n->ID == npc_id ) {
  80.             if ( f->Script != fff ) {
  81.                 f->Data = ffc_data;
  82.                 f->Script = fff;
  83.                
  84.                 f->InitD[0] = npc_id;
  85.                 f->InitD[1] = misc_timer;
  86.                 f->InitD[2] = misc_cset_slot;
  87.                 f->InitD[3] = flash_cset;
  88.                
  89.             }
  90.         }
  91.     }
  92. }
  93.        
  94.                            
  95. //Bobomb tiles in the demo qest are from this post: http://www.purezc.net/forums/index.php?showtopic=31432
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.

×