Some more fun stuff for the kidies.
Code:
ffc script leever_spawner{
void run(int enemy_max){
bool init = false;
int en_count = 0;
while(true){
if(init == false){
for(int i; i < enemy_max; i++)
putenemy(26+Rand(2));
init = true;
}
en_count = Screen->NumNPCs();
while(en_count > 0){
npc leever = Screen->LoadNPC(en_count);
if(leever->X > 272 || leever->Y > 192 ||
leever->X < -33 || leever->Y < -33){
leever->HP=0;
npc e = Screen->CreateNPC(26+Rand(2));
e->X = Rand(190)+30;
e->Y = Rand(100)+30;
}
en_count--;
}
Waitframe();
}
}
void putenemy(int eid)
{
int x = Rand(12)+2;
int y = Rand(7)+2;
while(!is_walkable(x,y))
{
x = Rand(12)+2;
y = Rand(7)+2;
}
npc en = Screen->CreateNPC(eid);
if(en->isValid())
{
en->X = x*16;
en->Y = y*16;
}
//simulate staggered spawning
Waitframe();
}
bool is_walkable(int x, int y)
{
return Screen->ComboS[x+y*16]==0;
}
}
Code:
ffc script lanmola_spawner{
void run(int enemy_max){
bool init = false;
int en_count = 0;
while(true){
if(init == false){
for(int i; i < enemy_max; i++)
putenemy(74+Rand(2));
init = true;
}
Waitframe();
}
}
void putenemy(int eid)
{
int x = Rand(12)+2;
int y = Rand(7)+2;
while(!is_walkable(x,y))
{
x = Rand(12)+2;
y = Rand(7)+2;
}
npc en = Screen->CreateNPC(eid);
if(en->isValid())
{
en->X = x*16;
en->Y = y*16;
}
//simulate staggered spawning
Waitframe();
}
bool is_walkable(int x, int y)
{
return Screen->ComboS[x+y*16]==0;
}
}
Code:
ffc script lynel_spawner{
void run(int enemy_max){
bool init = false;
int en_count = 0;
while(true){
if(init == false){
for(int i; i < enemy_max; i++)
putenemy(30+Rand(2));
init = true;
}
Waitframe();
}
}
void putenemy(int eid)
{
int x = Rand(12)+2;
int y = Rand(7)+2;
while(!is_walkable(x,y))
{
x = Rand(12)+2;
y = Rand(7)+2;
}
npc en = Screen->CreateNPC(eid);
if(en->isValid())
{
en->X = x*16;
en->Y = y*16;
}
//simulate staggered spawning
Waitframe();
}
bool is_walkable(int x, int y)
{
return Screen->ComboS[x+y*16]==0;
}
}
Code:
ffc script goriya_spawner{
void run(int enemy_max){
bool init = false;
int en_count = 0;
while(true){
if(init == false){
for(int i; i < enemy_max; i++)
putenemy(45+Rand(2));
init = true;
}
Waitframe();
}
}
void putenemy(int eid)
{
int x = Rand(12)+2;
int y = Rand(7)+2;
while(!is_walkable(x,y))
{
x = Rand(12)+2;
y = Rand(7)+2;
}
npc en = Screen->CreateNPC(eid);
if(en->isValid())
{
en->X = x*16;
en->Y = y*16;
}
//simulate staggered spawning
Waitframe();
}
bool is_walkable(int x, int y)
{
return Screen->ComboS[x+y*16]==0;
}
}
Code:
ffc script darknut_spawner{
void run(int enemy_max){
bool init = false;
int en_count = 0;
while(true){
if(init == false){
for(int i; i < enemy_max; i++)
putenemy(49+Rand(2));
init = true;
}
Waitframe();
}
}
void putenemy(int eid)
{
int x = Rand(12)+2;
int y = Rand(7)+2;
while(!is_walkable(x,y))
{
x = Rand(12)+2;
y = Rand(7)+2;
}
npc en = Screen->CreateNPC(eid);
if(en->isValid())
{
en->X = x*16;
en->Y = y*16;
}
//simulate staggered spawning
Waitframe();
}
bool is_walkable(int x, int y)
{
return Screen->ComboS[x+y*16]==0;
}
}
Code:
ffc script keese_spawner{
void run(int enemy_max){
bool init = false;
int en_count = 0;
int delay = 300;
while(true){
if(init == false){
for(int i; i < enemy_max; i++)
putenemy(38+Rand(3));
init = true;
}
if(Screen->NumNPCs()==0){
if(delay > 0)delay--;
else{
npc e = Screen->CreateNPC(38+Rand(3));
delay = 200+Rand(200);
}
}
Waitframe();
}
}
void putenemy(int eid)
{
int x = Rand(12)+2;
int y = Rand(7)+2;
while(!is_walkable(x,y))
{
x = Rand(12)+2;
y = Rand(7)+2;
}
npc en = Screen->CreateNPC(eid);
if(en->isValid())
{
en->X = x*16;
en->Y = y*16;
}
//simulate staggered spawning
Waitframe();
}
bool is_walkable(int x, int y)
{
return Screen->ComboS[x+y*16]==0;
}
}
Code:
ffc script octo_spawner_1{
void run(int enemy_max){
bool init = false;
int en_count = 0;
while(true){
if(init == false){
for(int i; i < enemy_max; i++)
putenemy(20+Rand(4));
init = true;
}
Waitframe();
}
}
void putenemy(int eid)
{
int x = Rand(12)+2;
int y = Rand(7)+2;
while(!is_walkable(x,y))
{
x = Rand(12)+2;
y = Rand(7)+2;
}
npc en = Screen->CreateNPC(eid);
if(en->isValid())
{
en->X = x*16;
en->Y = y*16;
}
//simulate staggered spawning
Waitframe();
}
bool is_walkable(int x, int y)
{
return Screen->ComboS[x+y*16]==0;
}
}
Code:
ffc script octo_spawner_2{
void run(int enemy_max){
bool init = false;
int en_count = 0;
while(true){
if(init == false){
for(int i; i < enemy_max; i++)
putenemy(138+Rand(4));
init = true;
}
Waitframe();
}
}
void putenemy(int eid)
{
int x = Rand(12)+2;
int y = Rand(7)+2;
while(!is_walkable(x,y))
{
x = Rand(12)+2;
y = Rand(7)+2;
}
npc en = Screen->CreateNPC(eid);
if(en->isValid())
{
en->X = x*16;
en->Y = y*16;
}
//simulate staggered spawning
Waitframe();
}
bool is_walkable(int x, int y)
{
return Screen->ComboS[x+y*16]==0;
}
}
Code:
const int PHASE_WIZZROBE_2 = 56; // change these to your own created wizzrobe enemy ids.
const int PHASE_WIZZROBE_3 = 56;
ffc script wizzrobe_spawner_phaser{
void run(int enemy_max){
bool init = false;
int en_count = 0;
while(true){
if(init == false){
for(int i; i < enemy_max; i++){
if(Rand(3)==0)npc e = Screen->CreateNPC(56);
else if(Rand(3) != 0)npc e = Screen->CreateNPC(PHASE_WIZZROBE_2);
else npc e = Screen->CreateNPC(PHASE_WIZZROBE_3);
int rand = Rand(9)+15;
Waitframes(rand);
}
init = true;
}
Waitframe();
}
}
}
And one more just for fun:
Code:
// =======================================================
// ENEMY SPAWNER 4 - This script is used to spawn enemies. The FFC running
// the script will continue to spawn particular kinds of enemy at regular intervals
// until there are too many on the screen, or the combo used by the spawner changes.
// This version will always spawn at the location of the FFC running this script and
// will always spawn enemies untill the ghosted enemy at the location of this ffc
// is killed. currently uses enemy z255 as the ghosted enemy. Get used to using
// enemy 255 as a dummy enemy for scripts. Set up this enemy in the enemy editor.
//
// D0 - D2 = enemy_id = The enemy to be spawned. Check the table in std.zh to get values.
// D3 = delay = The delay, in tics, between enemy spawns.
// D4 = max = The maximum number of enemies that the spawner will put on the screen.
// D5 - the HP of the ghosted enemy at this ffc.
// ======================================================
ffc script enemyspawner4{
void run(int enemy_id, int enemy_id2, int enemy_id3, int delay, int max, int enemyHP){
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.
int spawnX = this->X;
int spawnY = this->Y;
int random = Rand(3);
Waitframes(4);
npc enemy_life = Screen->CreateNPC(255);
enemy_life->HP = enemyHP;
while(enemy_life->isValid()){
enemy_life->X = this->X;
enemy_life->Y = this->Y;
if ( (this->Data == original_combo) && (Screen->NumNPCs() < max) ){
if ( counter == 0 && random == 0){
npc spawnee = Screen->CreateNPC(enemy_id);
spawnee->X = spawnX;
spawnee->Y = spawnY;
counter = delay;
random = Rand(3);
}
if ( counter == 0 && random == 1){
npc spawnee = Screen->CreateNPC(enemy_id2);
spawnee->X = spawnX;
spawnee->Y = spawnY;
counter = delay;
random = Rand(3);
}
if ( counter == 0 && random == 2){
npc spawnee = Screen->CreateNPC(enemy_id3);
spawnee->X = spawnX;
spawnee->Y = spawnY;
counter = delay;
random = Rand(3);
}
else{
counter--;
} // end if
} // end if
spawnX = this->X;
spawnY = this->Y;
Waitframe();
} // end of while loop
} // end of void run
} // end of FFC script
Enjoy!