Thread: slayer task reset with item

Results 1 to 5 of 5
  1. #1 slayer task reset with item 
    Registered Member Bubz's Avatar
    Join Date
    Oct 2008
    Posts
    159
    Thanks given
    4
    Thanks received
    6
    Rep Power
    1
    hello i was curious if anyone had a code for slayer task reset using an item. i'd like to add something that resets tasks for free for people who have this item.

    ive tried to come up with a code but it just says your task is null when u try n reset it.

    here's the code

    Code:
    
    			case 4283:
    				String task = null;
    
    
    				SlayerDifficulty current = null;
    				
    				if (!player.getSlayer().hasTask()) {
    					DialogueManager.sendStatement(player, new String[] { "A slayer task is required to reset it!" });
    					return;
    				} else {
    					player.getSlayer().reset();
    					SlayerTasks.MediumLevel[] mval = SlayerTasks.MediumLevel.values();
    
    					SlayerTasks.MediumLevel set2 = mval[Utility.randomNumber(mval.length)];
    
    					while (player.getMaxLevels()[18] < set2.lvl) {
    						set2 = mval[Utility.randomNumber(mval.length)];
    					}
    
    				   task = set2.name;
    
    					SlayerDifficulty set = SlayerDifficulty.MEDIUM;
    					String task1 = player.getSlayer().getTask();
    					byte am = player.getSlayer().getAmount();
    					DialogueManager.sendNpcChat(player, 403, Emotion.CALM, new String[] { "You have been assigned the task of killing:", "@[email protected]" + am + " " + task1, });
    					return;
    				}
    Reply With Quote  
     

  2. #2  
    Registered Member
    arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,451
    Thanks given
    150
    Thanks received
    193
    Rep Power
    345
    Well you are resetting the task before you even checking if you got the item or not.
    Also task and current variables are set to null.


    "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  
    Registered Member Bubz's Avatar
    Join Date
    Oct 2008
    Posts
    159
    Thanks given
    4
    Thanks received
    6
    Rep Power
    1
    okay so what would i change it to?
    Reply With Quote  
     

  4. #4  
    Registered Member Juri's Avatar
    Join Date
    Dec 2018
    Posts
    23
    Thanks given
    4
    Thanks received
    4
    Rep Power
    38
    Can't you make the String task = to the actual current task?
    Code:
        String task = player.getSlayer().getTask();
    Reply With Quote  
     

  5. #5  
    Registered Member
    arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,451
    Thanks given
    150
    Thanks received
    193
    Rep Power
    345
    Quote Originally Posted by Bubz View Post
    okay so what would i change it to?
    It all comes down to how you have slayer coded but it would go something like you already done:
    Code:
    			case 4283:
    				String task = null; //This is never used
    
    
    				SlayerDifficulty current = null; //This is never used
    				
    				if (!player.getSlayer().hasTask()) {
    					DialogueManager.sendStatement(player, new String[] { "A slayer task is required to reset it!" });
    					return;
    				} else {
    					player.getSlayer().reset();
    //Code here to give back the task if you want this!
    }
    
    					SlayerTasks.MediumLevel[] mval = SlayerTasks.MediumLevel.values();
    
    					SlayerTasks.MediumLevel set2 = mval[Utility.randomNumber(mval.length)];
    
    					while (player.getMaxLevels()[18] < set2.lvl) {
    						set2 = mval[Utility.randomNumber(mval.length)];
    					}
    				   task = set2.name;
    
    					SlayerDifficulty set = SlayerDifficulty.MEDIUM;
    					String task1 = player.getSlayer().getTask();
    					byte am = player.getSlayer().getAmount();
    					DialogueManager.sendNpcChat(player, 403, Emotion.CALM, new String[] { "You have been assigned the task of killing:", "@[email protected]" + am + " " + task1, });
    					return;
    				}
    Code above in red is not needed / are in a place where they can cause issues.


    "A fail act is something you do regular, but a dumb act is something you can learn from"
    Spoiler for Problem?:
    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. [PI] Reset Slayer Task
    By Stoked in forum Help
    Replies: 2
    Last Post: 09-29-2012, 06:54 PM
  2. Adding an Npc To reset Slayer Task! PI
    By Red Bull in forum Tutorials
    Replies: 12
    Last Post: 08-11-2012, 01:30 AM
  3. [req help]reset slayer task help
    By blayke in forum Help
    Replies: 3
    Last Post: 07-06-2012, 02:29 AM
  4. Help with Special Slayer Tasks
    By Sabbath in forum Help
    Replies: 1
    Last Post: 02-24-2010, 10:49 PM
  5. Reset Slayer Task Command
    By Xuzk in forum Tutorials
    Replies: 11
    Last Post: 11-10-2009, 05:30 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
  •