Thread: Spawning Similar NPC's in different locations

Results 1 to 5 of 5
  1. #1 Spawning Similar NPC's in different locations 
    Registered Member
    Join Date
    Apr 2011
    Posts
    159
    Thanks given
    5
    Thanks received
    15
    Rep Power
    23
    Hi,

    I am currently trying to get the triple Jad wave of the Inferno working. I am trying to figure out how to spawn the 3 different Jads in separate locations, because right now they just spawn on top of one another. To try to avoid this, I have done a few things that have not worked yet.

    In the InfernoWaves file this is the code that is being used for Jad

    Code:
    	public static final int
    	JALTOK_JAD = 7700;
    Code:
    	public enum InfernoData{
    		WAVE_1(new short[]{JALTOK_JAD, JALTOK_JAD, JALTOK_JAD});
    
    		private short[] npcs;
    
    		InfernoData(short[] npcs) {
    			this.npcs = npcs;
    		}
    
    		public short[] getNpcs() {
    			return npcs;
    		}
    
    		public int toInteger() {
    			return ordinal();
    		}
    
    }
    The code above is just defining what Jad is with his npc id, and then placing him in the queue to spawn when wave 1 starts.

    In the Inferno file, in order to spawn the Jad's in different locations, I have added some conditional statements in so they don't spawn in the same location

    Code:
    				for (short i : InfernoWave.InfernoData.values()[player.getInfernoDetails().getStage()].getNpcs()) {
    					int startX = 2271 + Utility.random(12); // InfernoWave.SPAWN_DATA[index][0]
    					int startY = 5342 + Utility.random(12); // InfernoWave.SPAWN_DATA[index][1]
    					if(i == InfernoWave.JALTOK_JAD) {
    						startX = 2267;
    						startY = 5348;
    					}
    					if(i == InfernoWave.JALTOK_JAD) {
    						startX = 2276;
    						startY = 5343;
    					}
    					if(i == InfernoWave.JALTOK_JAD) {
    						startX = 2266;
    						startY = 5337;
    					}

    So, obviously right now this is not going to work because the variable i is set to JALTOK_JAD in three different conditional statements. But I am not sure what I can change about the conditional statements in order to spawn the jads in different locations. I have thought about indexing through the short[] WAVE_1 and spawning each index in a different location, but I do not know how to do that.

    If my idea of indexing through the WAVE_1 array would work, can anyone help me figure out how to do that?
    Reply With Quote  
     

  2. #2  
    The One And Only

    01053's Avatar
    Join Date
    Apr 2011
    Age
    24
    Posts
    2,875
    Thanks given
    414
    Thanks received
    871
    Rep Power
    856
    Personally I'd store the position of the Jad within the enum as well.


    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Apr 2011
    Posts
    159
    Thanks given
    5
    Thanks received
    15
    Rep Power
    23
    Quote Originally Posted by 01053 View Post
    Personally I'd store the position of the Jad within the enum as well.
    How could I spawn each jad at a different location based on their index in the WAVE_# array?
    Reply With Quote  
     

  4. #4  
    The One And Only

    01053's Avatar
    Join Date
    Apr 2011
    Age
    24
    Posts
    2,875
    Thanks given
    414
    Thanks received
    871
    Rep Power
    856
    Quote Originally Posted by b00mz1029 View Post
    How could I spawn each jad at a different location based on their index in the WAVE_# array?
    Use a 2d array that stores the npc and the npcs spawn location.


    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Apr 2011
    Posts
    159
    Thanks given
    5
    Thanks received
    15
    Rep Power
    23
    Quote Originally Posted by 01053 View Post
    Use a 2d array that stores the npc and the npcs spawn location.
    Thanks, got it working
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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

Similar Threads

  1. [Unable To Spawn/Add NPC's in game.
    By malimt in forum Help
    Replies: 2
    Last Post: 03-22-2016, 02:55 PM
  2. Spawning NPC's in Apollo?
    By Aleka in forum Help
    Replies: 6
    Last Post: 11-15-2014, 10:13 PM
  3. Replies: 2
    Last Post: 10-28-2014, 09:17 AM
  4. Replies: 5
    Last Post: 08-24-2013, 04:24 PM
  5. Replies: 2
    Last Post: 06-27-2011, 11:02 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
  •