Thread: Help with custom xp at higher levels

Results 1 to 3 of 3
  1. #1 Help with custom xp at higher levels 
    Registered Member
    Join Date
    Jan 2015
    Posts
    35
    Thanks given
    7
    Thanks received
    0
    Rep Power
    11
    Hi,Basically im making a custom dung, i have made 3 xp amounts at set levels 1 , 80 ,100 levels 1 -80 work fine!!
    when i obtain level 100 it gives me the level 80 xp amount and level 100 amount basically 2 xp amounts and tokens
    i believe it would be somthing to do with the "<" ">" but how would i change it to work,
    thanks!







    Code:
     	}
    	 
    	public void handlePointsNPCs() {
            Player killer = getMostDamageReceivedSourcePlayer();
            switch (id) {
            case 10537:
            	if  (killer.getSkills().getLevel(Skills.DUNGEONEERING) > 1) {
            	} else {
            		killer.getSkills().addXp(24, 320);
        		killer.setDungPoints(killer.getDungPoints() + 1600); //amount of points given
              	 killer.getPackets().sendGameMessage("<col=434343>You killed an Forgotten Meleer and received 1600 Dungeoneering Points!");
            }
            	if (killer.getSkills().getLevel(Skills.DUNGEONEERING)  < 100 ) {
            		} else {
            		killer.getSkills().addXp(24, 1280);
            	 killer.setDungPoints(killer.getDungPoints() + 7200); //amount of points given
               	 killer.getPackets().sendGameMessage("<col=434343>You killed an Forgotten Meleer and received 7200 Dungeoneering Points!");
            		}
            	if (killer.getSkills().getLevel(Skills.DUNGEONEERING) < 80) {
            	} else {
            		killer.getSkills().addXp(24, 640);
            		killer.setDungPoints(killer.getDungPoints() + 3200); //amount of points given
                  	 killer.getPackets().sendGameMessage("<col=434343>You killed an Forgotten Meleer and received 3200 Dungeoneering Points!");
            		
            	}
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Jan 2014
    Posts
    376
    Thanks given
    49
    Thanks received
    111
    Rep Power
    106
    This is probably the easiest way:
    Code:
    if (killer.getSkills().getLevel(Skills.DUNGEONEERING) >= 100 ) {
    	killer.getSkills().addXp(24, 1280);
        killer.setDungPoints(killer.getDungPoints() + 7200); //amount of points given
       	killer.getPackets().sendGameMessage("<col=434343>You killed an Forgotten Meleer and received 7200 Dungeoneering Points!");
    } else if (killer.getSkills().getLevel(Skills.DUNGEONEERING) >= 80) {
    	killer.getSkills().addXp(24, 640);
        killer.setDungPoints(killer.getDungPoints() + 3200); //amount of points given
        killer.getPackets().sendGameMessage("<col=434343>You killed an Forgotten Meleer and received 3200 Dungeoneering Points!"); 		
    } else {
    	killer.getSkills().addXp(24, 320);
        killer.setDungPoints(killer.getDungPoints() + 1600); //amount of points given
        killer.getPackets().sendGameMessage("<col=434343>You killed an Forgotten Meleer and received 1600 Dungeoneering Points!");
    }
    You have to check the highest level first, then use an "else if" statement for the next highest, and so on until you get an "else" for the lowest level. If you check it the other way around, it will always trigger the first conditional (since, for example, 101 is greater than 1, 80, and 100).
    Also, you should avoid empty "if" blocks, like you have in the example. If you have an empty block like that followed by an "else", you should just reverse the condition in the "if" statement.
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Registered Member
    Join Date
    Jan 2015
    Posts
    35
    Thanks given
    7
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Sundays211 View Post
    This is probably the easiest way:
    Code:
    if (killer.getSkills().getLevel(Skills.DUNGEONEERING) >= 100 ) {
    	killer.getSkills().addXp(24, 1280);
        killer.setDungPoints(killer.getDungPoints() + 7200); //amount of points given
       	killer.getPackets().sendGameMessage("<col=434343>You killed an Forgotten Meleer and received 7200 Dungeoneering Points!");
    } else if (killer.getSkills().getLevel(Skills.DUNGEONEERING) >= 80) {
    	killer.getSkills().addXp(24, 640);
        killer.setDungPoints(killer.getDungPoints() + 3200); //amount of points given
        killer.getPackets().sendGameMessage("<col=434343>You killed an Forgotten Meleer and received 3200 Dungeoneering Points!"); 		
    } else {
    	killer.getSkills().addXp(24, 320);
        killer.setDungPoints(killer.getDungPoints() + 1600); //amount of points given
        killer.getPackets().sendGameMessage("<col=434343>You killed an Forgotten Meleer and received 1600 Dungeoneering Points!");
    }
    You have to check the highest level first, then use an "else if" statement for the next highest, and so on until you get an "else" for the lowest level. If you check it the other way around, it will always trigger the first conditional (since, for example, 101 is greater than 1, 80, and 100).
    Also, you should avoid empty "if" blocks, like you have in the example. If you have an empty block like that followed by an "else", you should just reverse the condition in the "if" statement.
    Thanks alot buddy!!!!! #1
    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. Please help with Custom Model
    By linkcg0 in forum Help
    Replies: 0
    Last Post: 05-02-2009, 02:25 AM
  2. help with custom models in hd client.
    By hackerboy in forum Help
    Replies: 1
    Last Post: 04-14-2009, 12:39 PM
  3. Need help with custom world switching.
    By Ecstasy in forum Help
    Replies: 1
    Last Post: 12-03-2008, 02:24 AM
  4. Need help with customs....
    By mudvayne5493 in forum Help
    Replies: 2
    Last Post: 10-20-2008, 09:38 PM
  5. help with custom item
    By Tariq in forum Requests
    Replies: 2
    Last Post: 09-21-2008, 09:11 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
  •