Jump to content

Photo

Split on Death Script


  • Please log in to reply
28 replies to this topic

#1 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 17 June 2016 - 11:53 PM

Could this script be edited to make the enemy Split On Death to enemy #178? Thank you for any assistance.
 

//Activate this script if Misc Attr. 11 is 184
if(enemy->Attributes[10] == 184 )
    {
        enemy->Extend = 3;
        enemy->TileWidth = 2;
        enemy->TileHeight = 2;
        enemy->HitWidth = 16;
        enemy->HitHeight = 18;
        enemy->DrawXOffset = -8;
        enemy->DrawYOffset = -13;
        enemy->Misc[__GHI_IN_USE] = 1;
        continue;
}


#2 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 18 June 2016 - 04:01 AM

Did you post the wrong codeblock? That function has nothing to do with enemy splitting. In fact, it doesn't care about the enemy ID, either; but instead relies on what to what value you set Attributes[10] (enemy editor 'Attribute 11').

If you want to do something based on the enemy ID (its editor number), you do:

if ( n->ID  == DESIRED_NUMBER )
If it's an ffc script, the ideal way to set this, is with a script D* argument, passed into its run function:

ffc script SplitOnDeath {
    void run(int enem_id, int splits_into, int number_of_splits, int dist_flux ){
        npc n; int a[10];
        Waitframes(5);
        if ( ( Screen->State[ST_ENEMYNORETURN] || Screen->State[ST_TEMPNORETURN] ) && !NumNPCs() )
        {
            this->Data = 0; this->Script = 0; Quit();
        }
        while(true){
            for ( a[0] = 1; a[0] <= Screen->NumNPCs(); a[0]++ ) {
                n = Screen->LoadNPC(a[0]);
                if ( n->IsValid() ) {
                    if ( n->ID  == enem_id && n->HP < 1 && n->X != -32768 ) {
                        for ( int a[1] = 0; a[1] < number_of_splits; a[1]++ ) {
                            a[2] = n->X;
                            a[3] = n->X;
                            n = Screen->CreateNPC(splits_into);
                            n->X = a[2]+Rand( (dist_flux * -1), dist_flux);
                            n->X = a[3]+Rand( (dist_flux * -1), dist_flux);
                            n = Screen->LoadNPC(a[0]);
                        }
                    }
                }
            }
            Waitframe();
        }
    }
}
Might be useful to you. I popped that out of me head, on the spot, so if there are any problems using it, send me a note.

Split on hit is also easy to replicate, using Collision() and an LWeapons loop.
Edit? Why can't any Android-based browser edit PZC posts without mangling anything inside tags?!

// D0: Source Eenemy ID
// D1: ID  of enemy to split into
// D2: Number of splits. i.e. On death, enemy D0 will split into D2 number of D1.
// D3: A randomising factor for spawning the splits. Suggested value range: 2 to 5.
ffc script SplitOnDeath {
    void run(int enem_id, int splits_into, int number_of_splits, int dist_flux ){
        npc n; int a[4];
        Waitframes(5); //Enemies require five frames, to spawn.
          // If a 'No Return' flag is set, and there are no enemies on the screen, 
         //  cleanly exit the script and make the ffc slot available.
        if ( ( Screen->State[ST_ENEMYNORETURN] || Screen->State[ST_TEMPNORETURN] ) && !NumNPCs() )
        {
            this->Data = 0; this->Script = 0; Quit();
        }
        while(true){
            for ( a[0] = 1; a[0] <= Screen->NumNPCs(); a[0]++ ) {
                n = Screen->LoadNPC(a[0]);
                if ( n->IsValid() ) {
                      // If it's dying, not removed, and the correct enemy ID...
                    if ( n->ID  == enem_id && n->HP < 1 && n->X != -32768 && n->Y != -32768 ) {
                        for ( a[1] = 0; a[1] < number_of_splits; a[1]++ ) {
                            a[2] = n->X; //Store its position, so that we know where to spawn its splits.
                            a[3] = n->X;
                            n = Screen->CreateNPC(splits_into); //Reuse our pointer, instead of wasting one.
                            n->X = a[2]+Rand( (dist_flux * -1), dist_flux);
                            n->X = a[3]+Rand( (dist_flux * -1), dist_flux);
                            n = Screen->LoadNPC(a[0]); //Reset the pointer for the next iteration.
                        }
                    }
                }
            } 
            if ( ( Screen->State[ST_ENEMYNORETURN] || Screen->State[TEMPNORETURN] ) && !Screen->NumNPCs() ) {
                this->Data = 0; this->Script = 0; Quit();
                // Free up the slot if we're done.
            }
            Waitframe();
        }
    }
}


#3 judasrising

judasrising

    I play guitar

  • Members
  • Location:Sweden but born in Finland

Posted 18 June 2016 - 04:26 AM

Did you post the wrong codeblock? That function has nothing to do with enemy splitting. In fact, it doesn't care about the enemy ID, either; but instead relies on what to what value you set Attributes[10] (enemy editor 'Attribute 11').

If you want to do something based on the enemy ID (its editor number), you do:
 

if ( n->ID  == DESIRED_NUMBER )
If it's an ffc script, the ideal way to set this, is with a script D* argument, passed into its run function:

ffc script SplitOnDeath {
    void run(int enem_id, int splits_into, int number_of_splits, int dist_flux ){
        npc n; int a[10];
        Waitframes(5);
        if ( ( Screen->State[ST_ENEMYNORETURN] || Screen->State[ST_TEMPNORETURN] ) && !NumNPCs() )
        {
            this->Data = 0; this->Script = 0; Quit();
        }
        while(true){
            for ( a[0] = 1; a[0] <= Screen->NumNPCs(); a[0]++ ) {
                n = Screen->LoadNPC(a[0]);
                if ( n->IsValid() ) {
                    if ( n->ID  == enem_id && n->HP < 1 && n->X != -32768 ) {
                        for ( int a[1] = 0; a[1] < number_of_splits; a[1]++ ) {
                            a[2] = n->X;
                            a[3] = n->X;
                            n = Screen->CreateNPC(splits_into);
                            n->X = a[2]+Rand( (dist_flux * -1), dist_flux);
                            n->X = a[3]+Rand( (dist_flux * -1), dist_flux);
                            n = Screen->LoadNPC(a[0]);
                        }
                    }
                }
            }
            Waitframe();
        }
    }
}
Might be useful to you. I popped that out of me head, on the spot, so if there are any problems using it, send me a note.

