Thread: [Code]Correct master loop for player stats

Page 1 of 3 123 LastLast
Results 1 to 10 of 29
  1. #1 [Code]Correct master loop for player stats 
    Extreme Donator

    Wolf's Avatar
    Join Date
    Jul 2006
    Age
    34
    Posts
    398
    Thanks given
    0
    Thanks received
    2
    Rep Power
    177
    Put this bit of code in your server process via client:

    Code:
    if (StatTimer >= 0)
    	   StatTimer -= 1;
    
    if (StatTimer <= 0) {
    		for (int i1 = 0; i1 < playerLevel.length; i1++) {
    			if (playerLevel[i1] < getLevelForXP(playerXP[i1])) {
    				playerLevel[i1] += 1;
    				StatTimer = 90;
    				setSkillLevel(i1, playerLevel[i1], playerXP[i1]);
    				NewHP = playerLevel[3];
    				refreshSkills();
    			} else if (playerLevel[i1] > getLevelForXP(playerXP[i1])) {
    				playerLevel[i1] -= 1;
    				StatTimer = 90;
    				setSkillLevel(i1, playerLevel[i1], playerXP[i1]);
    				NewHP = playerLevel[3];
    				refreshSkills();
    			}
    		}
    	}
    And declare:
    Code:
    Public int StatTimer = 90;
    What this does is completely manage everyone's player stats, if a current stat is higher then the actual stat, it is lowered every 45 seconds until it is the same as the actual stat. Same procedure applies if a stat is lower then the actual stat level.

    Pretty much just delete all the timers associated with potions, because anyone who has ever tried to make potion timers just got put to shame.

    ~With love,
    Wolf

    RuneCMS member / Early Sythe member
    RS-Server ex-admin [Member #38]
    Dodian ex-admin / developer
    SRL Developer
    MITB member

    Project16/Flight creator
    Reply With Quote  
     

  2. #2  
    Registered Member
    ill pk ur as's Avatar
    Join Date
    Jul 2007
    Posts
    424
    Thanks given
    4
    Thanks received
    12
    Rep Power
    97
    almost every server comes with it and its not hard to find...
    Reply With Quote  
     

  3. #3  
    Stanyer
    Guest
    Are you sure this doesn't do what mine did?

    Because i once attempted to do this, however when it called the method, it froze me for about 5 seconds whilst it looped through each stat checking it.
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    Sep 2006
    Age
    31
    Posts
    3,019
    Thanks given
    22
    Thanks received
    420
    Rep Power
    0
    Change:
    Code:
    	 (StatTimer <= 0) {
    		for (int i1 = 0; i1 < playerLevel.length; i1++) {
    			if (playerLevel[i1] < getLevelForXP(playerXP[i1])) {
    				playerLevel[i1] += 1;
    				StatTimer = 90;
    				setSkillLevel(i1, playerLevel[i1], playerXP[i1]);
    				NewHP = playerLevel[3];
    				refreshSkills();
    			} else if (playerLevel[i1] > getLevelForXP(playerXP[i1])) {
    				playerLevel[i1] -= 1;
    				StatTimer = 90;
    				setSkillLevel(i1, playerLevel[i1], playerXP[i1]);
    				NewHP = playerLevel[3];
    				refreshSkills();
    			}
    		}
    To this:
    Code:
    	if (StatTimer <= 0) {
    		for (int i1 = 0; i1 < playerLevel.length; i1++) {
    			if (playerLevel[i1] < getLevelForXP(playerXP[i1])) {
    				playerLevel[i1] += 1;
    				setSkillLevel(i1, playerLevel[i1], playerXP[i1]);
    				NewHP = playerLevel[3];
    				refreshSkills();
    			} else if (playerLevel[i1] > getLevelForXP(playerXP[i1])) {
    				playerLevel[i1] -= 1;
    				setSkillLevel(i1, playerLevel[i1], playerXP[i1]);
    				NewHP = playerLevel[3];
    				refreshSkills();
    			}
    		}
    		StatTimer = 90;
    	}
    Or else its gonna loop through every stat every half second if they are all at the correct level.
    Reply With Quote  
     

  5. #5  
    Extreme Donator

    Wolf's Avatar
    Join Date
    Jul 2006
    Age
    34
    Posts
    398
    Thanks given
    0
    Thanks received
    2
    Rep Power
    177
    ts not hard to find...
    Find? You actually go 'looking' for code? what does that tell you.....

    And palidino76, I want this to loop through every stat, that's how it's done in runescape, every stat is one level closer to the actual stat level. And do you not see the "StatTimer = 90;" at the end of a stat being returned closer to actual level? What you did has the exact same result as my original, you've done nothing more.

    RuneCMS member / Early Sythe member
    RS-Server ex-admin [Member #38]
    Dodian ex-admin / developer
    SRL Developer
    MITB member

    Project16/Flight creator
    Reply With Quote  
     

  6. #6  
    F*ck the rest join the best, WoR

    sigex's Avatar
    Join Date
    Mar 2008
    Age
    34
    Posts
    2,086
    Thanks given
    123
    Thanks received
    147
    Rep Power
    690
    Quote Originally Posted by Wolf View Post
    Find? You actually go 'looking' for code? what does that tell you.....

    And palidino76, I want this to loop through every stat, that's how it's done in runescape, every stat is one level closer to the actual stat level. And do you not see the "StatTimer = 90;" at the end of a stat being returned closer to actual level? What you did has the exact same result as my original, you've done nothing more.
    Restoring players levels when there below there normal amount? over the space of 90/3 = 30 secounds ish. this also looks like it restores prayer. plus you would lag while it completes this task.


    The wor has begun.

    Reply With Quote  
     

  7. #7  
    Banned

    Join Date
    Sep 2006
    Age
    31
    Posts
    3,019
    Thanks given
    22
    Thanks received
    420
    Rep Power
    0
    Quote Originally Posted by Wolf View Post
    Find? You actually go 'looking' for code? what does that tell you.....

    And palidino76, I want this to loop through every stat, that's how it's done in runescape, every stat is one level closer to the actual stat level. And do you not see the "StatTimer = 90;" at the end of a stat being returned closer to actual level? What you did has the exact same result as my original, you've done nothing more.
    You misunderstood my post. Ok, say all your stats are at the correct level. If so, they niether increase nor decrease, and because of this with what you did the timer isn't delayed back to 45 seconds before checking again, but instead is delayed to every half second until one of your stats aren't at the correct level, which can cause a fair bit of lag. By putting the delay at the end it ensures that it waits 45 seconds whether or not it lowered/increased any stats to begin with.
    Reply With Quote  
     

  8. #8  
    Extreme Donator

    Wolf's Avatar
    Join Date
    Jul 2006
    Age
    34
    Posts
    398
    Thanks given
    0
    Thanks received
    2
    Rep Power
    177
    Quote Originally Posted by sigex View Post
    Restoring players levels when there below there normal amount? over the space of 90/3 = 30 secounds ish. this also looks like it restores prayer. plus you would lag while it completes this task.
    I figured you'd try everything under the sun to try and slander my work. But, I also anticipated you pathetically despite attempt to demote anything I write, so with that said let me once again prove how little you know.

    First off, making the loop ignore player prayer obviously isn't a hard task to do, a brain-dead kid like you could even do it.

    Secondly, "Lag"? As Rat Dawg and I have already told you people, multi looped methods via server process has nothing to do with lag, time between packets sent is what gives you your 'lag'.

    And to seal your sad post for good, "90/3 = 30 secounds ish", is this a joke? let's see, rs2 server's running speeds are default set to 500, which is, obviously 500ms(half a second), so how would 90ms = 30 seconds? You tell me Einstein...., you're obviously the math wiz here.

    RuneCMS member / Early Sythe member
    RS-Server ex-admin [Member #38]
    Dodian ex-admin / developer
    SRL Developer
    MITB member

    Project16/Flight creator
    Reply With Quote  
     

  9. #9  
    Banned
    Join Date
    Nov 2007
    Posts
    399
    Thanks given
    13
    Thanks received
    18
    Rep Power
    0
    /\
    |
    |
    Ownt Like hell.

    Wolf, I used this and it works.
    Also Rep++.
    Thanks - RunePimp.
    Reply With Quote  
     

  10. #10  
    Registered Member

    Join Date
    Jan 2008
    Age
    31
    Posts
    1,380
    Thanks given
    76
    Thanks received
    384
    Rep Power
    962
    Quote Originally Posted by Wolf View Post
    I figured you'd try everything under the sun to try and slander my work. But, I also anticipated you pathetically despite attempt to demote anything I write, so with that said let me once again prove how little you know.

    First off, making the loop ignore player prayer obviously isn't a hard task to do, a brain-dead kid like you could even do it.

    Secondly, "Lag"? As Rat Dawg and I have already told you people, multi looped methods via server process has nothing to do with lag, time between packets sent is what gives you your 'lag'.

    And to seal your sad post for good, "90/3 = 30 secounds ish", is this a joke? let's see, rs2 server's running speeds are default set to 500, which is, obviously 500ms(half a second), so how would 90ms = 30 seconds? You tell me Einstein...., you're obviously the math wiz here.
    Lol nice ownage right there
    thanks for this wolf =)
    Reply With Quote  
     

Page 1 of 3 123 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •