Thread: Making a variable save at Certain Hp Level

Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1 Making a variable save at Certain Hp Level 
    OoO Donor <3
    Rockstar Jax's Avatar
    Join Date
    Mar 2011
    Age
    27
    Posts
    608
    Thanks given
    77
    Thanks received
    78
    Rep Power
    21
    Okay,

    So I edited the killingstreak class found on this tut: http://www.rune-server.org/runescape...tem-100-a.html

    Okay heres my void I created

    Code:
    	public void Rewards() {
    		Client o = (Client) PlayerHandler.players[c.killerId];
    		int cash = 1000000; //1M
    		int maxks = 100;
    		int reward = o.killStreak * cash;
    			if(o != null) {
    				if(o.killStreak > 0) {
    					c.getItems().addItem(4067, reward);
    				} else if(c.killStreak == maxks) {
    					yell("<col=16711680>PvP System:</col> "+c.playerName+" has Reached Maxed Killstreak! He is Rewarded 250 GSP");
    					c.pkPoints += 250;
    				}
    			}
    		}
    But it throws a nullpointer, because if the int reward is o.killstreak times cash.

    But when the player dies, it sets his killstreak to 0 therefore you are getting a reward of 0.

    So I need to figure out how to make it where you get in a range between certain hp levels it will save as a variable.

    So that way int reward could be changed to o.newvarmade * cash.

    I hope that makes sense.. Its hard to explain

    <-- amateur sig skills dont hate
    Reply With Quote  
     

  2. #2  
    Registered Member blastashes's Avatar
    Join Date
    Apr 2012
    Age
    29
    Posts
    175
    Thanks given
    3
    Thanks received
    4
    Rep Power
    17
    k... just turn off teh pc and go bowling. lol
    Reply With Quote  
     

  3. #3  
    Howdy

    nMik's Avatar
    Join Date
    Nov 2010
    Posts
    1,060
    Thanks given
    144
    Thanks received
    147
    Rep Power
    107
    Why are you using o. then switching to c. for the same player? and instead of making cash a variable just put (1000000*c.killStreak) and why are you using o != null the player will be on no matter what if it calls if cus it should be checking kills first either way

    Reply With Quote  
     

  4. Thankful user:


  5. #4  
    Registered Member

    Join Date
    Sep 2011
    Posts
    1,140
    Thanks given
    385
    Thanks received
    398
    Rep Power
    474
    You're using o before you check if it's null.
    Reply With Quote  
     

  6. #5  
    OoO Donor <3
    Rockstar Jax's Avatar
    Join Date
    Mar 2011
    Age
    27
    Posts
    608
    Thanks given
    77
    Thanks received
    78
    Rep Power
    21
    Quote Originally Posted by Artesia View Post
    Why are you using o. then switching to c. for the same player? and instead of making cash a variable just put (1000000*c.killStreak) and why are you using o != null the player will be on no matter what if it calls if cus it should be checking kills first either way
    My friend said it would be a fix. o. is because I want the reward to be based on THE PERSON THEY killed ks. So if the player I killed had a 7 killstreak and I killed him I should get 7m. Not based off mine.

    <-- amateur sig skills dont hate
    Reply With Quote  
     

  7. #6  
    OoO Donor <3
    Rockstar Jax's Avatar
    Join Date
    Mar 2011
    Age
    27
    Posts
    608
    Thanks given
    77
    Thanks received
    78
    Rep Power
    21
    Quote Originally Posted by blastashes View Post
    k... just turn off teh pc and go bowling. lol
    72 posts? Gtfo, if you are not going to help, dont comment. Simple.

    <-- amateur sig skills dont hate
    Reply With Quote  
     

  8. #7  
    Howdy

    nMik's Avatar
    Join Date
    Nov 2010
    Posts
    1,060
    Thanks given
    144
    Thanks received
    147
    Rep Power
    107
    Quote Originally Posted by Rockstar Jax View Post
    My friend said it would be a fix. o. is because I want the reward to be based on THE PERSON THEY killed ks. So if the player I killed had a 7 killstreak and I killed him I should get 7m. Not based off mine.
    Oh ok i see what you mean..

    public void Rewards() {
    Client o = (Client) PlayerHandler.players[c.killerId];
    int cash = 1000000; //1M
    int maxks = 100;
    int reward;
    if(o != null) {
    if(o.killStreak > 0 && c.killStreak != maxks) {
    reward = o.killStreak * cash;
    c.getItems().addItem(4067, reward);
    } else if(c.killStreak == maxks) {
    yell("<col=16711680>PvP System:</col> "+c.playerName+" has Reached Maxed Killstreak! He is Rewarded 250 GSP");
    c.pkPoints += 250;
    }
    }
    }

    Reply With Quote  
     

  9. #8  
    OoO Donor <3
    Rockstar Jax's Avatar
    Join Date
    Mar 2011
    Age
    27
    Posts
    608
    Thanks given
    77
    Thanks received
    78
    Rep Power
    21
    Quote Originally Posted by Artesia View Post
    Oh ok i see what you mean..

    public void Rewards() {
    Client o = (Client) PlayerHandler.players[c.killerId];
    int cash = 1000000; //1M
    int maxks = 100;
    int reward;
    if(o != null) {
    if(o.killStreak > 0 && c.killStreak != maxks) {
    reward = o.killStreak * cash;
    c.getItems().addItem(4067, reward);
    } else if(c.killStreak == maxks) {
    yell("<col=16711680>PvP System:</col> "+c.playerName+" has Reached Maxed Killstreak! He is Rewarded 250 GSP");
    c.pkPoints += 250;
    }
    }
    }
    Could you please explain the difference?

    <-- amateur sig skills dont hate
    Reply With Quote  
     

  10. #9  
    Howdy

    nMik's Avatar
    Join Date
    Nov 2010
    Posts
    1,060
    Thanks given
    144
    Thanks received
    147
    Rep Power
    107
    Just like null said its being was called before hand

    Reply With Quote  
     

  11. #10  
    Registered Member blastashes's Avatar
    Join Date
    Apr 2012
    Age
    29
    Posts
    175
    Thanks given
    3
    Thanks received
    4
    Rep Power
    17
    Quote Originally Posted by Rockstar Jax View Post
    72 posts? Gtfo, if you are not going to help, dont comment. Simple.
    everyone starts somewhere, i'm sure at one time you had 72 posts as well.

    dick.
    Reply With Quote  
     

Page 1 of 2 12 LastLast

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. Making a variable [REP+]
    By Mitver in forum Help
    Replies: 27
    Last Post: 08-01-2011, 08:47 PM
  2. [PI] NPCs with variable combat level
    By purepout in forum Help
    Replies: 13
    Last Post: 03-18-2011, 01:10 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
  •