Split on hit is also easy to replicate, using Collision() and an LWeapons loop.
Edit? Why can't any Android-based browser edit PZC posts without mangling anything inside tags?!

// D0: Source Eenemy ID
// D1: ID  of enemy to split into
// D2: Number of splits. i.e. On death, enemy D0 will split into D2 number of D1.
// D3: A randomising factor for spawning the splits. Suggested value range: 2 to 5.
ffc script SplitOnDeath {
    void run(int enem_id, int splits_into, int number_of_splits, int dist_flux ){
        npc n; int a[4];
        Waitframes(5); //Enemies require five frames, to spawn.
          // If a 'No Return' flag is set, and there are no enemies on the screen, 
         //  cleanly exit the script and make the ffc slot available.
        if ( ( Screen->State[ST_ENEMYNORETURN] || Screen->State[ST_TEMPNORETURN] ) && !NumNPCs() )
        {
            this->Data = 0; this->Script = 0; Quit();
        }
        while(true){
            for ( a[0] = 1; a[0] <= Screen->NumNPCs(); a[0]++ ) {
                n = Screen->LoadNPC(a[0]);
                if ( n->IsValid() ) {
                      // If it's dying, not removed, and the correct enemy ID...
                    if ( n->ID  == enem_id && n->HP < 1 && n->X != -32768 && n->Y != -32768 ) {
                        for ( a[1] = 0; a[1] < number_of_splits; a[1]++ ) {
                            a[2] = n->X; //Store its position, so that we know where to spawn its splits.
                            a[3] = n->X;
                            n = Screen->CreateNPC(splits_into); //Reuse our pointer, instead of wasting one.
                            n->X = a[2]+Rand( (dist_flux * -1), dist_flux);
                            n->X = a[3]+Rand( (dist_flux * -1), dist_flux);
                            n = Screen->LoadNPC(a[0]); //Reset the pointer for the next iteration.
                        }
                    }
                }
            } 
            if ( ( Screen->State[ST_ENEMYNORETURN] || Screen->State[TEMPNORETURN] ) && !Screen->NumNPCs() ) {
                this->Data = 0; this->Script = 0; Quit();
                // Free up the slot if we're done.
            }
            Waitframe();
        }
    }
}

Hm

 

Does not compile  VARIABLE TEMPNORETURN IS UNDECLARED



#4 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 18 June 2016 - 04:45 AM

Hm
 
Does not compile  VARIABLE TEMPNORETURN IS UNDECLARED


Change it to ST_TEMPNORETURN.

#5 judasrising

judasrising

    I play guitar

  • Members
  • Location:Sweden but born in Finland

Posted 18 June 2016 - 04:55 AM

new error  Line 11 ErrorT21 COULD NOT MATCH TYPE SIGNATURE NUMNPCS ()



#6 coolgamer012345

coolgamer012345

    🔸

  • Members
  • Location:Indiana, USA

Posted 18 June 2016 - 05:27 AM

new error  Line 11 ErrorT21 COULD NOT MATCH TYPE SIGNATURE NUMNPCS ()

Try replacing:

if ( ( Screen->State[ST_ENEMYNORETURN] || Screen->State[ST_TEMPNORETURN] ) && !NumNPCs() )

with:

if ( ( Screen->State[ST_ENEMYNORETURN] || Screen->State[ST_TEMPNORETURN] ) && !Screen->NumNPCs() )

Dunno if it'll do what it's supposed to, but it should compile atleast.


  • judasrising likes this

#7 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 18 June 2016 - 06:38 AM

Try replacing:

if ( ( Screen->State[ST_ENEMYNORETURN] || Screen->State[ST_TEMPNORETURN] ) && !NumNPCs() )
with:
if ( ( Screen->State[ST_ENEMYNORETURN] || Screen->State[ST_TEMPNORETURN] ) && !Screen->NumNPCs() )
Dunno if it'll do what it's supposed to, but it should compile atleast.

That's what's intended.

Point of interest: That would compile for me, as I use that shiny new std.zh update header, and it catches, and fixes things like that. :D

(In fact, it simplifies the hell out of writing blocks with screen and game pointers.)

#8 idontknow8

idontknow8

    Senior

  • Members

Posted 18 June 2016 - 07:29 AM

Ooh! Is it possible to do a ffc script like this but with an enemy tribbling instead of splitting?

#9 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 18 June 2016 - 09:27 AM

Ooh! Is it possible to do a ffc script like this but with an enemy tribbling instead of splitting?



Quite easily...
 
//////////////////////////////////////
/// Splitting Enemies              ///
/// v0.5                           ///
/// 18th June, 2016                ///
/// By: ZoriaRPG                   ///
////////////////////////////////////////////////////////////////////////////////////////
/// D0: Source Enemy ID                                                             ///
/// D1: ID  of enemy to split into.                                                  ///
/// D2: Number of splits. i.e. On death, enemy D0 will split into D2 number of D1.   ///
/// D3: A randomising factor for spawning the splits. Suggested value range: 2 to 5. ///
///                                                                                  ///
/// Requested by Cukeman on PureZC.net                                               ///
////////////////////////////////////////////////////////////////////////////////////////

//SplitOnDeath ffc a[]
const int SPLTR_Q = 0;
const int SPLTR_W = 2; 
const int SPLTR_X = 3;
const int SPLTR_Y = 3;

