06-02-2007, 05:34 PM
As you say, tnl is controlled by this code in ms.
In a lot of other sources I've seen the levels are set by the use of an experience/level .ini file using this code instead.
Where Experience(GetPlayerLevel(Index)) would be the required exp from the .ini file for a player of that level to reach the next.
you can then use it in Sub CheckPlayerLevelUp something like this.
please note that this isn't a full tutorial on how to do it, you would have to add loading of Experience() into the server and a few other things to get it running, but I hope it gives you some ideas. :lol:
P.S If you want to change your classes without having to shutdown the server, you can use the 'reload classes' option under the 'Database' menu option on the server. :wink:
Code:
Function GetPlayerNextLevel(ByVal Index As Long) As Long
GetPlayerNextLevel = (GetPlayerLevel(Index) + 1) * (GetPlayerSTR(Index) + GetPlayerDEF(Index) + GetPlayerMAGI(Index) + GetPlayerSPEED(Index) + GetPlayerPOINTS(Index)) * 25
End Function
In a lot of other sources I've seen the levels are set by the use of an experience/level .ini file using this code instead.
Code:
Function GetPlayerNextLevel(ByVal Index As Long) As Long
GetPlayerNextLevel = Experience(GetPlayerLevel(Index))
End Function
Where Experience(GetPlayerLevel(Index)) would be the required exp from the .ini file for a player of that level to reach the next.
you can then use it in Sub CheckPlayerLevelUp something like this.
Code:
Sub CheckPlayerLevelUp(ByVal index As Long)
Dim i As Long
Dim d As Long
Dim C As Long
C = 0
If GetPlayerExp(index) >= GetPlayerNextLevel(index) Then
If GetPlayerLevel(index) < MAX_LEVEL Then
Do Until GetPlayerExp(index) < GetPlayerNextLevel(index)
DoEvents
If GetPlayerLevel(index) < MAX_LEVEL Then
If GetPlayerExp(index) >= GetPlayerNextLevel(index) Then
d = GetPlayerExp(index) - GetPlayerNextLevel(index)
Call SetPlayerLevel(index, GetPlayerLevel(index) + 1)
i = Int(GetPlayerSPEED(index) / 10)
If i < 1 Then i = 1
If i > 3 Then i = 3
Call SetPlayerExp(index, d)
C = C + 1
End If
End If
Loop
If C > 1 Then
Call GlobalMsg(GetPlayerName(index) & " has gained " & C & " levels!", 6)
Else
Call GlobalMsg(GetPlayerName(index) & " has gained a level!", 6)
End If
End If
If GetPlayerLevel(index) = MAX_LEVEL Then
Call SetPlayerExp(index, Experience(MAX_LEVEL))
End If
End If
Call SendHP(index)
Call SendMP(index)
Call SendSP(index)
Call SendStats(index)
End Sub
please note that this isn't a full tutorial on how to do it, you would have to add loading of Experience() into the server and a few other things to get it running, but I hope it gives you some ideas. :lol:
P.S If you want to change your classes without having to shutdown the server, you can use the 'reload classes' option under the 'Database' menu option on the server. :wink: