Advertisement
ZoriaRPG

Shadowblitz16 Zol_Combine ffc Modifications

Jan 30th, 2017
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.45 KB | None | 0 0
  1. void Zol_Combine(ffc this, npc ghost, int height, int trans, bool changeGuyCount)
  2. {
  3.     int new_npc = trans; //Get the ID of the enemy that this will become, from it's 'Death Attribute 3'
  4.     //npc gel1 = combine[0]; //Variable to hold the first base enemy
  5.     //npc gel 2 = combine[1]; //Variable to hold the second base enemy
  6.     //npc zol = combine[2];  //Variable to hold the replacement enemy
  7.     int loops[3]; //Array for three loop vars.
  8.     npc combine[3]; //Array for the three npcs.
  9.    
  10.     if (Ghost_GotHit())
  11.     {
  12.         //Read the npcs on the screen
  13.         for (loops[0] = Screen->NumNPCs(); loops[0] > 0; loops[0] -- )
  14.         {
  15.             //Load index1th enemy into a pointer..
  16.             combine[0] = Screen->LoadNPC(index1);
  17.            
  18.             //if it is the correct ID, check for a second instance of this enemy.
  19.             if ( combine[0]->ID == ghost->ID )
  20.                 loops[1] = loops[0]+1; loops[2] = Screen->NumNPCs();
  21.             for ( ; loops[1] <= loops[2]; loops[1]++ )
  22.             //use the same sarting index for loops[1], plus one, so that we do not
  23.             //read the same npc twice; set loops[2] to the number of npcs so that we do
  24.             //not need to call Screen->NumNPCs() multiple times.
  25.             {
  26.                 //Load index2th enemy into a pointer..
  27.                 combine[1] = Screen->LoadNPC(loops[1]);
  28.                
  29.                 //Load each npc after the first one that we found, into a pointer.
  30.                 if ( combine[1]->ID == ghost->ID )
  31.                 if ( combine[2]_DistXY(combine[0], combine[1], Z4combine[2]_COMBINE_DISTANCE ) )
  32.                 {      
  33.                     //Create a new npc using the 'Death Attribute 3' value of the npc running this ghost script.
  34.                     combine[2] = Screen->CreateNPC(new_npc);
  35.                     combine[2]->X = Min(combine[0]->X, combine[1]->X) - Max(combine[0]->X, combine[1]->X) / 2;
  36.                     combine[2]->Y = Max(combine[0]->Y, combine[1]->Y);
  37.                    
  38.                    
  39.                     //Check if there is a sound to be played, if so then play it
  40.                     if ( Z4combine[2]_SOUND2_INDEX > 0 ) Game->PlaySound(Z4combine[2]_SOUND2_INDEX);
  41.                    
  42.                     // !!!
  43.                     //! What the flidd is this!? THis shouldn't compile at all!!!
  44.                     //! Did you mean    ' Z4combine[SOUND2_INDEX] ' ? -Z
  45.                    
  46.                     //Then, remove the two old npcs that it replaces.          
  47.                     Remove(combine[0]);
  48.                     Remove(combine[1]);
  49.                    
  50.                     //Check if we are changing guy count, if so then correct GuyCount so that we spawn the correct number of npcs on returning.
  51.                     if ( changeGuyCount ) Game->GuyCount[Game->GetCurScreen()] -= 1; //If we're changing GuyCount[]...  
  52.                    
  53.                 }
  54.             }
  55.         }
  56.         combine[2]->Jump = height/10;
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement