Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple EXP Carry-Over
#2
Slightly better way to do it.


Code:
Sub CheckPlayerLevelUp(ByVal Index As Long)

Dim I As Long, ExtraEXP As Long

If GetPlayerExp(Index) >= GetPlayerNextLevel(Index) Then
    ExtraEXP = (GetPlayerExp(Index) - GetPlayerNextLevel(Index))
        
    Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1)

    ' Get the ammount of skill points to add
    I = Int(GetPlayerSPEED(Index) / 10)
    If I < 1 Then I = 1
    If I > 3 Then I = 3
            
    Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + I)
    Call SetPlayerExp(Index, ExtraEXP)
    Call GlobalMsg(GetPlayerName(Index) & " has gained a level!", Brown)
    Call PlayerMsg(Index, "You have gained a level!  You now have " & GetPlayerPOINTS(Index) & " stat points to distribute.", BrightBlue)
    Call CheckPlayerLevelUp(Index)
End If

End Sub
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)