Read-only archive of the Armageddon Games Forums Archive (2000–2026) · About this archive

Enemy Generator

7 replies · 4,134 views · Started 30 December 2006

This enemy generator code now works.


// =======================================================
// ENEMY SPAWNER - This script is used to spawn enemies. The FFC running
// the script will continue to spawn a particular kind of enemy at regular intervals
// until there are too many on the screen, or the combo used by the spawner changes.
//
// D0 = enemy_id = The enemy to be spawned. Check the table in std.zh to get values.
// D1 = delay = The delay, in tics, between enemy spawns.
// D2 = max = The maximum number of enemies that the spawner will put on the screen.
// D3 = spawnX = The X value at which you want the enemy to spawn.
// D4 = spawnY = The Y value at which you want the enemy to spawn.
// ======================================================

ffc script enemyspawner{

void run(int enemy_id, int delay, int max, int spawnX, int spawnY){

int original_combo = this->Data; // Saves the original combo of this FFC.

int counter = delay; // Used to count the tics until it is time to spawn.

while(true){
// Checks whether the combo for this FFC has changed, or whether there are
// a maximum number of NPCs on the screen.
if ( (this->Data == original_combo) && (Screen->NumNPCs() < max) ){

// If max tics have gone by since the last time a spawn took place, spawn.
if ( counter == 0 ){
npc spawnee = Screen->CreateNPC(enemy_id);
spawnee->X = spawnX;
spawnee->Y = spawnY;
counter = delay;
}
else{
counter--;
} // end if
} // end if
Waitframe();
} // end of while loop
} // end of void run
} // end of FFC script

I include a detailed description of each script in the comments.

// =======================================================
// ENEMY SPAWNER - This script is used to spawn enemies. The FFC running
// the script will continue to spawn a particular kind of enemy at regular intervals
// until there are too many on the screen, or the combo used by the spawner changes.
//
// D0 = enemy_id = The enemy to be spawned. Check the table in std.zh to get values.
// D1 = delay = The delay, in tics, between enemy spawns.
// D2 = max = The maximum number of enemies that the spawner will put on the screen.
// D3 = spawnX = The X value at which you want the enemy to spawn.
// D4 = spawnY = The Y value at which you want the enemy to spawn.
// ======================================================

So you can make a beehive that constantly spits out bees (keese?), for instance. Set the FFC to be a Strike combo if you'd like Link to be able to turn it off by hitting it. Be creative, there are lots of uses for this.

Then just implement the code yourself according to the instructions in the comments. Given that you're having a hard time finding the quest file, I bet it'll take you less time to compile it and set up an ffc than it will to download the file.