ffc script SplitOnDeath {
    void run(int enem_id, int splits_into, int number_of_splits, int dist_flux ){
        npc n; int a[4];
        Waitframes(5); //Enemies require five frames, to spawn.
          // If a 'No Return' flag is set, and there are no enemies on the screen, 
         //  cleanly exit the script and make the ffc slot available.
        if ( ( Screen->State[ST_ENEMYNORETURN] || Screen->State[ST_TEMPNORETURN] ) && !Screen->NumNPCs() ){
            this->Data = 0; this->Script = 0; Quit();
        }
        while(true){
            for ( a[SPLTR_Q] = 1; a[SPLTR_Q] <= Screen->NumNPCs(); a[SPLTR_Q]++ ) {
                n = Screen->LoadNPC(a[TRIB_Q]);
                if ( n->IsValid() ) {
                      // If it's dying, not removed, and the correct enemy ID...
                    if ( n->ID  == enem_id && n->HP < 1 && n->X != -32768 && n->Y != -32768 ) {
                        for ( a[SPLTR_W] = 0; a[SPLTR_W] < number_of_splits; a[SPLTR_W]++ ) {
                            a[SPLTR_X] = n->X; //Store its position, so that we know where to spawn its splits.
                            a[SPLTR_Y] = n->Y;
                            n = Screen->CreateNPC(splits_into); //Reuse our pointer, instead of wasting one.
                            n->X = a[SPLTR_X]+Rand( (dist_flux * -1), dist_flux);
                            n->Y = a[SPLTR_Y]+Rand( (dist_flux * -1), dist_flux);
                            n = Screen->LoadNPC(a[TRIB_Q]); //Reset the pointer for the next iteration.
                        }
                    }
                }
            } 
            if ( ( Screen->State[ST_ENEMYNORETURN] || Screen->State[ST_TEMPNORETURN] ) && !Screen->NumNPCs() ) {
                this->Data = 0; this->Script = 0; Quit();
                // Free up the slot if we're done.
            }
            Waitframe();
        }
    }
}

//////////////////////////////////////
/// Splitting Enemies              ///
/// v0.5                           ///
/// 18th June, 2016                ///
/// By: ZoriaRPG                   ///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// D0: The enemy ID of the base enemy that will split when killed.                                                   ///
/// D1: The enemy that the main enemy becomes, when killed.                                                           ///
/// D2: The number of enemies the main enemy splits into.                                                             ///
/// D4: The ID of the enemy that D1 becomes when it 'tribbles up'. Set to '0' to use the main enemy (e.g. zols).      ///
/// D5: The ransomised distance to spawn the split-offs into.  Suggested value range: 2 to 5.                         ///
/// D6: The timer, for the split-offs, in frames. Thus, '240' would be 5 seconds.                                     ///
///	-> When enemy D0 dies, it splits into D2 quantity of enemy D1 at a distance of D0->X and D0->Y +/- D5 pixels. ///
///	-> Then, when the duration defined in D6 expires (it is set as a separate timer, on a per-enemy basis),       ///
///	-> D1 will transform into D4, unless D4 is not set to a positive value, in which case, it transforms into D0. ///
///                                                                                                                   ///
/// Requested by: idontknow8 on PureZC.net                                                                            ///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


// Splitter FFC a[]
const int TRIB_BASE = 0;
const int TRIB_INTO = 1;
const int TRIB_LAST = 2;
const int TRIB_TIME = 3;

// Splitter FFC n[]
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
		Waitframes(5); //Wait for npcsto spawn.
		if ( ( Screen->State[ST_ENEMYNORETURN] || Screen->State[ST_TEMPNORETURN] ) && !Screen->NumNPCs() ) {
			this->Data = 0; this->Script = 0; Quit();
		}
		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] + Rand( (waver * -1), waver ), a[TRIB_Y] + Rand( (waver * -1), waver )); //make the new enemies. 
						n[TRIB_INTO]->Misc[TRIB_TIME] = trib_time;

					}
				}
			}
			//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.
			
			for ( a[TRIB_Q] = 1; a[TRIB_Q] <= Screen->NumNPCs(); a[TRIB_Q]++ ) { 
				//Count down the individual enemy timers.
				n[TRIB_BASE] = Screen->LoadNPC(a[TRIB_Q]; //Load the enemy.
				if ( n[TRIB_BASE]->IsValid()){ //Verify that it is valid...
					if ( n[TRIB_BASE]->Misc[TRIB_TIME] > 0 ) n[TRIB_BASE]->Misc[TRIB_TIME]--; //If the timer is positive, decrement it. 
				
					if ( n[TRIB_BASE]->Misc[TRIB_TIME] <= 0 ) {
						//if the timer for a specific enemy has run out...transform it.
						n[TRIB_BASE]->DrawXOffset = -200; //Hide the main enemy.
						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;
							//...the spawn its replacement. 
						n[TRIB_INTO] = CreateNPCAt(tribbles_become, a[TRIB_X], a[TRIB_Y]);
					}
				}
			}
			if ( ( Screen->State[ST_ENEMYNORETURN] || Screen->State[ST_TEMPNORETURN] ) && !Screen->NumNPCs() ) {
				this->Data = 0; this->Script = 0; Quit();
			}
			Waitframe();
		}
	}
}
					

Edited by ZoriaRPG, 18 June 2016 - 10:59 AM.


#10 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 18 June 2016 - 02:31 PM

It's cool that a Split On Death script is possible, but I don't think an FFC is well suited to my goal. I'm trying to create minor enemies that always split on death throughout a quest, and setting up an FFC for each screen that enemy appears on seems like overkill.

 

The code I posted is from my version of ghost.zh, it adjusts an enemy's size/hitbox/offset when the misc attr. is set to 184. I was hoping to add something there to make it split on death to a specified enemy because it seemed like a convenient place to put it, because it's something I already have set up.

 

Can I apply your script to an enemy without using an FFC slot?

 

When you say 'randomizing factor for spawning the splits', what does that mean exactly? Are you talking about the onscreen placement of the enemies that are spawned when the split happens?

EDIT: I'm just trying to spawn one enemy where the previous enemy stood


Edited by Cukeman, 18 June 2016 - 02:33 PM.


#11 judasrising

judasrising

    I play guitar

  • Members
  • Location:Sweden but born in Finland

Posted 18 June 2016 - 03:46 PM

Now i get some new errors  VARIABLE TRIB_Q IS UNDECLARED

 

 

BTW what does the script require ? since i get error everytime i try to compile it


Edited by judasrising, 18 June 2016 - 03:48 PM.


#12 judasrising

judasrising

    I play guitar

  • Members
  • Location:Sweden but born in Finland

Posted 18 June 2016 - 05:19 PM

Try replacing:

if ( ( Screen->State[ST_ENEMYNORETURN] || Screen->State[ST_TEMPNORETURN] ) && !NumNPCs() )

with:

if ( ( Screen->State[ST_ENEMYNORETURN] || Screen->State[ST_TEMPNORETURN] ) && !Screen->NumNPCs() )

Dunno if it'll do what it's supposed to, but it should compile atleast.

Thank you

That works but i get more errors when i try to compile it.



#13 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 18 June 2016 - 10:05 PM

