31-12-2006, 02:45 AM
Hello, I have been browsing the forums the past few days, looking for interesting things. I found Magnus's tutorial on carrying over EXP after a player levels up. It is my first time coding in Mirage, so here goes (I re-made my levelup sub)
Is this good
or is it messed up to an evil extent :twisted: ?
Code:
Sub CheckPlayerLevelUp(ByVal Index As Long)
'**S*O*U*R*C*E***E*D*I*T****************************************************************
'* Deathlycat - *
'* Revamped entire levelup system to have EXP carry over after a player levels up *
'* 12/30/06 *
'***************************************************************************************
Do While GetPlayerExp(Index) >= GetPlayerNextLevel(Index)
' When a player has more EXP than the TNL states, give them the EXP that they have left after they level up
Call SetPlayerExp(Index, (GetPlayerExp(Index)) - (GetPlayerNextLevel(Index)))
Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1)
' Gives the player stat points based on their current level divided by 10
Call SetPlayerPOINTS(Index, (GetPlayerPOINTS(Index)) + (GetPlayerLevel(Index) / 10) + 1)
' Tells everyone that that player leveled up
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)
Loop
End SubIs this good
or is it messed up to an evil extent :twisted: ?

1 every other line is a little excessive. Oh and the entire do loop(including do and loop should be indented more, nothing else(except some dim statements) should line up with the sub and end sub. Hopefully you don't take this as an insult or bad criticism, just trying to point out things you might want to fix in the future. 
