const int NPC_TRIB_INDEX = 6; const int TRIB_BASE = 0; const int TRIB_INTO = 1; const int TRIB_LAST = 2; const int TRIB_TIME = 3; const int TRIB_Q = 0; const int TRIB_W = 1; const int TRIB_E = 2; const int TRIB_X = 4; const int TRIB_Y = 5; ffc script BasicTribble{ void run(int base_enemy, int tribbles_into, int num_tribbles, int tribbles_become, int waver, int trib_time){ int a[6]; //a vars array, for loops and stats npc n[2]; //an npc array a[TRIB_TIME] = trib_time; //Set the timer. Waitframes(5); //Wait for npcsto spawn. while(true){ //handle making the main enemy split. for ( a[TRIB_Q] = 1; a[TRIB_Q] <= Screen->NumNPCs(); a[TRIB_Q]++ ) { n[TRIB_BASE] = Screen->LoadNPC(a[TRIB_Q]); //Parse each npc onthe screen if ( n[TRIB_BASE]->Isvalid() { if ( n[TRIB_BASE]->HP <= 0 && n[TRIB_BASE]->ID == base_enemy && n[TRIB_BASE]->X != -32768 && n[TRIB_BASE]->Y != -32768){ n[TRIB_BASE]->DrawXOffset = -200; n[TRIB_BASE]->DrawYOffset = -200; n[TRIB_BASE]->HitXOffset = -200; n[TRIB_BASE]->HitYOffset = -200; a[TRIB_X] = n[TRIB_BASE]->X; a[TRIB_Y] = n[TRIB_BASE]->Y; a[TRIB_BASE]->HP = -9999; //Waitframes(15); //A delay to make the spawning feel less insant. n[TRIB_INTO] = CreateNPCAt(tribbles_into, a[TRIB_X], a[TRIB_Y]); //make the new enemies. } } } //Handle making the splits of the main enemy tribble up. if ( tribbles_become <= 0 ) tribbles_become = base_enemy; //Split-off enemies will turn into the main enemy, unless D3 is set. if ( a[TRIB_TIMER] ) a[TRIB_TIME]--; //if the timer is running, decrement it. //If the timer reaches 0... if ( !a[TRIB_TIME] ){ a[TRIB_TIME] = trib_time; //Reset the counter. for ( a[TRIB_Q] = 1; a[TRIB_Q] <= Screen->NumNPCs(); a[TRIB_Q]++){ n[TRIB_BASE] = Screen->LoadNPC(a[TRIB_Q]); if ( n[TRIB_BASE]->IsValid()){ if ( n[TRIB_BASE]->ID == tribbles_into ){ n[TRIB_BASE]->DrawXOffset = -200; n[TRIB_BASE]->DrawYOffset = -200; n[TRIB_BASE]->HitXOffset = -200; n[TRIB_BASE]->HitYOffset = -200; a[TRIB_X] = n[TRIB_BASE]->X; a[TRIB_Y] = n[TRIB_BASE]->Y; n[TRIB_BASE]->HP = -9999; Waitframes(5); n[TRIB_INTO] = CreateNPCAt(tribbles_become, a[TRIB_X], a[TRIB_Y]) } } } } Waitframe(); } }