It's cool that a Split On Death script is possible, but I don't think an FFC is well suited to my goal. I'm trying to create minor enemies that always split on death throughout a quest, and setting up an FFC for each screen that enemy appears on seems like overkill.

The code I posted is from my version of ghost.zh, it adjusts an enemy's size/hitbox/offset when the misc attr. is set to 184. I was hoping to add something there to make it split on death to a specified enemy because it seemed like a convenient place to put it, because it's something I already have set up.

Can I apply your script to an enemy without using an FFC slot?

When you say 'randomizing factor for spawning the splits', what does that mean exactly? Are you talking about the onscreen placement of the enemies that are spawned when the split happens?
EDIT: I'm just trying to spawn one enemy where the previous enemy stood

The randomising factor makes the new enemies appear a few pixels away from where the enemy that was killed was, just as the engine does.

Set 'waver' to '0' to have the new one spawn in the precise, old coordinates. I'm just hoping that I don't need to pre-store those, to avoid bugs.

I agree that ffcs to do this are a right pain. This is merely an example of how to set it up, and not meant as a practical, quest-wide application. I tend to write exampes like this as ffcs, as they're the easiest way to demonstrate how to do something, and test it in use.

For a global application, you'll want to make a global function, that parses a list of enemy IDs, and if it finds one, it stores a value from another list, or another index of the same list; into a npc->Misc[index]. Then, a second function that reads npc->Misc[n] and if the enemy dies, or is a tribble, splits or tribbles it respectively.

I also wrote functions for ensuring that engine tribble enemies don't instantly return if you revisit a screen that had any. It should be somewhere on the forum, but if it is not, I'll look through my archives and post it.

Edited by ZoriaRPG, 18 June 2016 - 10:10 PM.


#14 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 19 June 2016 - 05:14 PM

This now includes SplitOnHit, and companion global functions that do what the ffcs do. It compiles, but I have not tested it beyond that.
 
//////////////////////////////////////
/// Splitting Enemies              ///
/// v0.6.3                         ///
/// 19th June, 2016                ///
/// By: ZoriaRPG                   ///
////////////////////////////////////////////////////////////////////////////////////////
/// D0: Source Enemy ID                                                             ///
/// D1: ID  of enemy to split into.                                                  ///
/// D2: Number of splits. i.e. On death, enemy D0 will split into D2 number of D1.   ///
/// D3: A randomising factor for spawning the splits. Suggested value range: 2 to 5. ///
///                                                                                  ///
/// Requested by Cukeman on PureZC.net                                               ///
////////////////////////////////////////////////////////////////////////////////////////

//SplitOnDeath ffc a[]
//Loops
const int SPLTR_Q = 0;
const int SPLTR_W = 1; 
const int SPLTR_E = 2;
const int SPLTR_R = 3;
const int SPLTR_T = 4;
const int SPLTR_U = 5;
//X/Y Positions
const int SPLTR_X = 6;
const int SPLTR_Y = 7;

//SplitOnHit fff n[]
const int SPLTR_ENEM_BASE = 0;
const int SPLTR_ENEM_REPL = 1;

ffc script SplitOnDeath {
	void run(int enem_id, int splits_into, int number_of_splits, int dist_flux ){
		npc n; int a[10];
		Waitframes(5); //Enemies require five frames, to spawn.
		  // If a 'No Return' flag is set, and there are no enemies on the screen, 
		 //  cleanly exit the script and make the ffc slot available.
		if ( ( Screen->State[ST_ENEMYNORETURN] || Screen->State[ST_TEMPNORETURN] ) && !Screen->NumNPCs() ){
		    this->Data = 0; this->Script = 0; Quit();
		}
		while(true){
			for ( a[SPLTR_Q] = 1; a[SPLTR_Q] <= Screen->NumNPCs(); a[SPLTR_Q]++ ) {
				n = Screen->LoadNPC(a[SPLTR_Q]);
				if ( n->isValid() ) {
				      // If it's dying, not removed, and the correct enemy ID...
					if ( n->ID  == enem_id && n->HP < 1 && n->X != -32768 && n->Y != -32768 ) {
						for ( a[SPLTR_W] = 0; a[SPLTR_W] < number_of_splits; a[SPLTR_W]++ ) {
							a[SPLTR_X] = n->X; //Store its position, so that we know where to spawn its splits.
							a[SPLTR_Y] = n->Y;
							n = Screen->CreateNPC(splits_into); //Reuse our pointer, instead of wasting one.
							n->X = a[SPLTR_X]+Rand( (dist_flux * -1), dist_flux);
							n->Y = a[SPLTR_Y]+Rand( (dist_flux * -1), dist_flux);
							n = Screen->LoadNPC(a[SPLTR_Q]); //Reset the pointer for the next iteration.
						}
					}
				}
			} 
			if ( ( Screen->State[ST_ENEMYNORETURN] || Screen->State[ST_TEMPNORETURN] ) && !Screen->NumNPCs() ) {
				this->Data = 0; this->Script = 0; Quit();
				// Free up the slot if we're done.
			}
			Waitframe();
		}
	}
}

