PDA

View Full Version : Enemy Maker Scripts!



Gleeok
10-02-2007, 12:44 AM
Version1. This script was written by DarkDragon! (give credit where credit is due)


//===============================================
// FFC SCRIPT ENEMY MAKER 1(overworld/interiors)
// D0-D7 Enemies that will spawn *check std.zh for values*
//===============================================
bool is_walkable(int x, int y)
{
return Screen->ComboS[x+y*16]==0;
}

ffc script Enemymaker1 {
void run(int e1, int e2, int e3, int e4, int e5, int e6, int e7, int e8) {
putenemy(e1);
putenemy(e2);
putenemy(e3);
putenemy(e4);
putenemy(e5);
putenemy(e6);
putenemy(e7);
putenemy(e8);
}

void putenemy(int eid)
{
//to do this properly we really need priority queues in ZScript ;)

int x = Rand(16);
int y = Rand(11);
while(!is_walkable(x,y))
{
x = Rand(16);
y = Rand(11);
}
npc en = Screen->CreateNPC(eid);
if(en->isValid())
{
en->X = x*16;
en->Y = y*16;
}
//simulate staggered spawning
Waitframe();
}
}

Use this for overworld/interior spawning, so as they don't get stuck in doorways....





//===============================================
// FFC SCRIPT ENEMY MAKER 2(dungeons)
// D0-D7 Enemies that will spawn *check std.zh for values*
//===============================================
bool is_walkable(int x, int y)
{
return Screen->ComboS[x+y*16]==0;
}

ffc script Enemymaker2 {
void run(int e1, int e2, int e3, int e4, int e5, int e6, int e7, int e8) {
putenemy(e1);
putenemy(e2);
putenemy(e3);
putenemy(e4);
putenemy(e5);
putenemy(e6);
putenemy(e7);
putenemy(e8);
}

void putenemy(int eid)
{
//to do this properly we really need priority queues in ZScript ;)

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();
}
}


Revision by Shadowmancer. Thanks!:) -Use this one for dungeons.

and....




//================================================== ==
// FFC SCRIPT ENEMY MAKER (dungeons)
// D0-D6; Enemies that might spawn,
// D7; Number of max enemies you want to spawn.
// <in Addition to boss or any other enemies set to screen enemies> ;)
// Thanks to DarkDragon! :=D
//================================================== ==

bool is_walkable(int x, int y)
{
return Screen->ComboS[x+y*16]==0;
}

ffc script enemymaker {
void run(int e1, int e2, int e3, int e4, int e5, int e6, int e7, int enemy_max) {
int RandNum = Rand(7);
int en_count = enemy_max;
while(en_count > 0){

if (RandNum == 0){
putenemy(e1);
} if (RandNum == 1){
putenemy(e2);
} if (RandNum == 2){
putenemy(e3);
} if (RandNum == 3){
putenemy(e4);
} if (RandNum == 4){
putenemy(e5);
} if (RandNum == 5){
putenemy(e6);
} if (RandNum == 6){
putenemy(e7);
}
en_count = en_count - 1;
RandNum = Rand(7);

}

}

void putenemy(int eid)
{
//to do this properly we really need priority queues in ZScript ;)

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();
}
}

....here is my version. Big changes with this one, allow me to explain.


D0-D6; Enemies that might spawn,
D7; Number of max enemies you want to spawn.

D0-D6 may or may not spawn, because......they're chosen at random! *Note the higher the number of D7, the greater chance any single one may appear.*

D7: Here is the kicker; What happens when you set D7 to 100??? ...Well try it and find out...hehe.....:eek:

You may want to give Link a potion before you try that though...;)

...And yes, it works with bosses.

EDIT:


Here's how it works:

It will spawn enemies of your choice,(D0-D7) and spawn them in random locations on the screen if walkable. Just like normal enemies. As for what enemies will spawn, check the enemy data either in std.zh, or in you quest under the enemy editor. Any enemy you have made in the editor is an eligible candidate for this script. Have fun with these!

Oh, almost forgot:

bool is_walkable(int x, int y)
{
return Screen->ComboS[x+y*16]==0;
}

This part is a global bit, so I believe you only need it once.

