Thread: XP divide and times it PI

Results 1 to 7 of 7
  1. #1 XP divide and times it PI 
    Donator

    Join Date
    Jun 2012
    Posts
    637
    Thanks given
    129
    Thanks received
    87
    Rep Power
    57
    Hey, been stuck on this really dont know how i would begein with this, so for an example if i want an npc that not resets your stats but does: currentxp / 100
    How could i do this?
    Reply With Quote  
     

  2. #2  
    Banned

    Join Date
    Dec 2011
    Posts
    967
    Thanks given
    234
    Thanks received
    208
    Rep Power
    0
    I believe you already have XP modifiers in Config.java, so you could simply modify them based on some variable

    E.G.

    Code:
    public final static int ATTACK_XP = booleanValue ? 150 : 1500;
    Or you could just do something like

    Code:
    public int xpModifier = 1; //can be changed when they reset stats or whatever, e.g. to .001 or 10
    Code:
    public static final int ATTACK_XP = 1500*xpModifier;
    Reply With Quote  
     

  3. #3  
    Donator
    Mr Extremez's Avatar
    Join Date
    Jun 2012
    Posts
    2,243
    Thanks given
    97
    Thanks received
    298
    Rep Power
    61
    I think this is what you wanted, but I'm not sure. Just tested this and it doesn't work, check my newest post for a version that works.

    Playerassistant:

    Code:
    public int changeSkillXp(int skill, int amount, boolean divide) {	
    		int doAmount;
    		if (divide) {
    			doAmount = getLevelForXP(client.playerXP[skill]) / amount;
    			refreshSkill(skill);
    		} else {
    			doAmount = getLevelForXP(client.playerXP[skill]) * amount;
    			refreshSkill(skill);
    		}
    		return doAmount;
    	}
    Usage:

    Code:
    changeSkillXp(skillId, amountToReduce, set to true if you want it divide the exp set to false if you want it to multiply the xp);
    Add my new Skype: live:extremezgp

    Discord: Mr Extremez#3049

    Reply With Quote  
     

  4. Thankful user:


  5. #4  
    Donator

    Join Date
    Jun 2012
    Posts
    637
    Thanks given
    129
    Thanks received
    87
    Rep Power
    57
    Quote Originally Posted by I'm A Boss View Post
    I think this is what you wanted, but I'm not sure.

    Playerassistant:

    Code:
    public int changeSkillXp(int skill, int amount, boolean divide) {	
    		int doAmount;
    		if (divide) {
    			doAmount = getLevelForXP(client.playerXP[skill]) / amount;
    			refreshSkill(skill);
    		} else {
    			doAmount = getLevelForXP(client.playerXP[skill]) * amount;
    			refreshSkill(skill);
    		}
    		return doAmount;
    	}
    Usage:

    Code:
    changeSkillXp(skillId, amountToReduce, set to true if you want it divide the exp set to false if you want it to multiply the xp);
    Thank you, although im not sure what im doing wrong but it isnt working
    Code:
    	
    	public int changeSkillXp(int skill, int amount, boolean divide) {	
    		int doAmount;
    		if (divide) {
    			doAmount = getLevelForXP(c.playerXP[skill]) / amount;
    			refreshSkill(skill);
    		} else {
    			doAmount = getLevelForXP(c.playerXP[skill]) * amount;
    			refreshSkill(skill);
    		}
    		return doAmount;
    	}
    
    
    
    (in a dialogue)
    c.getPA().changeSkillXp(1, 10, true);
    Reply With Quote  
     

  6. #5  
    Donator
    Mr Extremez's Avatar
    Join Date
    Jun 2012
    Posts
    2,243
    Thanks given
    97
    Thanks received
    298
    Rep Power
    61
    Quote Originally Posted by NoChildSupport View Post
    Thank you, although im not sure what im doing wrong but it isnt working
    Code:
    	
    	public int changeSkillXp(int skill, int amount, boolean divide) {	
    		int doAmount;
    		if (divide) {
    			doAmount = getLevelForXP(c.playerXP[skill]) / amount;
    			refreshSkill(skill);
    		} else {
    			doAmount = getLevelForXP(c.playerXP[skill]) * amount;
    			refreshSkill(skill);
    		}
    		return doAmount;
    	}
    
    
    
    (in a dialogue)
    c.getPA().changeSkillXp(1, 10, true);
    Your trying to divide the players attack xp by 10 right? I'll test this out, but I'm pretty sure it works. Otherwise I will fix it for you.
    Add my new Skype: live:extremezgp

    Discord: Mr Extremez#3049

    Reply With Quote  
     

  7. #6  
    Donator

    Join Date
    Jun 2012
    Posts
    637
    Thanks given
    129
    Thanks received
    87
    Rep Power
    57
    Quote Originally Posted by I'm A Boss View Post
    Your trying to divide the players attack xp by 10 right? I'll test this out, but I'm pretty sure it works. Otherwise I will fix it for you.
    yeah
    Reply With Quote  
     

  8. #7  
    Donator
    Mr Extremez's Avatar
    Join Date
    Jun 2012
    Posts
    2,243
    Thanks given
    97
    Thanks received
    298
    Rep Power
    61
    Alright I fixed the code, I've tested it and it works.

    Code:
    public void changeSkillXp(int skill, int amount, boolean divide) {
    		int newXp = divide ? client.playerXP[skill] / amount : client.playerXP[skill] * amount;
    		client.playerXP[skill] = newXp;
    		client.playerLevel[skill] = client.getPlayerAssistant().getLevelForXP(client.playerXP[skill]);
    		refreshSkill(skill);
    	}
    If you would like to add a command for this also this should work:

    Code:
    if (playerCommand.startsWith("changeskillxp")) {
    			try {
    				String[] args = playerCommand.split(" ");
    				int skill = Integer.parseInt(args[1]);
    				int amount = Integer.parseInt(args[2]);
    				boolean divide = Boolean.parseBoolean(args[3]);
    				c.getPlayerAssistant().changeSkillXp(skill, amount, divide);
    			} catch (Exception e) {
    			}
    		}
    Reply With Quote  
     

  9. Thankful users:



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. Replies: 3
    Last Post: 01-25-2012, 02:13 AM
  2. Replies: 0
    Last Post: 07-10-2011, 11:29 PM
  3. Replies: 5
    Last Post: 05-22-2011, 07:38 AM
  4. [Pi] Date and Time Problem
    By Inclement in forum Help
    Replies: 8
    Last Post: 03-29-2011, 09:31 AM
  5. [PI] Adding a teleport and let it teleport
    By owner iwan in forum Help
    Replies: 6
    Last Post: 01-19-2011, 05:37 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
  •