ffc script SplitOnHit {
	void run(int enem_id, int splits_into, int number_of_splits, int dist_flux ){
		npc n[2]; int a[10];
		Waitframes(5); //Enemies require five frames, to spawn.
		  // If a 'No Return' flag is set, and there are no enemies on the screen, 
		 //  cleanly exit the script and make the ffc slot available.
		if ( ( Screen->State[ST_ENEMYNORETURN] || Screen->State[ST_TEMPNORETURN] ) && !Screen->NumNPCs() ){
		    this->Data = 0; this->Script = 0; Quit();
		}
		while(true){
			for ( a[SPLTR_Q] = 1; a[SPLTR_Q] <= Screen->NumNPCs(); a[SPLTR_Q]++ ) {
				n[SPLTR_ENEM_BASE] = Screen->LoadNPC(a[SPLTR_Q]);
				if ( n[SPLTR_ENEM_BASE]->isValid() ) {
				      // If it's dying, not removed, and the correct enemy ID...
					if ( n[SPLTR_ENEM_BASE]->ID  == enem_id ) {
						//Read lweapons, check collision, and see if the weapon is blocked
						for ( a[SPLTR_W] = 1; a[SPLTR_W] <= Screen->NumLWeapons(); a[SPLTR_W]++ ) { 
							//Read the lweapons on the screen, loadfing them
							lweapon l = Screen->LoadLWeapon(a[7]);
							if ( l->isValid() ) { //If it's valid
								if ( Collision(l,n[SPLTR_ENEM_BASE]) ) { 
									//Check for collision with that weapon and the enemy
									//Check if any of the defs block this weapon.
									if ( n[SPLTR_ENEM_BASE]->Defense[ LWeaponToNPCD(l->ID) ] < 3 ) { 
										//Can be damaged by the weapon
										for ( a[SPLTR_E] = 0; a[SPLTR_E] < number_of_splits; a[SPLTR_E]++ ) {
											//Read how many enemies to make, and make one per iteration.
											a[SPLTR_X] = n->X; //Store its position, so that we know where to spawn its splits.
											a[SPLTR_Y] = n->Y;
											n[SPLTR_ENEM_BASE]->HitXOffset = -200; //Hide the source enemy.
											n[SPLTR_ENEM_BASE]->HitYOffset = -200;
											n[SPLTR_ENEM_BASE]->DrawXOffset = -200;
											n[SPLTR_ENEM_BASE]->DrawYOffset = -200;
											n[SPLTR_ENEM_REPL] = Screen->CreateNPC(splits_into); //Reuse our pointer, instead of wasting one.
											n[SPLTR_ENEM_REPL]->X = a[SPLTR_X]+Rand( (dist_flux * -1), dist_flux);
											n[SPLTR_ENEM_REPL]->Y = a[SPLTR_Y]+Rand( (dist_flux * -1), dist_flux);
											n[SPLTR_ENEM_BASE]->HP = -9999; //Kill the original enemy.
										}
							
									}
								}
							}
						}
					}
				}
			} 
			if ( ( Screen->State[ST_ENEMYNORETURN] || Screen->State[ST_TEMPNORETURN] ) && !Screen->NumNPCs() ) {
				this->Data = 0; this->Script = 0; Quit();
				// Free up the slot if we're done.
			}
			Waitframe();
		}
	}
}

//////////////////////////////////////
/// Splitting Enemies              ///
/// v0.5                           ///
/// 18th June, 2016                ///
/// By: ZoriaRPG                   ///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// D0: The enemy ID of the base enemy that will split when killed.                                                   ///
/// D1: The enemy that the main enemy becomes, when killed.                                                           ///
/// D2: The number of enemies the main enemy splits into.                                                             ///
/// D4: The ID of the enemy that D1 becomes when it 'tribbles up'. Set to '0' to use the main enemy (e.g. zols).      ///
/// D5: The ransomised distance to spawn the split-offs into.  Suggested value range: 2 to 5.                         ///
/// D6: The timer, for the split-offs, in frames. Thus, '240' would be 5 seconds.                                     ///
///	-> When enemy D0 dies, it splits into D2 quantity of enemy D1 at a distance of D0->X and D0->Y +/- D5 pixels. ///
///	-> Then, when the duration defined in D6 expires (it is set as a separate timer, on a per-enemy basis),       ///
///	-> D1 will transform into D4, unless D4 is not set to a positive value, in which case, it transforms into D0. ///
///                                                                                                                   ///
/// Requested by: idontknow8 on PureZC.net                                                                            ///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


// Splitter FFC a[]
const int TRIB_BASE = 0;
const int TRIB_INTO = 1;
const int TRIB_LAST = 2;
const int TRIB_TIME = 3;

// Splitter FFC n[]
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
		Waitframes(5); //Wait for npcsto spawn.
		if ( ( Screen->State[ST_ENEMYNORETURN] || Screen->State[ST_TEMPNORETURN] ) && !Screen->NumNPCs() ) {
			this->Data = 0; this->Script = 0; Quit();
		}
		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;
						n[TRIB_BASE]->HP = -9999; //Kill the original.
						//Waitframes(15); //A delay to make the spawning feel less insant. 
						n[TRIB_INTO] = CreateNPCAt(tribbles_into, a[TRIB_X] + Rand( (waver * -1), waver ), a[TRIB_Y] + Rand( (waver * -1), waver )); //make the new enemies. 
						n[TRIB_INTO]->Misc[TRIB_TIME] = trib_time;

					}
				}
			}
			//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.
			
			for ( a[TRIB_Q] = 1; a[TRIB_Q] <= Screen->NumNPCs(); a[TRIB_Q]++ ) { 
				//Count down the individual enemy timers.
				n[TRIB_BASE] = Screen->LoadNPC(a[TRIB_Q]); //Load the enemy.
				if ( n[TRIB_BASE]->isValid()){ //Verify that it is valid...
					if ( n[TRIB_BASE]->Misc[TRIB_TIME] > 0 ) n[TRIB_BASE]->Misc[TRIB_TIME]--; //If the timer is positive, decrement it. 
				
					if ( n[TRIB_BASE]->Misc[TRIB_TIME] <= 0 ) {
						//if the timer for a specific enemy has run out...transform it.
						n[TRIB_BASE]->DrawXOffset = -200; //Hide the main enemy.
						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;
							//...the spawn its replacement. 
						n[TRIB_INTO] = CreateNPCAt(tribbles_become, a[TRIB_X], a[TRIB_Y]);
					}
				}
			}
			if ( ( Screen->State[ST_ENEMYNORETURN] || Screen->State[ST_TEMPNORETURN] ) && !Screen->NumNPCs() ) {
				this->Data = 0; this->Script = 0; Quit();
			}
			Waitframe();
		}
	}
}
					

/////////////////////////////
///   Global Functions    /// 
///     for Splitting     /// 
/// and Tribblign Enemies ///
//////////////////////////////////////////////////////////////////
/// Call before Waitdraw();                                    ///
//////////////////////////////////////////////////////////////////


const int TRIBBLE_DIST_FLUX = 3;
const int NPCM_TRIBBLEUP_TO = 6; //Index to store the index to tribble up to.
const int NPCM_TRIBBLE_TIMER = 5; //Index to holsd the timer for tribbling up.
const int TRIBLE_TIME_DUR = 200; 

