![]() |
Exp Rollover fix - Printable Version +- Mirage Engine (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: Source Code Development (https://mirage-engine.uk/forums/forumdisplay.php?fid=51) +----- Forum: Mirage Source 4 (Visual Basic 6) (https://mirage-engine.uk/forums/forumdisplay.php?fid=44) +------ Forum: Bugs Reports (https://mirage-engine.uk/forums/forumdisplay.php?fid=9) +------ Thread: Exp Rollover fix (/showthread.php?tid=2592) |
Exp Rollover fix - Robin - 03-03-2009 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: Code: If GetPlayerExp(inde... With: Code: Do While GetPlayerExp(Index) >= GetPlayerNextLevel(Index) Replace the end if at the bottom with: Code: DoEvents 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) Adding this to the top of the subroutine: Code: Dim levelCount As Byte Then replacing these 2 lines: Code: Call GlobalMsg(GetPlayer... 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: ![]() Re: Exp Rollover fix - Rian - 03-03-2009 Nice. Added Re: Exp Rollover fix - GIAKEN - 03-03-2009 levelCount = 0 isn't needed ![]() Re: Exp Rollover fix - Robin - 03-03-2009 Oops, forgot to add this to tutorial. If you've already added the tutorial, add: Code: If Not GetPlayerExp(Index) >= GetPlayerNextLevel(Index) Then Exit Sub Just before the loop. Added it to the tutorial now, so if you haven't added it yet, don't worry about it. Not having that line in meant the server was spammed with "[Name] gained 0 level(s)!" because it didn't exit the sub if the player hadn't leveled at all ;D That line just exits out if no level takes place. |