ZoriaRPG

Splitters Do Not Return v3

Nov 19th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.79 KB | None | 0 0
  1. //D0: The ID of the enemy to remove.
  2. //D1: The enemi ID that the D0 splits into.
  3. //D2: the starting number of enemies on this screen (the number of times it is in the enemy list)
  4. //D3: The register to use to store enemy counts.
  5. //D4: the register to check for intialisation.
  6. //D5: Total number of lanmola enemies on the screen.
  7. //D6: Lanmola enemy ID.
  8. //D7: Register for tracking lanmolas.
  9.  
  10. ffc script RemoveKilledSpliiters{
  11.     void run(int enemID, int splitsInto, int startNum, int reg, int regInit, int totalLanmolas, int lanmolaID, int lanmolasReg){
  12.         int curNum = NumNPCsOf(enemID);
  13.         int presentMax = Screen->D[reg];
  14.         int children;
  15.         int numLanmolas;
  16.         int laninit[]="Number of lanmolas in Screen->D[lanmolasReg] before entering loop.";
  17.         TraceS(laninit);
  18.         TraceNL();
  19.         Trace(Screen->D[lanmolasReg]);
  20.         TraceNL();
  21.         Waitframes(5);
  22.         bool firstRun = true;
  23.         int segments;
  24.        
  25.         if ( lanmolaID ) {
  26.             for ( int q = 1; q <= Screen->NumNPCs(); q++ ) {
  27.                 npc a = Screen->LoadNPC(q);
  28.                 if ( a->ID == lanmolaID ) {
  29.                     segments = a->Attributes[0] + 1;
  30.                     int segs[]="Lanmola Attribute 0 is:";
  31.                     TraceNL();
  32.                     TraceS(segs);
  33.                     Trace(a->Attributes[0] + 1);
  34.                     TraceNL();
  35.                     break;
  36.                 }
  37.             }
  38.         }
  39.        
  40.         float segs = segments / 10;
  41.        
  42.         Screen->D[lanmolasReg] += segs;
  43.         int lanmolasValid = Floor(Screen->D[lanmolasReg]);
  44.         float deciSegs = ( Screen->D[lanmolasReg] - Floor(Screen->D[lanmolasReg]) ) * 10 ;
  45.        
  46.         int segm[]="Var segments = ";
  47.         TraceNL();
  48.         TraceS(segm);
  49.         TraceNL();
  50.         Trace(segments);
  51.         TraceNL();
  52.        
  53.         while(true){
  54.             segments = deciSegs;
  55.             lanmolasValid = Floor(Screen->D[lanmolasReg]);
  56.             int lanwait[]="Number of lanmolas in Screen->D[lanmolasReg] instantly after entering loop.";
  57.             TraceS(lanwait);
  58.             TraceNL();
  59.             Trace(Screen->D[lanmolasReg]);
  60.             TraceNL();
  61.             if ( presentMax == 0 && Screen->D[regInit] == 0 ) {
  62.                 Screen->D[regInit] = 1;
  63.                 Screen->D[reg] = startNum;
  64.                 Trace(Screen->D[reg]);
  65.                 TraceNL();
  66.             }
  67.            
  68.             if ( lanmolasValid && NumNPCsOf(lanmolaID) == 0 && firstRun ) {
  69.                 for ( int q = ( Floor(Screen->D[lanmolasReg]) / segments ); q > 0; q-- ) {
  70.                     Screen->CreateNPC(lanmolaID);
  71.                 }
  72.                 firstRun = false;
  73.             }
  74.            
  75.            
  76.            
  77.             curNum = NumNPCsOf(enemID);
  78.             presentMax = Screen->D[reg];
  79.             int presmax[]="Tracing presentMax";
  80.             TraceS(presmax);
  81.             TraceNL();
  82.             Trace(presentMax);
  83.             TraceNL();
  84.             if ( presentMax == 0 && Screen->D[regInit] > 0 ) {
  85.                 for ( int q = 1; q <= Screen->NumNPCs(); q++ ) {
  86.                    
  87.                     npc n = Screen->LoadNPC(q);
  88.                     if ( n->ID == enemID ) Remove(n);
  89.                 }
  90.             }
  91.             curNum = NumNPCsOf(enemID);
  92.             children = NumNPCsOf(splitsInto);
  93.             if ( Screen->D[reg] > curNum+children ) Screen->D[reg] = curNum;
  94.             int currentNum[]="Tracing curNum";
  95.             TraceS(currentNum);
  96.             TraceNL();
  97.             Trace(curNum);
  98.             TraceNL();
  99.             int dreg[]="Tracing Screen->D[reg] line 30";
  100.             TraceS(dreg);
  101.             TraceNL();
  102.             Trace(Screen->D[reg]);
  103.             TraceNL();
  104.            
  105.             if ( curNum > Screen->D[reg] ) {
  106.                 int diff = curNum - Screen->D[reg];
  107.                 int removed;
  108.                 for ( int q = 1; q <= Screen->NumNPCs(); q++ ) {
  109.                     if ( removed == diff ) break;
  110.                     npc n = Screen->LoadNPC(q);
  111.                     if ( enemID != lanmolaID ) {
  112.                         if ( n->ID == enemID ) {
  113.                             //if ( n->ID == lanmolaID || n->ID == 75 && curNum == 6  ) n->HP == -9999;
  114.                             //else
  115.                                 Remove(n);
  116.                             removed++;
  117.                         }
  118.                     }
  119.                 }
  120.             }
  121.             int lanmolasOffscreen;
  122.            
  123.             if ( curNum == totalLanmolas ) {
  124.                 for ( int q = 1; q <= Screen->NumNPCs(); q++ ) {
  125.                     npc n = Screen->LoadNPC(q);
  126.                     if ( n->ID == lanmolaID && n->X == -32768 ) lanmolasOffscreen++;
  127.                 }
  128.             }
  129.            
  130.             if ( lanmolasOffscreen == totalLanmolas ) {
  131.                 for ( ; lanmolasOffscreen < 0; lanmolasOffscreen -- ){
  132.                     npc n = Screen->LoadNPC(lanmolasOffscreen);
  133.                     n->HP = -9999;
  134.                 }
  135.             }
  136.            
  137.             lanmolasOffscreen = 0;
  138.            
  139.             Screen->D[lanmolasReg] = NumNPCsOf(lanmolaID) + ( segments / 10 );
  140.             int lanreg[]="Number of stored Lanmolas";
  141.             TraceS(lanreg);
  142.             TraceNL();
  143.             Trace(Screen->D[lanmolasReg]);
  144.             TraceNL();
  145.            
  146.             if ( !NumNPCsOf(lanmolaID) ) {
  147.                 Screen->D[lanmolasReg] = 0;
  148.                 int allkilled[]="All lanmolas are dead.";
  149.                 TraceS(allkilled);
  150.                 TraceNL();
  151.             }
  152.            
  153.            
  154.            
  155.             //if ( Screen->NumNPCs() )
  156.             //  for ( int q = 0; q <= 14; q++ ) Screen->State[q] = 0;
  157.            
  158.             Waitframe();
  159.         }
  160.     }
  161. }
  162.  
  163. global script active{
  164.     void run(){
  165.         while(true){
  166.             int numLanmolas = 0;
  167.             for ( int q = 1; q <= Screen->NumNPCs(); q++ ) {
  168.                 npc n = Screen->LoadNPC(q);
  169.                 //if ( n->ID == lanmolaID && n->HP <= 0 ) {
  170.                 //  n->HP = 9999;
  171.                 //  //n->CollDetection = false;
  172.                 //  n->Rate = 0;
  173.                 //  n->X = -32768;
  174.                    
  175.                    
  176.                 //}
  177.                 //Waitframe();
  178.                
  179.             }
  180.            
  181.                
  182.            
  183.             Waitdraw();
  184.             Waitframe();
  185.         }
  186.     }
  187. }
Add Comment
Please, Sign In to add comment