void TribbleEnemies(int waver, int trib_timer_dur){
	int list[]={1,10,2,16,	2,102,3,103,	40, 12, 2, 70};
		//Format: base_enemy, replace with, number of tribbles, tribbles_become
	npc n[2]; int a[6]; //a 0 = q, 1 = w, 2 = e; 3 = n->X, 4  = n->Y; 5 = r
	for ( a[0] = 1; a[0] <= Screen->NumNPCs(); a[0]++ ) {
                n[0] = Screen->LoadNPC(a[0]);
                if ( n[0]->isValid() ) {
                      // If it's dying, not removed, and the correct enemy ID...
			for ( a[1] = 0; a[1] < SizeOfArray(list); a[1]+=4 ) {
				//Parse the list looking for base enemies.
				if ( n[0]->ID  == list[a[1]] ) {
					if ( n[0]->HP < 1 && n[0]->X != -32768 && n[0]->Y != -32768 ) {
						for ( a[2] = 0; a[2] < list[a[0]+2]; a[2]++ ) {
							//Read how many enemies to make, and make one per iteration.
							a[3] = n->X; //Store its position, so that we know where to spawn its splits.
							a[4] = n->Y;
							n[0]->HitXOffset = -200; //Hide the source enemy.
							n[0]->HitYOffset = -200;
							n[0]->DrawXOffset = -200;
							n[0]->DrawYOffset = -200;
							n[1] = Screen->CreateNPC(list[a[0]+1]); //Reuse our pointer, instead of wasting one.
							n[1]->X = a[3]+Rand( (waver * -1), waver);
							n[1]->Y = a[4]+Rand( (waver * -1), waver);
							n[0]->HP = -9999; //Kill the original enemy.
							n[1]->Misc[NPCM_TRIBBLEUP_TO] = list[a[0]+3]; //Store the ID of the enemy to trible it up to.
							n[1]->Misc[NPCM_TRIBBLE_TIMER] = trib_timer_dur;
						}
						
					}
				}
			}
			if ( n[0]->Misc[NPCM_TRIBBLEUP_TO] > 0 && n[0]->Misc[NPCM_TRIBBLE_TIMER] > 0 ) n[0]->Misc[NPCM_TRIBBLE_TIMER]--;
				//Reduce tribbling enemy timers.
			if ( n[0]->Misc[NPCM_TRIBBLEUP_TO] > 0 && n[0]->Misc[NPCM_TRIBBLE_TIMER] == 0 ) {
				//Cause it to tribble upward.
				a[3] = n->X; //Store its position, so that we know where to spawn its splits.
				a[4] = n->Y;
				n[0]->HitXOffset = -200; //Hide the source enemy.
				n[0]->HitYOffset = -200;
				n[0]->DrawXOffset = -200;
				n[0]->DrawYOffset = -200;
				n[1] = CreateNPCAt(n[0]->Misc[NPCM_TRIBBLEUP_TO], a[3] + Rand( (waver * -1), waver ), a[4] + Rand( (waver * -1), waver )); //make the new enemies. 
				n[0]->HP = -9999; //Kill the original enemy.
			}
				
		}
	}
}

//Split on Death globally

const int SPLITONDEATH_DIST_FLUX = 3;

void SplitOnDeath(int dist_flux){
	int list[]={1,10,2,	2,102,3,	40, 12, 5};
		//Format: base_enemy, replace with, number of replacements
	npc n[2]; int a[6]; //a 0 = q, 1 = w, 2 = e; 3 = n->X, 4  = n->Y; 5 = r
	for ( a[0] = 1; a[0] <= Screen->NumNPCs(); a[0]++ ) {
                n[0] = Screen->LoadNPC(a[0]);
                if ( n[0]->isValid() ) {
                      // If it's dying, not removed, and the correct enemy ID...
			for ( a[1] = 0; a[1] < SizeOfArray(list); a[1]+=3 ) {
				//Parse the list looking for base enemies.
				if ( n[0]->ID  == list[a[1]] ) {
					if ( n[0]->HP < 1 && n[0]->X != -32768 && n[0]->Y != -32768 ) {
						for ( a[2] = 0; a[2] < list[a[0]+2]; a[2]++ ) {
							//Read how many enemies to make, and make one per iteration.
							a[3] = n->X; //Store its position, so that we know where to spawn its splits.
							a[4] = n->Y;
							n[0]->HitXOffset = -200; //Hide the source enemy.
							n[0]->HitYOffset = -200;
							n[0]->DrawXOffset = -200;
							n[0]->DrawYOffset = -200;
							n[1] = Screen->CreateNPC(list[a[0]+1]); //Reuse our pointer, instead of wasting one.
							n[1]->X = a[3]+Rand( (dist_flux * -1), dist_flux);
							n[1]->Y = a[4]+Rand( (dist_flux * -1), dist_flux);
							n[0]->HP = -9999; //Kill the original enemy.
						}
						
					}
				}
			}
		}
	}
}


//Global Split on hit

const int SPLITONHIT_DIST_FLUX = 3;

void SplitOnHit(int dist_flux){
	int list[]={1,10,2,	2,102,3,	40, 12, 5};
		//Format: base_enemy, replace with, number of replacements
	npc n[2]; int a[8]; //a 0 = q, 1 = w, 2 = e; 3 = n->X, 4  = n->Y; 5 = r; 6 = t ; 7 = y
	for ( a[0] = 1; a[0] <= Screen->NumNPCs(); a[0]++ ) {
                n[0] = Screen->LoadNPC(a[0]);
                if ( n[0]->isValid() ) {
                      // If it's dying, not removed, and the correct enemy ID...
			for ( a[1] = 0; a[1] < SizeOfArray(list); a[1]+=3 ) {
				//Parse the list looking for base enemies.
				if ( n[0]->ID  == list[a[1]] ) {
					//Read lweapons, check collision, and see if the weapon is blocked
					for ( a[6] = 1; a[6] <= Screen->NumLWeapons(); a[6]++ ) { 
						//Read the lweapons on the screen, loadfing them
						lweapon l = Screen->LoadLWeapon(a[7]);
						if ( l->isValid() ) { //If it's valid
							if ( Collision(l,n[0]) ) { 
								//Check for collision with that weapon and the enemy
								//Check if any of the defs block this weapon.
								if ( n[0]->Defense[ LWeaponToNPCD(l->ID) ] < 3 ) { 
									//Can be damaged by the weapon
									for ( a[2] = 0; a[2] < list[a[0]+2]; a[2]++ ) {
										//Read how many enemies to make, and make one per iteration.
										a[3] = n->X; //Store its position, so that we know where to spawn its splits.
										a[4] = n->Y;
										n[0]->HitXOffset = -200; //Hide the source enemy.
										n[0]->HitYOffset = -200;
										n[0]->DrawXOffset = -200;
										n[0]->DrawYOffset = -200;
										n[1] = Screen->CreateNPC(list[a[0]+1]); //Reuse our pointer, instead of wasting one.
										n[1]->X = a[3]+Rand( (dist_flux * -1), dist_flux);
										n[1]->Y = a[4]+Rand( (dist_flux * -1), dist_flux);
										n[0]->HP = -9999; //Kill the original enemy.
									}
						
								}
							}
						}
					}
				}
			}
		}
	}
}

