Thread: Prestige Point Perk Issues (rounding to the nearest 200's)

Results 1 to 4 of 4
  1. #1 Prestige Point Perk Issues (rounding to the nearest 200's) 
    Registered Member
    Join Date
    Feb 2014
    Posts
    62
    Thanks given
    15
    Thanks received
    5
    Rep Power
    25
    Alright so first things first i'll show you the code, this is what is in player.java for a public int:
    Code:
    public int prestige = (prestigePoints / 200) + 1;
    Then what im doing is for bonus experience, so next to any experience gaining code this is what i get:

    Code:
    c.getPA().addSkillXP(exp * (c.getMode().getType().equals(ModeType.OSRS) ? 1 : Config.SMITHING_EXPERIENCE * c.prestige), Player.playerSmithing, true);
    So what's that's doing is multiplying the experience i get for smithing for example by the public int in player.java. Now in game i made an npc return back the amount of xp after noticing my xp isn't increasing until my prestige points gets to 200 (guessing because im dividing it by 200???) by doing this:

    Code:
    Case 1428:
    			c.getDH().sendNpcChat3("Prestiging will increase your drop rate.", "Experience rate: " + ((c.prestige * 100) - 100) + "%", "Your current prestige points: " + c.prestigePoints, 2989, "Ak-Haranu");
    			c.nextChat = -1;
    Now let's say i have 59 prestige points, what it should do is (59/200) + 1, which should be 1.295 meaning i should get 29.5% bonus experience, but it's returning 0 until my prestige points reaches 200. That's why i added the npc to show your exp rate because i noticed it was not working. I then changed the prestigepoints / 200 to prestigepoints / 25 and then everything rounded to the nearest 25's after that. Sorry for my extremely sloppy way of explaining...
    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
    Your variable is a int not a double.
    ((c.prestige * 100) - 100) this makes it 0 because your variable is 1 only.
    And as you mention once it is 200 it become 2.
    ((c.prestige * 100) - 100) this then become 100.


    "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
    Oct 2010
    Posts
    2,853
    Thanks given
    1,213
    Thanks received
    1,622
    Rep Power
    5000
    Your code won't work for multiple reasons:
    1. prestige is an integer, not a double.
    2. You're setting the value of prestige when the Player object is created, prestigePoints will always have the default value (which is probably 0).
    3. prestige will always remain the same value unless you reset it everytime someone prestiges, which seems a bit unnecessary.

    You could do it as easily as this:
    Code:
        public double prestige() {
            return (prestigePoints / (double) 200) + 1;
        }
    Code:
    c.getPA().addSkillXP(exp * (c.getMode().getType().equals(ModeType.OSRS) ? 1 : Config.SMITHING_EXPERIENCE * c.prestige()), Player.playerSmithing, true);
    Test:
    Code:
    public class Test {
        public static void main(String[] args) {
            int points = 59;
            System.out.println(prestige(points));
        }
        
        public static double prestige(int points) {
            return (points / (double) 200) + 1;
        }
    }
    Prints
    Code:
    1.295
    [Today 01:29 AM] RSTrials: Nice 0.97 Win/Loss Ratio luke. That's pretty bad.
    [Today 01:30 AM] Luke132: Ok u fucking moron i forgot i could influence misc.random
    Reply With Quote  
     

  4. Thankful user:


  5. #4  
    Registered Member
    Join Date
    Feb 2014
    Posts
    62
    Thanks given
    15
    Thanks received
    5
    Rep Power
    25
    Quote Originally Posted by Professor Oak View Post
    Your code won't work for multiple reasons:
    1. prestige is an integer, not a double.
    2. You're setting the value of prestige when the Player object is created, prestigePoints will always have the default value (which is probably 0).
    3. prestige will always remain the same value unless you reset it everytime someone prestiges, which seems a bit unnecessary.

    You could do it as easily as this:
    Code:
        public double prestige() {
            return (prestigePoints / (double) 200) + 1;
        }
    Code:
    c.getPA().addSkillXP(exp * (c.getMode().getType().equals(ModeType.OSRS) ? 1 : Config.SMITHING_EXPERIENCE * c.prestige()), Player.playerSmithing, true);
    Test:
    Code:
    public class Test {
        public static void main(String[] args) {
            int points = 59;
            System.out.println(prestige(points));
        }
        
        public static double prestige(int points) {
            return (points / (double) 200) + 1;
        }
    }
    Prints
    Code:
    1.295
    thank you worked perfectly!
    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. [718+] Respawn to the nearest hub
    By lithuaniia in forum Help
    Replies: 4
    Last Post: 11-11-2016, 01:03 AM
  2. Fix to the issue the download wont show
    By Christian_ in forum Software
    Replies: 0
    Last Post: 07-29-2015, 05:27 AM
  3. Ad Nauseam - To the Point of Sickness
    By Alpi in forum Projects
    Replies: 48
    Last Post: 03-12-2014, 11:56 PM
  4. Replies: 0
    Last Post: 10-04-2012, 05:12 AM
  5. Replies: 32
    Last Post: 06-13-2011, 07:58 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
  •