-Enjoy!

Anarchy_Balsac
10-02-2007, 12:52 AM
So wait, are these custom enemies or just custom enemy spawn patterns? Or both?

Gleeok
10-02-2007, 12:59 AM
So wait, are these custom enemies or just custom enemy spawn patterns? Or both?

Oh shit! I left out a bunch of explanations.....sorry. :mad: Dammit...

Here's how it works:

It will spawn enemies of your choice,(D0-D7) and spawn them in random locations on the screen if walkabe. Just like normal enemies. As for what enemies will spawn, check the enemy data either in std.zh, or in you quest under the enemy editor. Any enemy you have made in the editor is an elegible candidate for this script. :) Have fun with these!

Anarchy_Balsac
10-02-2007, 01:01 AM
*laughs maniacally", I wonder what would happen if a large number of manhandlas were spawned that way........... I'll be certain to use this for future quests.

Gleeok
10-02-2007, 01:03 AM
*laughs maniacally", I wonder what would happen if a large number of manhandlas were spawned that way........... I'll be certain to use this for future quests.

Aaaaahahahahahahahahahahaa!!!!!!!! I know, believe me I know...and trust me, you ain't seen nothing yet. :sly:

AmazingAmpharos
10-02-2007, 04:58 AM
What happens if you try to summon strange enemies like Traps, Zoras, or Ganons with this? You said the position was random; how do Aquamentus, Gleeok, and Gohma like this?

Gleeok
10-02-2007, 05:15 AM
What happens if you try to summon strange enemies like Traps, Zoras, or Ganons with this? You said the position was random; how do Aquamentus, Gleeok, and Gohma like this?


Ah! Yet another detail I neglected to mention....it's freakin sweetness how it works. OK, so things like...
Traps are buggy, do not spawn those.
Also Vire's are buggy for some reason...i dunno why. Instead use keese->tribble.
Uh...one more, but I forgot..

Bosses will spawn. If a boss can move, it will spawn randomly like other enemies. Yep, freeform Aquamentus!! also Gohma's.

Gleeok on the other hand, will alway's spawn on the same place.

Untested for zora's, and Ganon's.


BUT!!! Note that you can use this script in cunjunction with normal screen enemies. :)

Gleeok
12-31-2007, 12:47 AM
Some more fun stuff for the kidies.



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;
}
}



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;
}
}



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;
}
}



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;
}
}



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;
}
}



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;
}
}



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;
}
}



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;
}
}



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:




// ================================================== =====
// 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!

C-Dawg
12-31-2007, 02:56 PM
I've always used the Fire enemy as the ghosted enemy. Old habits die hard, I guess. Always used that one before scripting, too.

Gleeok
01-05-2008, 04:24 AM
Yeah, my enemy id 255 is basically a fire enemy. I erased the fire enemy in my other quest for a lv3 wizzrobe I think. I figure it's a safe bet to assume no one has made an enemy 255 for any other purpose but for script.


Anyway, whoopsie! Some of the above that were acting odd are now fixed. Also the leever script should no longer flood fill the screen with 255 enemies. Not really sure why that happened at all though. Some new ones. I'm just going to copy/paste the entire section from my script file, just so you know you don't have to use all of them. Just highlight what you want.

Enjoy.


//=======================================
// CONSTANT SPAWN SCRIPTS
//D0- Number of enemies to spawn
//=======================================


ffc script E_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;
Waitframes(60);
putenemy(26+Rand(2));
}
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;
}
}



ffc script E_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;
}
}

ffc script E_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;
}
}


ffc script E_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;
}
}

ffc script E_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;
}
}



ffc script E_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;
}
}

ffc script E_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;
}
}


ffc script E_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;
}
}



//=-=-=-=-=-=-=-=-WIZZROBE SPAWNER SCRIPTS-=-=-=-=-=-=-=-=-=
// D0 - amount of wizzrobes to spawn
// other D[] vars: offset(in ticks) and/or enemy HP.
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


const int PHASE_WIZZROBE_2 = 188;
const int PHASE_WIZZROBE_3 = 189;