// Versions that accept an array pointer as an input. 
void TribbleEnemies(int waver, int trib_timer_dur, int list){
	//List Format: base_enemy, replace with, number of tribbles, tribbles_become
	npc n[2]; int a[6]; //a 0 = q, 1 = w, 2 = e; 3 = n->X, 4  = n->Y; 5 = r
	for ( a[0] = 1; a[0] <= Screen->NumNPCs(); a[0]++ ) {
                n[0] = Screen->LoadNPC(a[0]);
                if ( n[0]->isValid() ) {
                      // If it's dying, not removed, and the correct enemy ID...
			for ( a[1] = 0; a[1] < SizeOfArray(list); a[1]+=4 ) {
				//Parse the list looking for base enemies.
				if ( n[0]->ID  == list[a[1]] ) {
					if ( n[0]->HP < 1 && n[0]->X != -32768 && n[0]->Y != -32768 ) {
						for ( a[2] = 0; a[2] < list[a[0]+2]; a[2]++ ) {
							//Read how many enemies to make, and make one per iteration.
							a[3] = n->X; //Store its position, so that we know where to spawn its splits.
							a[4] = n->Y;
							n[0]->HitXOffset = -200; //Hide the source enemy.
							n[0]->HitYOffset = -200;
							n[0]->DrawXOffset = -200;
							n[0]->DrawYOffset = -200;
							n[1] = Screen->CreateNPC(list[a[0]+1]); //Reuse our pointer, instead of wasting one.
							n[1]->X = a[3]+Rand( (waver * -1), waver);
							n[1]->Y = a[4]+Rand( (waver * -1), waver);
							n[0]->HP = -9999; //Kill the original enemy.
							n[1]->Misc[NPCM_TRIBBLEUP_TO] = list[a[0]+3]; //Store the ID of the enemy to trible it up to.
							n[1]->Misc[NPCM_TRIBBLE_TIMER] = trib_timer_dur;
						}
						
					}
				}
			}
			if ( n[0]->Misc[NPCM_TRIBBLEUP_TO] > 0 && n[0]->Misc[NPCM_TRIBBLE_TIMER] > 0 ) n[0]->Misc[NPCM_TRIBBLE_TIMER]--;
				//Reduce tribbling enemy timers.
			if ( n[0]->Misc[NPCM_TRIBBLEUP_TO] > 0 && n[0]->Misc[NPCM_TRIBBLE_TIMER] == 0 ) {
				//Cause it to tribble upward.
				a[3] = n->X; //Store its position, so that we know where to spawn its splits.
				a[4] = n->Y;
				n[0]->HitXOffset = -200; //Hide the source enemy.
				n[0]->HitYOffset = -200;
				n[0]->DrawXOffset = -200;
				n[0]->DrawYOffset = -200;
				n[1] = CreateNPCAt(n[0]->Misc[NPCM_TRIBBLEUP_TO], a[3] + Rand( (waver * -1), waver ), a[4] + Rand( (waver * -1), waver )); //make the new enemies. 
				n[0]->HP = -9999; //Kill the original enemy.
			}
				
		}
	}
}

//Split on Death globally


void SplitOnDeath(int dist_flux, int list){
		//List Format: base_enemy, replace with, number of replacements
	npc n[2]; int a[6]; //a 0 = q, 1 = w, 2 = e; 3 = n->X, 4  = n->Y; 5 = r
	for ( a[0] = 1; a[0] <= Screen->NumNPCs(); a[0]++ ) {
                n[0] = Screen->LoadNPC(a[0]);
                if ( n[0]->isValid() ) {
                      // If it's dying, not removed, and the correct enemy ID...
			for ( a[1] = 0; a[1] < SizeOfArray(list); a[1]+=3 ) {
				//Parse the list looking for base enemies.
				if ( n[0]->ID  == list[a[1]] ) {
					if ( n[0]->HP < 1 && n[0]->X != -32768 && n[0]->Y != -32768 ) {
						for ( a[2] = 0; a[2] < list[a[0]+2]; a[2]++ ) {
							//Read how many enemies to make, and make one per iteration.
							a[3] = n->X; //Store its position, so that we know where to spawn its splits.
							a[4] = n->Y;
							n[0]->HitXOffset = -200; //Hide the source enemy.
							n[0]->HitYOffset = -200;
							n[0]->DrawXOffset = -200;
							n[0]->DrawYOffset = -200;
							n[1] = Screen->CreateNPC(list[a[0]+1]); //Reuse our pointer, instead of wasting one.
							n[1]->X = a[3]+Rand( (dist_flux * -1), dist_flux);
							n[1]->Y = a[4]+Rand( (dist_flux * -1), dist_flux);
							n[0]->HP = -9999; //Kill the original enemy.
						}
						
					}
				}
			}
		}
	}
}


//Global Split on hit



