ZoriaRPG

Splitters Do Not Return v1

Nov 19th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.81 KB | None | 0 0
  1. //Spliiting enemies do not return, after death.
  2.  
  3. //D0: The ID of the enemy to remove.
  4. //D1: The enemi ID that the D0 splits into.
  5. //D2: the starting number of enemies on this screen (the number of times it is in the enemy list)
  6. //D3: The register to use to store enemy counts.
  7. //D4: the register to check for intialisation.
  8.  
  9. ffc script RemoveKilledSpliiters{
  10.     void run(int enemID, int splitsInto, int startNum, int reg, int regInit){
  11.         int curNum = NumNPCsOf(enemID);
  12.         int presentMax = Screen->D[reg];
  13.         int children;
  14.        
  15.         while(true){
  16.            
  17.             Waitframes(5);
  18.             if ( presentMax == 0 && Screen->D[regInit] == 0 ) {
  19.                 Screen->D[regInit] = 1;
  20.                 Screen->D[reg] = startNum;
  21.                 Trace(Screen->D[reg]);
  22.                 TraceNL();
  23.             }
  24.            
  25.             curNum = NumNPCsOf(enemID);
  26.             presentMax = Screen->D[reg];
  27.             int presmax[]="Tracing presentMax";
  28.             TraceS(presmax);
  29.             TraceNL();
  30.             Trace(presentMax);
  31.             TraceNL();
  32.             if ( presentMax == 0 && Screen->D[regInit] > 0 ) {
  33.                 for ( int q = 1; q <= Screen->NumNPCs(); q++ ) {
  34.                    
  35.                     npc n = Screen->LoadNPC(q);
  36.                     if ( n->ID == enemID ) Remove(n);
  37.                 }
  38.             }
  39.             curNum = NumNPCsOf(enemID);
  40.             children = NumNPCsOf(splitsInto);
  41.             if ( Screen->D[reg] > curNum+children ) Screen->D[reg] = curNum;
  42.             int currentNum[]="Tracing curNum";
  43.             TraceS(currentNum);
  44.             TraceNL();
  45.             Trace(curNum);
  46.             TraceNL();
  47.             int dreg[]="Tracing Screen->D[reg] line 30";
  48.             TraceS(dreg);
  49.             TraceNL();
  50.             Trace(Screen->D[reg]);
  51.             TraceNL();
  52.            
  53.             if ( curNum > Screen->D[reg] ) {
  54.                 int diff = curNum - Screen->D[reg];
  55.                 int removed;
  56.                 for ( int q = 1; q <= Screen->NumNPCs(); q++ ) {
  57.                     if ( removed == diff ) break;
  58.                     npc n = Screen->LoadNPC(q);
  59.                     if ( n->ID == enemID ) {
  60.                         Remove(n);
  61.                         removed++;
  62.                     }
  63.                 }
  64.             }
  65.             Waitframe();
  66.         }
  67.     }
  68. }
Add Comment
Please, Sign In to add comment