Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[ES] MAX_LEVEL Fix (Optional Part 2)


Greendude120
 Share

Recommended Posts

**IMPORTANT: Before you read on, go to part ONE. This is only optional and is only intended for those who have added the Sadscript fix first. (The fix[part1]: http://www.touchofdeathforums.com/smf/index.php/topic,55126.msg583582.html#msg583582)**

Okay so its been requested that I post how to remove the exp gain when your at the max level. Just a quick explanation: The MAX_LEVEL Fix you've added stops you from leveling above your level cap (if you use quests and such that give exp). Thing is, if your max level is 100, and your level 100, you might not be able to reach level 101, but u can still gain exp. which is useless. So if you want to stop the exp gain on your maximum level cap, your in the right place :)

-The Fix-

Open the Source to your server. In ModDatabase, look for Sub SetPlayerExp.
You can use CTRL + F to search for it. It looks like this:
```
Sub SetPlayerExp(ByVal index As Long, ByVal Exp As Long)
    Player(index).Char(Player(index).CharNum).Exp = Exp
End Sub
```_thanks to Erztel for sending me the sub above so i can work on it(too lazy to go on my other pc)_

Replace the Sub with this:
```
Sub SetPlayerExp(ByVal index As Long, ByVal Exp As Long)
If GetPlayerLevel(Index) < 100 Then
    Player(index).Char(Player(index).CharNum).Exp = Exp
    Else
    Call SetPlayerLevel(Index, 100)
End If
End Sub
```
Simple as that. Short explanation: If your below level 100, give the exp like usual, if your not (which means ur above level 100) then set the player back to level 100 and dont give exp. [Damian suggested that I set the player back to 100\. At first i made it so nothing happens if he isnt below 100.

**NOTE: IF YOU DO NOT WANT YOUR MAX LEVEL CAP TO BE 100, JUST CHANGE ALL THE 100s TO W/E YOU WANT IT.**

If you did not do part one, you are doing all this for nothing. The first part is in sadscript btw and does not require this fix. This is an add-on to the other fix.
Link to comment
Share on other sites

Ok I tested this and it works.

I made my char lvl 99, then gave him more exp then needed till 100 and it just set him at lvl 100 with 0/100000 exp. Then when I do Mass Experience or any form of giving experience it stays at 0/100000 like its suppose to.
Link to comment
Share on other sites

  • 5 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...