03-03-2009, 07:08 PM
Currently, the exp rolls over, but because the CheckPlayerLevelUp is only called once, the exp will basically just pool up, with the level up only ever being called when an NPC is killed.
Here's a quick fix.
Replace this line:
With:
Replace the end if at the bottom with:
All this does, is loop through until the player no longer has enough exp to level up.
It'll now spam '[Name] has gained a level!' in the GlobalChat, however.
Can quickly fix that by adding this after the loop:
Adding this to the top of the subroutine:
Then replacing these 2 lines:
With:
Then, add this line just above the entire loop:
Here it is in action:
Here's a quick fix.
Replace this line:
Code:
If GetPlayerExp(inde...
With:
Code:
Do While GetPlayerExp(Index) >= GetPlayerNextLevel(Index)
Replace the end if at the bottom with:
Code:
DoEvents
Loop
All this does, is loop through until the player no longer has enough exp to level up.
It'll now spam '[Name] has gained a level!' in the GlobalChat, however.
Can quickly fix that by adding this after the loop:
Code:
Call GlobalMsg(GetPlayerName(Index) & " has gained " & levelCount & " level(s)!", Brown)
Call PlayerMsg(Index, "You have gained " & levelCount & " level(s)! You now have " & GetPlayerPOINTS(Index) & " stat points to distribute.", BrightBlue)
Adding this to the top of the subroutine:
Code:
Dim levelCount As Byte
Then replacing these 2 lines:
Code:
Call GlobalMsg(GetPlayer...
Call PlayerMsg(Index, "Yo...
With:
Code:
levelCount = levelCount + 1
Then, add this line just above the entire loop:
Code:
If Not GetPlayerExp(Index) >= GetPlayerNextLevel(Index) Then Exit Sub
Here it is in action:
![[Image: levels.png]](http://img231.imageshack.us/img231/7813/levels.png)
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?