ffc script E_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++){

npc e;
if(Rand(3)==0)e = Screen->CreateNPC(56);
else if(Rand(3) != 0) e = Screen->CreateNPC(PHASE_WIZZROBE_2);
else e = Screen->CreateNPC(PHASE_WIZZROBE_3);
int rand = Rand(9)+15;
Waitframes(rand);
}
init = true;
}
Waitframe();
}
}
}


ffc script E_wiz1_spawner_phaser{

void run(int enemy_max, int offset){

bool init = false;
int en_count = 0;
if(offset == 0) offset = Rand(9)+15;

while(true){

if(init == false){

for(int i; i < enemy_max; i++){

npc e = Screen->CreateNPC(56);
Waitframes(offset);
}
init = true;
}
Waitframe();
}
}
}


ffc script E_wiz2_spawner_phaser{

void run(int enemy_max, int offset){

bool init = false;
int en_count = 0;
if(offset == 0) offset = Rand(9)+15;

while(true){

if(init == false){

for(int i; i < enemy_max; i++){

npc e = Screen->CreateNPC(PHASE_WIZZROBE_2);
Waitframes(offset);
}
init = true;
}
Waitframe();
}
}
}

ffc script E_wiz3_spawner_phaser{

void run(int enemy_max, int offset){

bool init = false;
int en_count = 0;
if(offset == 0) offset = Rand(9)+15;

while(true){

if(init == false){

for(int i; i < enemy_max; i++){

npc e = Screen->CreateNPC(PHASE_WIZZROBE_3);
Waitframes(offset);
}
init = true;
}
Waitframe();
}
}
}



ffc script splitter_spawner{

void run(int eid, int e_max, int s1, int s2, int s3, int s4){

bool init = false;
npc e;

while(true){

if(init == false){

e = Screen->CreateNPC(eid);
init = true;
}
else if(!(e->isValid())){

if(s1>0){
for(int i; i < e_max; i++){
npc s = Screen->CreateNPC(s1);
s->X = this->X;s->Y = this->Y;
}
}
if(s2>0){
for(int i; i < e_max; i++){
npc s = Screen->CreateNPC(s2);
s->X = this->X;s->Y = this->Y;
}
}
if(s3>0){
for(int i; i < e_max; i++){
npc s = Screen->CreateNPC(s3);
s->X = this->X;s->Y = this->Y;
}
}
if(s4>0){
for(int i; i < e_max; i++){
npc s = Screen->CreateNPC(s4);
s->X = this->X;s->Y = this->Y;
}
}
Waitframe();
this->Data = 0;
Quit();
}
else{
this->X = e->X;
this->Y = e->Y;
}
Waitframe();
}
}
}

Schwa
04-11-2008, 01:23 PM
These are awesome. One problem though: I have no idea what these new ones do, since there's no Comment description in them. If you could get in the habit of explaining exactly what all your scripts do as you post them, they would be extremely helpful to me (even if I don't use the scripts-- I look for scripts mostly 'cause of the curiosity factor).

Thanks! ^_^

Gleeok
04-11-2008, 06:39 PM
It may look that way, but they all use the same comment:

//=======================================
// CONSTANT SPAWN SCRIPTS
//D0- Number of enemies to spawn
//=======================================


And that's all there is to those. Other than that it's fairly obvious....Darknut_Spawner: ..hmm what can this do?


I mainly used those because they're so easy to use.

Schwa
04-11-2008, 07:07 PM
//=======================================
// CONSTANT SPAWN SCRIPTS
//D0- Number of enemies to spawn
//=======================================
But... I have no idea what that means...

I mean sure it means that it spawns enemies, but HOW does it do it? And WHEN does it spawn them? And what happens to the enemies that are spawned? What's the general purpose of this script and what would I want to use it for?

I would never consider trying out a script unless I knew exactly what it did.

It's a good practice to lay things out for us in a COMPLETE, spelt-out black-and-white fashion, so your awesome submissions are accessable to those of us who need it put that way, such as myself and others with Autism as well. ;)

Gleeok
04-11-2008, 07:31 PM
I mean sure it means that it spawns enemies, but HOW does it do it? And WHEN does it spawn them?

