Mirage Source http://miragesource.net/forums/ |
|
EXP bar http://miragesource.net/forums/viewtopic.php?f=210&t=1312 |
Page 1 of 1 |
Author: | zocheyado [ Mon Feb 05, 2007 6:04 pm ] |
Post subject: | EXP bar |
thats it =/ i was hopeing somone had a tut for an EXP bar |
Author: | William [ Mon Feb 05, 2007 7:50 pm ] |
Post subject: | |
Code: ' Player tnl packet Case "playertnl" Player(MyIndex).MaxExp = Val(Parse$(1)) Player(MyIndex).Exp = Val(Parse$(2)) If GetPlayerMaxExp(MyIndex) > 0 Then If GetPlayerExp(MyIndex) > 0 Then frmMirage.lblEXP.Caption = GetPlayerExp(MyIndex) & "/" & GetPlayerMaxExp(MyIndex) frmMirage.shpTNL.Width = (((GetPlayerExp(MyIndex) / 9510) / (GetPlayerMaxExp(MyIndex) / 9510)) * 9510) End If End If Exit Sub Change the 9510 to your width of the bar. Also make sure this part is correct for you: Code: Player(MyIndex).MaxExp = Val(Parse$(1))
Player(MyIndex).Exp = Val(Parse$(2)) |
Author: | zocheyado [ Mon Feb 05, 2007 9:08 pm ] |
Post subject: | |
thanks. althou i dont know what u mean by 9510 and the width thing , and ummm ware do i put the code sorry i am a newbie but i am trying to learn |
Author: | William [ Tue Feb 06, 2007 5:37 pm ] |
Post subject: | |
Server Side Add this at the bottom of modServerTCP: Code: Sub SendTNL(ByVal index As Long) Dim Packet As String Packet = "PLAYERTNL" & SEP_CHAR & GetPlayerNextLevel(index) & SEP_CHAR & GetPlayerExp(index) & SEP_CHAR & END_CHAR Call SendDataTo(index, Packet) End Sub Now, on all places that you find: Code: Call SendHP(index) Call SendMP(index) Add below: Code: Call SendSP(index) Now, in modDatabase, add: Code: Sub LoadExps() Dim FileName As String Dim i As Long Call CheckExps FileName = App.Path & "\experience.ini" For i = 1 To MAX_EXP Experience(i) = GetVar(FileName, "EXPERIENCE", "Exp" & i) DoEvents Next i End Sub Sub CheckExps() If Not FileExist("experience.ini") Then Dim i As Long For i = 1 To MAX_EXP Call PutVar(App.Path & "\experience.ini", "EXPERIENCE", "Exp" & i, i * 1500) Next i End If End Sub Sub ClearExps() Dim i As Long For i = 1 To MAX_EXP Experience(i) = 0 Next i End Sub Now at the top of modTypes, add: Code: Public Experience(1 To MAX_EXP) As Long Now, replace: 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 with: Code: Function GetPlayerNextLevel(ByVal index As Long) As Long GetPlayerNextLevel = Experience(GetPlayerLevel(index)) End Function Client Side Now in modHandleData: add this: Code: ' Player tnl packet If LCase(Parse(0)) = "playertnl" Then Player(MyIndex).MaxExp = Val(Parse$(1)) Player(MyIndex).Exp = Val(Parse$(2)) If GetPlayerMaxExp(MyIndex) > 0 Then If GetPlayerExp(MyIndex) > 0 Then frmMirage.lblEXP.Caption = GetPlayerExp(MyIndex) & "/" & GetPlayerMaxExp(MyIndex) frmMirage.shpTNL.Width = (((GetPlayerExp(MyIndex) / 2000) / (GetPlayerMaxExp(MyIndex) / 2000)) * 2000) End If End If Exit Sub Now add a picture box in frmMirage: Code: width = 2000 Height = 135 And make the picture box's BackColor the color you want the exp bar, or load a image to it. Below: Code: Sub SetPlayerExp(ByVal Index As Long, ByVal Exp As Long) Player(Index).Exp = Exp End Sub Add: Code: Sub SetPlayerMaxExp(ByVal Index As Long, ByVal MaxExp As Long) Player(Index).MaxExp = MaxExp End Sub Function GetPlayerMaxExp(ByVal Index As Long) As Long GetPlayerMaxExp = Player(Index).MaxExp End Function Now below: Code: MaxSP As Long in Type PlayerRec, add: Code: MaxExp As Long Now add a ini filed name: experience.ini in the server folder, and add the following: Code: [EXPERIENCE] Exp1=1500 Exp2=3000 Exp3=4500 Exp4=6000 Exp5=7500 etc. to your max level. Now below: Code: Public Const MAX_SPELLS = 50 add: Code: Public Const MAX_EXP = 200
|
Author: | YingYang [ Mon Jul 02, 2007 2:14 pm ] |
Post subject: | Re: |
William wrote: Now, on all places that you find: Code: Call SendHP(index) Call SendMP(index) Add below: Code: Call SendSP(index) Wouldn't that be Call SendXP? Just want to make sure because many people might get confused. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |