Thread: how to let more than one slayer npc be killed for a task?

Results 1 to 3 of 3
  1. #1 how to let more than one slayer npc be killed for a task? 
    Perplexity owner

    Join Date
    Feb 2011
    Posts
    171
    Thanks given
    32
    Thanks received
    15
    Rep Power
    0
    I am trying to make it so that more than one npc can count towards a slayer task

    I tried this with no luck, not quite sure how I would go about it

    Code:
    	DRYGORE_GODS(SlayerMaster.DURADEL, 550, "Drygore gods can be found in the Drygore Gods Teleport.", 12120, new Position(2505, 2500)
    			||SlayerMaster.DURADEL, 510, "Drygore gods can be found in the Drygore Gods Teleport.", 12120, new Position(2505, 2500),

    Here is my full slayer tasks class




    Code:
    package com.ImpunityX.world.content.skill.impl.slayer;
    
    import com.ImpunityX.model.Position;
    import com.ImpunityX.util.Misc;
    
    /**
     * @author Gabriel Hannason
     */
    
    public enum SlayerTasks {
    
    	NO_TASK(null, -1, null, -1, null),
    
    	/**
    	 * Easy tasks
    	 */
    	CRYSTAL_SPIDER(SlayerMaster.VANNAKA, 898, "Can be found at Key zone.", 5000,
    			new Position(2134, 4926)), CRYSTAL_WOLF(SlayerMaster.VANNAKA, 900,
    			"Can be found at the Key zone.", 5000,
    			new Position(2134, 4926)), 
    	Purgatory(SlayerMaster.VANNAKA, 510, 
    			"Purgatory's can be found in the Training Island Teleport.", 7500, new Position(2524, 4776)),
    
    	FIRE_DRACONIAN_RANGER(SlayerMaster.VANNAKA, 1200, "Can be found at Draconian Teleport", 500, new Position(2387,4961)),
    	FIRE_DRACONIAN_MAGE(SlayerMaster.VANNAKA, 1201, "Can be found at Draconian Teleport", 500, new Position(2387,4961)),
    
    	/**
    	 * Medium tasks
    	 */
    	DRYGORE_GODS(SlayerMaster.DURADEL, 550, "Drygore gods can be found in the Drygore Gods Teleport.", 12120, new Position(2505, 2500)
    			||SlayerMaster.DURADEL, 510, "Drygore gods can be found in the Drygore Gods Teleport.", 12120, new Position(2505, 2500),
    	DAGGANOTH_SLAYER(SlayerMaster.DURADEL, 1100, "DagganothSlayers can be found in the DagganothSlayer Teleport.", 12120,
    			new Position(2505, 4724)),
    	ICE_DRACONIAN_RANGER(SlayerMaster.DURADEL, 1202, "Can be found at Draconian Teleport", 500, new Position(2387,4961)),
    	ICE_DRACONIAN_MAGE(SlayerMaster.DURADEL, 1203, "Can be found at Draconian Teleport", 500, new Position(2387,4961)),
    
    
    	/**
    	 * Hard tasks
    	 */
    	TOXIC_DRACONIAN_RANGER(SlayerMaster.KURADEL, 1204, "Can be found at Draconian Teleport", 500, new Position(2387,4961)),
    	TOXIC_DRACONIAN_MAGE(SlayerMaster.KURADEL, 1206, "Can be found at Draconian Teleport", 500, new Position(2387,4961)),
    
    	ANOUKE(SlayerMaster.KURADEL, 1101, "Anouke's can be found in the Anouke's Teleport.", 20000,
    			new Position(2505, 2500)),
    	/**
    	 * Elite
    	 */
    
    	SHADOW_CORP(SlayerMaster.SUMONA, 8133, "The Shadow Corporeal Beast can be found at the Shadow Corp Teleport.",50000,new Position(2832, 2829)),
    	ICHIGO(SlayerMaster.SUMONA, 666, "Ichigo can be found at the Ichigo Teleport.",50000,new Position(2832, 2829)),
    	Zangetsu(SlayerMaster.SUMONA, 669, "Zangetsu Can be found at the Zangetsu Teleport.",50000,new Position(2023, 4660));
    
    //	CAMO_TORVA(SlayerMaster.KURADEL, 515, "Camo Torva Bosses can be found in the Camo Torva Boss Teleport.", 39500,
    //			new Position(2540, 5785)), WINTER_CAMO_TORVA(SlayerMaster.KURADEL, 517,
    //					"Winter Camo Torva Bosses can be found in the Winter Camo Torva Boss Teleport.", 44500,
    //					new Position(2792, 3796)), BLOODSHOT_CAMO_TORVA(SlayerMaster.KURADEL, 518,
    //							"Bloodshot Camo Torva Bosses can be found in the Bloodshot Camo Torva Boss Teleport.",
    //							49500, new Position(3236, 3941)),
    //
    //	CAMO__TORVA(SlayerMaster.SUMONA, 515, "Camo Torva Bosses can be found in the Camo Torva Boss Teleport.", 39500,
    //			new Position(2540, 5785)), WINTER__CAMO_TORVA(SlayerMaster.SUMONA, 517,
    //					"Winter Camo Torva Bosses can be found in the Winter Camo Torva Boss Teleport.", 44500,
    //					new Position(2792, 3796)), BLOODSHOT__CAMO_TORVA(SlayerMaster.SUMONA, 518,
    //							"Bloodshot Camo Torva Bosses can be found in the Bloodshot Camo Torva Boss Teleport.",
    //							49500, new Position(3236, 3941));
    
    	;
    	/*
    	 * @param taskMaster
    	 *
    	 * @param npcId
    	 *
    	 * @param npcLocation
    	 *
    	 * @param XP
    	 *
    	 * @param taskPosition
    	 */
    
    	public static SlayerTasks forId(int id) {
    		for (SlayerTasks tasks : SlayerTasks.values()) {
    			if (tasks.ordinal() == id) {
    				return tasks;
    			}
    		}
    		return null;
    	}
    
    	public static int[] getNewTaskData(SlayerMaster master) {
    		int slayerTaskId = 1, slayerTaskAmount = 20;
    		int easyTasks = 0, mediumTasks = 0, hardTasks = 0, eliteTasks = 0;
    
    		/*
    		 * Calculating amount of tasks
    		 */
    		for (SlayerTasks task : SlayerTasks.values()) {
    			if (task.getTaskMaster() == SlayerMaster.VANNAKA)
    				easyTasks++;
    			else if (task.getTaskMaster() == SlayerMaster.DURADEL)
    				mediumTasks++;
    			else if (task.getTaskMaster() == SlayerMaster.KURADEL)
    				hardTasks++;
    			else if (task.getTaskMaster() == SlayerMaster.SUMONA)
    				eliteTasks++;
    		}
    
    		/*
    		 * Getting a task
    		 */
    		if (master == SlayerMaster.VANNAKA) {
    			slayerTaskId = 1 + Misc.getRandom(easyTasks);
    			if (slayerTaskId > easyTasks)
    				slayerTaskId = easyTasks;
    			slayerTaskAmount = 15 + Misc.getRandom(15);
    		} else if (master == SlayerMaster.DURADEL) {
    			slayerTaskId = easyTasks - 1 + Misc.getRandom(mediumTasks);
    			slayerTaskAmount = 12 + Misc.getRandom(13);
    		} else if (master == SlayerMaster.KURADEL) {
    			slayerTaskId = 1 + easyTasks + mediumTasks + Misc.getRandom(hardTasks - 1);
    			slayerTaskAmount = 10 + Misc.getRandom(15);
    		} else if (master == SlayerMaster.SUMONA) {
    			slayerTaskId = 1 + easyTasks + mediumTasks + hardTasks + Misc.getRandom(eliteTasks - 1);
    			slayerTaskAmount = 2 + Misc.getRandom(7);
    		}
    		return new int[] { slayerTaskId, slayerTaskAmount };
    	}
    
    	private SlayerMaster taskMaster;
    	private int npcId;
    	private String npcLocation;
    	private int XP;
    
    	private Position taskPosition;
    
    	private SlayerTasks(SlayerMaster taskMaster, int npcId, String npcLocation, int XP, Position taskPosition) {
    		this.taskMaster = taskMaster;
    		this.npcId = npcId;
    		this.npcLocation = npcLocation;
    		this.XP = XP;
    		this.taskPosition = taskPosition;
    	}
    
    	public int getNpcId() {
    		return this.npcId;
    	}
    
    	public String getNpcLocation() {
    		return this.npcLocation;
    	}
    
    	public SlayerMaster getTaskMaster() {
    		return this.taskMaster;
    	}
    
    	public Position getTaskPosition() {
    		return this.taskPosition;
    	}
    
    	public int getXP() {
    		return this.XP;
    	}
    }
    Reply With Quote  
     

  2. #2  
    Community Veteran


    Arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,950
    Thanks given
    210
    Thanks received
    349
    Rep Power
    1376
    There is a few ways you can do it. You can either do it npcid array in your enum and then loop it or have it based of npc name.


    "A fail act is something you do regular, but a dumb act is something you can learn from"
    Spoiler for Problem?:
    Reply With Quote  
     

  3. #3  
    Extreme Donator


    Join Date
    Mar 2009
    Age
    29
    Posts
    956
    Thanks given
    29
    Thanks received
    15
    Rep Power
    215
    Probably the best way to do it is by loading up all possible ids for a particular slayer monster and store it as an enum probably such as...

    Code:
    public enum SlayerMonster {
        CHICKEN(0, 1, 3),
        COW(2, 5);
    
        private HashSet<Integer> monsters;
    
        SlayerMonster(Integer... id) {
            monsters = new HashSet<>(Arrays.asList(ids));
        }
    
        public boolean contains(Integer id) {
            return monsters.contains(id);
        }
    }
    And instead of having the Integer id of the monster in SlayerTask you would have SlayerMonster type and whenever checking if it's a valid monster just use SlayerMonster.contains(). You'll probably will need to add some more methods to fully add it but that would honestly be the best way as it only adds overhead on startup. Just make sure to use a HashSet to keep the lookup at constant time instead of using a List (which would make it linear look up).
    Quote Originally Posted by Note
    Why do you quote yourself?
    Reply With Quote  
     


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. How to add more than one reward for voting
    By Ace Hood in forum Help
    Replies: 5
    Last Post: 10-04-2013, 02:19 AM
  2. How to make more than 1 XAMPP sites (Changes port)
    By Nintendo DSi XL in forum Website Development
    Replies: 6
    Last Post: 06-04-2011, 12:40 AM
  3. How To Load More Than 9999 Items in your item.cfg
    By Golden Hero in forum Requests
    Replies: 2
    Last Post: 02-13-2011, 02:25 AM
  4. Replies: 2
    Last Post: 02-03-2011, 10:28 PM
  5. Replies: 1
    Last Post: 11-14-2009, 12:31 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •