Thread: (Dementhium) How to change rate of HP restoration

Results 1 to 5 of 5
  1. #1 (Dementhium) How to change rate of HP restoration 
    Extreme Donator

    Join Date
    May 2011
    Posts
    210
    Thanks given
    23
    Thanks received
    8
    Rep Power
    24
    So basically I'm looking to re-code my server into a survival server because it sounds like an awesome idea.

    I want the players' HP to decrease instead of increasing with each tick.

    Any help would be appreciated!
    Reply With Quote  
     

  2. #2  
    Contributor

    clem585's Avatar
    Join Date
    Sep 2013
    Posts
    3,788
    Thanks given
    706
    Thanks received
    702
    Rep Power
    570
    Quote Originally Posted by Paepay View Post
    So basically I'm looking to re-code my server into a survival server because it sounds like an awesome idea.

    I want the players' HP to decrease instead of increasing with each tick.

    Any help would be appreciated!
    Entity.java

    Code:
    	public boolean restoreHitPoints() {
    		int maxHp = getMaxHitpoints();
    		if (hitpoints > maxHp) {
    			if (this instanceof Player) {
    				Player player = (Player) this;
    				if (player.getPrayer().usingPrayer(1, 5) && Utils.getRandom(100) <= 15)
    					return false;
    			}
    			setHitpoints(hitpoints - 1);
    			return true;
    		} else if (hitpoints < maxHp) {
    			setHitpoints(hitpoints + 1);
    			if (this instanceof Player) {
    				Player player = (Player) this;
    				if (player.getPrayer().usingPrayer(0, 9) && hitpoints < maxHp)
    					setHitpoints(hitpoints + 1);
    				else if (player.getPrayer().usingPrayer(0, 26) && hitpoints < maxHp)
    					setHitpoints(hitpoints + (hitpoints + 4 > maxHp ? maxHp - hitpoints : 4));
    
    			}
    			return true;
    		}
    		return false;
    	}
    Code:
    setHitpoints(hitpoints + 1);
    Code:
    setHitpoints(hitpoints - 1);
    Project thread
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Extreme Donator

    Join Date
    May 2011
    Posts
    210
    Thanks given
    23
    Thanks received
    8
    Rep Power
    24
    My "entity.java" looks nothing like this...
    Reply With Quote  
     

  5. #4  
    Registered Member

    Join Date
    Feb 2011
    Posts
    1,143
    Thanks given
    545
    Thanks received
    110
    Rep Power
    87
    Quote Originally Posted by Paepay View Post
    My "entity.java" looks nothing like this...
    It still comes with the same principle - find where restoreHitPoints is and just change it from increasing to decreasing. If I have a 639 lying around I'll search around.

    Found it - PlayerRestorationTick

    As much as I don't want to spoonfeed...

    Code:
     if (healTick == 0) {
                    healTick = 10;
                    if (player.getSkills().getHitPoints() < player.getSkills().getLevelForExperience(Skills.HITPOINTS) * 10) {
                        player.getSkills().heal(1);
                    }
                }
    to



    Code:
     if (healTick == 0) {
                    healTick = 10;
                    if (player.getSkills().getHitPoints() < player.getSkills().getLevelForExperience(Skills.HITPOINTS) * 10) {
                        player.getSkills().heal(-1);
                    }
                }
    That might work, it might not, but you can figure it out, you have a brain.

    Reply With Quote  
     

  6. #5  
    Extreme Donator

    Join Date
    May 2011
    Posts
    210
    Thanks given
    23
    Thanks received
    8
    Rep Power
    24
    I generally don't ask to be spoonfed because it's not hard to search and find answers but this has had me stumped. I got it to work.

    Basically just did the following, otherwise your health wouldn't go down if you were full hp.

    if (healTick == 0) {
    healTick = 10;
    player.getSkills().heal(-1);
    }



    Thank you very much!
    Reply With Quote  
     

  7. Thankful user:



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. How to change bonuses of prayers
    By x Shoter x in forum Help
    Replies: 3
    Last Post: 12-21-2010, 01:06 AM
  2. How to change health of npcs noob friendly
    By Inv4lid™ in forum Tutorials
    Replies: 7
    Last Post: 05-26-2009, 05:30 PM
  3. Replies: 9
    Last Post: 03-15-2009, 12:35 AM
  4. how to change title of bank
    By Gluon in forum Help
    Replies: 14
    Last Post: 02-14-2009, 05:50 PM
  5. Replies: 2
    Last Post: 10-19-2008, 10:38 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
  •