Jump to content

Photo

Enemy spawners


  • Please log in to reply
3 replies to this topic

#1 klop422

klop422

    Evil Crazy Mastermind

  • Members
  • Real Name:Not Valentino
  • Gender:Male
  • Location:Planet Earth

Posted 18 September 2017 - 07:07 AM

I know I keep asking things, but I have another issue.

 

I have made a setup where I have an invisible, intangible (with ZoriaRPG's script from my previous topic) wizzrobe which spawns an enemy (essentially a bat wizzrobe), but it isn't spawning anything. I've set everything up as follows (with the graphic only there to show me the enemy when testing):

i1n3h87yk0fwpd64g.jpg

 

Have I done something wrong?



#2 ZoriaRPG

ZoriaRPG

    ZC Contributor & Wiki Editor

  • Members
  • Gender:Unspecified
  • Location:Prydon Academy

Posted 18 September 2017 - 07:23 AM

I know I keep asking things, but I have another issue.
 
I have made a setup where I have an invisible, intangible (with ZoriaRPG's script from my previous topic) wizzrobe which spawns an enemy (essentially a bat wizzrobe), but it isn't spawning anything. I've set everything up as follows (with the graphic only there to show me the enemy when testing):
i1n3h87yk0fwpd64g.jpg
 
Have I done something wrong?



Does it only fail to spawn when using my script? I noticed that I had forgotten to add Waitframes(5) to the start of the script.

You can try this, instead:
 
ffc script IgnoreNPC{
    void run (int npc_id){
        Waitframes(5);
        while(true){
            for ( int q = Screen->NumNPCs(); q > 0; q-- ) {
                npc n = Screen->LoadNPC(q);
                if ( n->ID == npc_id ) {
                    n->CollDetection = false;
                    continue;
                }
            }
            Waitframe();
        }
    }
}
Make sure that your spawn flag is not on a solid combo, as well.

Edited by ZoriaRPG, 18 September 2017 - 07:25 AM.


#3 klop422

klop422

    Evil Crazy Mastermind

  • Members
  • Real Name:Not Valentino
  • Gender:Male
  • Location:Planet Earth

Posted 18 September 2017 - 11:50 AM

Oh, no, it wasn't working before I added the script.



#4 ZoriaRPG

ZoriaRPG

    ZC Contributor & Wiki Editor

  • Members
  • Gender:Unspecified
  • Location:Prydon Academy

Posted 22 September 2017 - 02:19 AM

Oh, no, it wasn't working before I added the script.


Sorry, I missed this one, earlier: Wizzrobes summon based on their random rate and their halt rate. If you want them to summon, they cannot have a random and halt of 0. Use the defaults, and set their step to 0, and it should work.m If that fails to work, then they may also need a step of at least 1.
 
If you want, i can just code a summoning ffc for you. That is probably better than this, given that you are using an ffc just to make them intangible.

This is untested, but barring minor typos, it should work:
 
//////////////////////////////////
/// Timed Summoning Square FFC ///
/// v0.1                       ///
/// By: ZoriaRPG               ///
/// 22nd Sept, 2017            ///
//////////////////////////////////

//Settings

//Sound to play when summoning. Happens once per summon, not once per enemy.
//Can be overridden in the ffc InitD[]
const int FFC_SUMMONER_SUMMON_SFX = 56;

//Distance to randomise spawn points from the CENTRE X/Y of the ffc. 
const int FFC_SUMMONER_SUMMON_WAVER_X_MIN = -24;
const int FFC_SUMMONER_SUMMON_WAVER_X_MAX = 24;
const int FFC_SUMMONER_SUMMON_WAVER_Y_MIN = -24;
const int FFC_SUMMONER_SUMMON_WAVER_Y_MAX = 24;

ffc script SummonerSpace{
	void run(int summon_npc, int min_number, int max_number, int min_time, int max_time, int cap, int summon_sfx){
		//D0: NPC to summon
		//D1: minimum number to generate on summoning. Must be a positive value.
		//D2: Max number of npxs to spwan on a single summon
		//D3: Minimum time (in seconds_ between summons.
		//D4: maximum time (in seconds, between summons)
		//D5: If there are this many npcs on the screen, stop summoning.
		//D6: Sound to play. If set to 0, the default will play.
		
		npc n; 
		int q[3];
		//0 loop
		//1 num of npcs to spawn this cycle
		//2 timer
		q[2] = Rand(min_time, max_time) * 60;
		while(true){
			while(q[2]--) { Waitframe(); }
			
			q[2] = Rand(min_time, max_time) * 60; //Set the timer, based in seconds. 
			q[1] = Abs(Rand(min_number, max_number)); //Determine how many npcs will spawn.
			
			//An option to stop flooding the screen with summons after there are 'cap' number of npcs 
			//on the screen:
			if ( cap > 0 ){
				if ( Screen->NumNPCs() >= cap ) { continue; }
			}
			
			//Play the summon sound with my usual sanity checks. 
			if ( summon_sfx > 0 && summon_sfx < 256 ) { Game->PlaySound(summon_sfx); }
			else {
				if ( FFC_SUMMONER_SUMMON_SFX > 0 ) { Game->PlaySound(FFC_SUMMONER_SUMMON_SFX); }
			}
			//Spawn the npcs. 
			for ( q[0] = 0; q[0] < q[1]; q[0]++ ) {
				n = Screen->CreateNPC(summon_npc);
				//Randomise their spawn locations a bit. 
				n->X = this->X + ( this->TileWidth * 8 ) + Rand(FFC_SUMMONER_SUMMON_WAVER_X_MIN, FFC_SUMMONER_SUMMON_WAVER_X_MAX);
				n->Y = this->Y + ( this->TileHeight * 8 ) + Rand(FFC_SUMMONER_SUMMON_WAVER_Y_MIN, FFC_SUMMONER_SUMMON_WAVER_Y_MAX);
			}
			Waitframe();
		}
	}
}

Edited by ZoriaRPG, 22 September 2017 - 02:45 AM.



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users