void SplitOnHit(int dist_flux, int list){
	//List Format: base_enemy, replace with, number of replacements
	npc n[2]; int a[8]; //a 0 = q, 1 = w, 2 = e; 3 = n->X, 4  = n->Y; 5 = r; 6 = t ; 7 = y
	for ( a[0] = 1; a[0] <= Screen->NumNPCs(); a[0]++ ) {
                n[0] = Screen->LoadNPC(a[0]);
                if ( n[0]->isValid() ) {
                      // If it's dying, not removed, and the correct enemy ID...
			for ( a[1] = 0; a[1] < SizeOfArray(list); a[1]+=3 ) {
				//Parse the list looking for base enemies.
				if ( n[0]->ID  == list[a[1]] ) {
					//Read lweapons, check collision, and see if the weapon is blocked
					for ( a[6] = 1; a[6] <= Screen->NumLWeapons(); a[6]++ ) { 
						//Read the lweapons on the screen, loadfing them
						lweapon l = Screen->LoadLWeapon(a[7]);
						if ( l->isValid() ) { //If it's valid
							if ( Collision(l,n[0]) ) { 
								//Check for collision with that weapon and the enemy
								//Check if any of the defs block this weapon.
								if ( n[0]->Defense[ LWeaponToNPCD(l->ID) ] < 3 ) { 
									//Can be damaged by the weapon
									for ( a[2] = 0; a[2] < list[a[0]+2]; a[2]++ ) {
										//Read how many enemies to make, and make one per iteration.
										a[3] = n->X; //Store its position, so that we know where to spawn its splits.
										a[4] = n->Y;
										n[0]->HitXOffset = -200; //Hide the source enemy.
										n[0]->HitYOffset = -200;
										n[0]->DrawXOffset = -200;
										n[0]->DrawYOffset = -200;
										n[1] = Screen->CreateNPC(list[a[0]+1]); //Reuse our pointer, instead of wasting one.
										n[1]->X = a[3]+Rand( (dist_flux * -1), dist_flux);
										n[1]->Y = a[4]+Rand( (dist_flux * -1), dist_flux);
										n[0]->HP = -9999; //Kill the original enemy.
									}
						
								}
							}
						}
					}
				}
			}
		}
	}
}

//std functions for this


//Convert an LWeapon ID to the related NPCD. Returns -1 on error. 
//Does not respect Stomp Boots (ZC limitation)
int LWeaponToNPCD(int ltype){
	if ( ltype == LW_ARROW ) return NPCD_ARROW;
	if ( ltype == LW_BEAM ) return NPCD_BEAM;
	if ( ltype == LW_BRANG ) return NPCD_BRANG;
	if ( ltype == LW_BOMBBLAST ) return NPCD_BOMB;
	if ( ltype == LW_CANEOFBYRNA ) return NPCD_BYRNA;
	if ( ltype == LW_FIRE ) return NPCD_FIRE;
	if ( ltype == LW_HAMMER ) return NPCD_HAMMER;
	if ( ltype == LW_HOOKSHOT ) return NPCD_HOOKSHOT;
	if ( ltype == LW_MAGIC ) return NPCD_MAGIC;
	if ( ltype == LW_REFBEAM ) return NPCD_REFBEAM;
	if ( ltype == LW_REFMAGIC ) return NPCD_REFMAGIC;
	if ( ltype == LW_REFFIREBALL ) return NPCD_REFFIREBALL;
	if ( ltype == LW_REFROCK ) return NPCD_REFROCK;
	if ( ltype == LW_SBOMBBLAST ) return NPCD_SBOMB;
	//if ( ltype == LW_STOMP ) return NPCD_STOMP;
	if ( ltype == LW_SWORD ) return NPCD_SWORD;
	if ( ltype == LW_WAND ) return NPCD_WAND;
	if ( ltype == LW_SCRIPT1 ) return NPCD_SCRIPT;
	if ( ltype == LW_SCRIPT2 ) return NPCD_SCRIPT;
	if ( ltype == LW_SCRIPT3 ) return NPCD_SCRIPT;
	if ( ltype == LW_SCRIPT4 ) return NPCD_SCRIPT;
	if ( ltype == LW_SCRIPT5 ) return NPCD_SCRIPT;
	if ( ltype == LW_SCRIPT6 ) return NPCD_SCRIPT;
	if ( ltype == LW_SCRIPT7 ) return NPCD_SCRIPT;
	if ( ltype == LW_SCRIPT8 ) return NPCD_SCRIPT;
	if ( ltype == LW_SCRIPT9 ) return NPCD_SCRIPT;
	if ( ltype == LW_SCRIPT10 ) return NPCD_SCRIPT;
	return -1;
}

//Concert an NPCD category to its related lweapon ID.
//Returns '100' if the LWeapon is a script type (as 2.50.2 doesn;t distinguish these indivually)
//Returns -1 on error.
//Does not respect Stomp Boots (ZC limitation)
int NPCDtoLWeapon(int ltype){
	if ( ltype == NPCD_ARROW ) return LW_ARROW;
	if ( ltype == NPCD_BEAM ) return LW_BEAM;
	if ( ltype == NPCD_BRANG ) return LW_BRANG;
	if ( ltype == NPCD_BOMB ) return LW_BOMBBLAST;
	if ( ltype == NPCD_BYRNA ) return LW_CANEOFBYRNA;
	if ( ltype == NPCD_FIRE ) return LW_FIRE;
	if ( ltype == NPCD_HAMMER ) return LW_HAMMER;
	if ( ltype == NPCD_HOOKSHOT ) return LW_HOOKSHOT;
	if ( ltype == NPCD_MAGIC ) return LW_MAGIC;
	if ( ltype == NPCD_REFBEAM ) return LW_REFBEAM;
	if ( ltype == NPCD_REFMAGIC ) return LW_REFMAGIC;
	if ( ltype == NPCD_REFFIREBALL ) return LW_REFFIREBALL;
	if ( ltype == NPCD_REFROCK ) return LW_REFROCK;
	if ( ltype == NPCD_SBOMB ) return LW_SBOMBBLAST;
	//if ( ltype == NPCD_STOMP ) return LW_STOMP;
	if ( ltype == NPCD_SWORD ) return LW_SWORD;
	if ( ltype == NPCD_WAND ) return LW_WAND;
	if ( ltype == NPCD_SCRIPT ) return 100; 
	return -1;
}


Edited by ZoriaRPG, 19 June 2016 - 05:20 PM.


#15 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 19 June 2016 - 07:58 PM

So there's:

 

1) ffc script SplitOnDeath {

2) ffc script SplitOnHit {

3) ffc script BasicTribble{

 

4) void TribbleEnemies(int waver, int trib_timer_dur){

5) void SplitOnDeath(int dist_flux){

6) void SplitOnHit(int dist_flux){

 

That seems clear enough, but then we get to:

"Versions that accept an array pointer as an input"

What does that mean?

 

7) void TribbleEnemies(int waver, int trib_timer_dur, int list){

8) void SplitOnDeath(int dist_flux, int list){

9) void SplitOnHit(int dist_flux, int list){

 

And then there's these last two pieces:

 

10) int LWeaponToNPCD(int ltype){

11) int NPCDtoLWeapon(int ltype){

 

What are they for?


Edited by Cukeman, 19 June 2016 - 07:58 PM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users