Well it's simple really; You put a script on a screen, set D0 to how many enemies you want to spawn, and, well, that's it. They will appear just as if they were set as Screen->Enemies. One upshot to these are it's MUCH faster to use one of these scripts than to set screen enemies the old way. However keep in mind that they will always reurn via the scripts. Also the enemies spawned are random of the same type, which is useful all around I think. Also it gets around the 10 enemy per screen limit, so you can have 255 enemies from these. :heart:



And what happens to the enemies that are spawned?

You fight them! :D ..and they kill you!!! Yay!



What's the general purpose of this script and what would I want to use it for?

Umm...spawning enemies, and uhhh...spawning enemies. :eyebrow:

....Did I mention that these scripts make enemies?

Schwa
04-12-2008, 04:02 AM
This block of text right here answers ALL my questions. :D

Well it's simple really; You put a script on a screen, set D0 to how many enemies you want to spawn, and, well, that's it. They will appear just as if they were set as Screen->Enemies. One upshot to these are it's MUCH faster to use one of these scripts than to set screen enemies the old way. However keep in mind that they will always reurn via the scripts. Also the enemies spawned are random of the same type, which is useful all around I think. Also it gets around the 10 enemy per screen limit, so you can have 255 enemies from these. :heart:
That's freakin' amazing. 255 enemies per screen... and randomization... Simple yet ingenious! So you're saying if I use the Leever Spawner, I'll get an amount of randomly red or blue Leevers that I specify?

...And I bet these scripts can be easily modified to spawn, say, a combination of Blue Leevers and Peahats instead of Blue and Red Leevers...

You're the MAN! *hugs*

But the script is run every time you come back to the room, so they always return... Hmm... Is there any easy way around this, or will it require a bunch of unnecessarily difficult code? I have an idea, if you're willing to consider it; have a script that, instead of generating enemies from scratch, has a random chance to turn a specific kind of enemy from the Screen Enemies list into another kind on screen init. Though this still gives you the 10-enemy limit, it allows one to randomize an enemy type and still make it stay dead when leaving the screen and returning.

Just an idea, but you seem to have plenty of those. ;)

Gleeok
04-12-2008, 04:28 AM
Yeah I was gonna get around to some alt versions sooner or later. Check back in later to remind me if I forget. (I get involved with other things so I forget easily.)

For the peahat/leever idea you want the third enemymaker(dungeon) script. The one where you specify up to 7 enemies to generate. I also realized I forgot to explain this one:




ffc script splitter_spawner{

void run(int eid, int e_max, int s1, int s2, int s3, int s4){

bool init = false;
npc e;

while(true){

if(init == false){

e = Screen->CreateNPC(eid);
init = true; e->X=this->X;e->Y=this->Y;
}
else if(!(e->isValid())){

if(s1>0){
for(int i; i < e_max; i++){
npc s = Screen->CreateNPC(s1);
s->X = this->X;s->Y = this->Y;
}
}
if(s2>0){
for(int i; i < e_max; i++){
npc s = Screen->CreateNPC(s2);
s->X = this->X;s->Y = this->Y;
}
}
if(s3>0){
for(int i; i < e_max; i++){
npc s = Screen->CreateNPC(s3);
s->X = this->X;s->Y = this->Y;
}
}
if(s4>0){
for(int i; i < e_max; i++){
npc s = Screen->CreateNPC(s4);
s->X = this->X;s->Y = this->Y;
}
}
Waitframe();
this->Data = 0;
Quit();
}
else{
this->X = e->X;
this->Y = e->Y;
}
Waitframe();
}
}
}

It creates one freeform (yes freeform boss) enemy at the location of the ffc (D0), then once that enemy dies it splits into an amount of enemies (D1) for each other enemy type (D2-D5) specified. So you can create a freeform Aquamentus that splits into up to 76 enemies multiplied by up to four enemy types. I am so cool :cool:

Schwa
04-12-2008, 06:46 AM
NICE.

In the PTUX tileset from PureZC, there's graphics that go with the Blue Lynels called "Minimentus", which look like tiny versions of Aquamentus... In that tileset, making the Aquamentus split into a bunch of those guys is a very good idea. :D

Of course that's only one of the infinite possibilities... ^_^