Advertisement
ZoriaRPG

Boss Spawner FFC

Aug 30th, 2017
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.03 KB | None | 0 0
  1. //ZoriaRPG
  2. //Spawn an npc that never returns after death.
  3.  
  4. const int NPC_MISC_BOSS_SPAWN_BIT_INDEX = 15; //The Misc[ index to use for this script.
  5.  
  6. ffc script spawn_boss {
  7.     void run( int enem_id, int reg, int bit )
  8.     //D0: THe ID of the enemy
  9.     //D1: A Screen->D register. Should be unique for this screen. Valid range is 0 to 7.
  10.     //D2: THe bit of the register. Should be unque per instance of this FFC on the screen.
  11.     //  This is a bit value, in decimal, so use powers of two.
  12.     //  The first instance of the ffc is 1, then 2, then 4, 8, 16.
  13.     {
  14.         int q; npc ; bool alive;
  15.         if ( GetScreenDBit(reg,bit) )
  16.         {
  17.             this->Data = 0; Quit();
  18.         }
  19.         Waitframes(5);
  20.         npc n = Screen->CreateNPC(enem_id);
  21.         n->X = this->X; n->Y = this->Y; //Spawn the npc at the ffc coordinates.
  22.         while(n->HP > 0)
  23.         {
  24.             //While this npc is alive, loop.
  25.             Waitframe();
  26.         }
  27.         //this boss is dead.
  28.         SetScreenDBit(reg,bit,true); //Set the bit so that it never respawns.
  29.         this->Data = 0; Quit(); //Clean up the ffc and free it.
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement