Thread: [pi] fight caves wave spawning

Page 1 of 2 12 LastLast
Results 1 to 10 of 17
  1. #1 [pi] fight caves wave spawning 
    Registered Member
    Karma_K's Avatar
    Join Date
    Nov 2012
    Posts
    4,283
    Thanks given
    152
    Thanks received
    610
    Rep Power
    108
    alright, i've had this issue for quite sometime and never figured out what was causing the problem. the fight caves minigames or just about any wave based minigames are malfunctioning. they'll get to a point where theyll just keep spawning the same waves over and over so there'll be like constant spawns of the wave.

    Example:



    4 fighters were spawned and then it just kept spawning more and more even though the waves werent finished

    Code:
    package server.minigames.barbarianassault;
    
    import server.model.players.Client;
    import server.Server;
    
    public class BarbarianAssault {
    
    	private final int[][] WAVES = {{5219,5237},{5219,5237,5219,5237},{5219,5237,5219,5237,5219,5237},{5219,5237,5219,5237,5219,5237,5219,5237},{5219,5237,5219,5237,5219,5237,5219,5237,5219,5237},{5219,5237,5219,5237,5219,5237,5247}};
    	private int[][] coordinates = {{3161,9756},{3161,9760},{3163,9756},{3163,9760},{3161,9758}};
    
    	public void spawnNextWave(Client c) {
    		if (c != null) {
    			if (c.waveId >= WAVES.length) {
    				c.waveId = 0;
    				return;				
    			}
    			if (c.waveId < 0){
    				return;
    			}
    			int npcAmount = WAVES[c.waveId].length;
    			for (int j = 0; j < npcAmount; j++) {
    				int npc = WAVES[c.waveId][j];
    				int X = coordinates[j][0];
    				int Y = coordinates[j][1];
    				int H = c.heightLevel;
    				int hp = getHp(npc);
    				int max = getMax(npc);
    				int atk = getAtk(npc);
    				int def = getDef(npc);
    				Server.npcHandler.spawnNpc(c, npc, X, Y, H, 0, hp, max, atk, def, true, false);				
    			}
    			c.barbarianToKill = npcAmount;
    			c.barbarianKilled = 0;
    		}
    	}
    
    	public int getHp(int npc) {
    		switch (npc) {
    		case 677:
    			return 200;
    		case 667:
    			return 300;
    		case 3064:
    			return 200;
    		case 934: 
    			return 300;
    		case 1472:
    			return 350;	
    		}
    		return 100;
    	}
    
    	public int getMax(int npc) {
    		switch (npc) {		
    		}
    		return 5;
    	}
    
    	public int getAtk(int npc) {
    		switch (npc) {	
    		}
    		return 100;
    	}
    
    	public int getDef(int npc) {
    		switch (npc) {		
    		}
    		return 100;
    	}
    }
    Reply With Quote  
     

  2. #2  
    Registered Member Willixel+'s Avatar
    Join Date
    Oct 2012
    Age
    28
    Posts
    99
    Thanks given
    4
    Thanks received
    0
    Rep Power
    11
    Look into problems with the spawnNextWave method. I couldn't tell you definitively what the problem is, but it seems like there's supposed to be a check for wave completion, else this would happen.
    Reply With Quote  
     

  3. #3  
    Donator

    Arithium's Avatar
    Join Date
    May 2010
    Age
    31
    Posts
    4,721
    Thanks given
    199
    Thanks received
    1,256
    Rep Power
    1114
    You only need to spawn the next wave when you've successfully killed the amount required to start the next wave. So find out where your starting the next wave.
    Reply With Quote  
     

  4. #4  
    Registered Member
    Karma_K's Avatar
    Join Date
    Nov 2012
    Posts
    4,283
    Thanks given
    152
    Thanks received
    610
    Rep Power
    108
    Quote Originally Posted by Arithium View Post
    You only need to spawn the next wave when you've successfully killed the amount required to start the next wave. So find out where your starting the next wave.
    all i pretty much did was copy and pasted everything that involved rfd or fight caves into making this minigame and changed the coordinates and waves. it seems that my rfd minigame is functioning fine, but the fight caves isnt and this "barbarian assault" contribute.
    Reply With Quote  
     

  5. #5  
    Registered Member
    Karma_K's Avatar
    Join Date
    Nov 2012
    Posts
    4,283
    Thanks given
    152
    Thanks received
    610
    Rep Power
    108
    bump.
    Reply With Quote  
     

  6. #6  
    Registered Member
    Karma_K's Avatar
    Join Date
    Nov 2012
    Posts
    4,283
    Thanks given
    152
    Thanks received
    610
    Rep Power
    108
    Bump.
    Reply With Quote  
     

  7. #7  
    Registered Member
    Karma_K's Avatar
    Join Date
    Nov 2012
    Posts
    4,283
    Thanks given
    152
    Thanks received
    610
    Rep Power
    108
    Bump.
    Reply With Quote  
     

  8. #8  
    Registered Member
    Karma_K's Avatar
    Join Date
    Nov 2012
    Posts
    4,283
    Thanks given
    152
    Thanks received
    610
    Rep Power
    108
    bump.
    Reply With Quote  
     

  9. #9  
    Registered Member
    Karma_K's Avatar
    Join Date
    Nov 2012
    Posts
    4,283
    Thanks given
    152
    Thanks received
    610
    Rep Power
    108
    Bump.
    Reply With Quote  
     

  10. #10  
    Registered Member
    Karma_K's Avatar
    Join Date
    Nov 2012
    Posts
    4,283
    Thanks given
    152
    Thanks received
    610
    Rep Power
    108
    Bump.
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [PI] Fight Cave - Npc Doesnt Spawn
    By jack351 in forum Help
    Replies: 0
    Last Post: 05-28-2012, 08:44 AM
  2. [PI] Fight Caves - One Wave
    By Mikey` in forum Snippets
    Replies: 10
    Last Post: 08-28-2011, 09:43 PM
  3. [PI] all the fight cave waves please!
    By Radiation in forum Help
    Replies: 2
    Last Post: 06-06-2011, 01:17 PM
  4. [PI] Making Fight Cave Waves JUST JAD
    By Moronic in forum Snippets
    Replies: 2
    Last Post: 11-27-2010, 06:37 PM
  5. [PI]Fight Caves - Spawning Next Wave
    By Dylannnnn in forum Help
    Replies: 6
    Last Post: 11-25-2010, 07:09 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •