Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HP, MP and SP Progress bar's
#1
Well...first of all, let me say hi :wink:
I am a new user here, but I'm using MS for a week or so, and one of the first things that I wanted to change was the HP, MP and SP labels to progress bars...

So let's start Big Grin

Difficulty: Easy 1/5

:: All Client Side::

Right click your ToolBox and click in the "Components..." button.
There search and select the "Microsoft Windows Common Controls 6.0 (SP6)".

If you look in your ToolBox now you will see the Progress Bar thing...
just draw 3 of it (HP, MP and SP) anywhere you want it to be...

Now name then prgHP, prgMP and prgSP

Now inside modHandleData search for this code
Code:
' ::::::::::::::::::::::
    ' :: Player hp packet ::
    ' ::::::::::::::::::::::
    If LCase(Parse(0)) = "playerhp" Then
        Player(MyIndex).MaxHP = Val(Parse(1))
        Call SetPlayerHP(MyIndex, Val(Parse(2)))
        If GetPlayerMaxHP(MyIndex) > 0 Then
            frmMirage.lblHP.Caption = Int(GetPlayerHP(MyIndex) / GetPlayerMaxHP(MyIndex) * 100) & "%"
        (MyIndex) * 100
        End If
        Exit Sub
    End If

    ' ::::::::::::::::::::::
    ' :: Player mp packet ::
    ' ::::::::::::::::::::::
    If LCase(Parse(0)) = "playermp" Then
        Player(MyIndex).MaxMP = Val(Parse(1))
        Call SetPlayerMP(MyIndex, Val(Parse(2)))
        If GetPlayerMaxMP(MyIndex) > 0 Then
            frmMirage.lblMP.Caption = Int(GetPlayerMP(MyIndex) / GetPlayerMaxMP(MyIndex) * 100) & "%"
       (MyIndex) * 100
        End If
        Exit Sub
    End If
    
    ' ::::::::::::::::::::::
    ' :: Player sp packet ::
    ' ::::::::::::::::::::::
        If LCase(Parse(0)) = "playersp" Then
        Player(MyIndex).MaxSP = Val(Parse(1))
        Call SetPlayerSP(MyIndex, Val(Parse(2)))
        If GetPlayerMaxSP(MyIndex) > 0 Then
            frmMirage.lblSP.Caption = Int(GetPlayerSP(MyIndex) / GetPlayerMaxSP(MyIndex) * 100) & "%"
        (MyIndex) * 100
        End If
        Exit Sub
    End If

And if you still want the old labels to show the % of the HP, Mp or Sp of the player, replace it all for this code...
Code:
' ::::::::::::::::::::::
    ' :: Player hp packet ::
    ' ::::::::::::::::::::::
    ' prgHP = HP progress bar..added by WiLL
    If LCase(Parse(0)) = "playerhp" Then
        Player(MyIndex).MaxHP = Val(Parse(1))
        Call SetPlayerHP(MyIndex, Val(Parse(2)))
        If GetPlayerMaxHP(MyIndex) > 0 Then
            frmMirage.lblHP.Caption = Int(GetPlayerHP(MyIndex) / GetPlayerMaxHP(MyIndex) * 100) & "%"
        frmMirage.prgHP.Value = GetPlayerHP(MyIndex) / GetPlayerMaxHP(MyIndex) * 100
        End If
        Exit Sub
    End If

    ' ::::::::::::::::::::::
    ' :: Player mp packet ::
    ' ::::::::::::::::::::::
    ' prgMP = MP progress bar..added by WiLL
    If LCase(Parse(0)) = "playermp" Then
        Player(MyIndex).MaxMP = Val(Parse(1))
        Call SetPlayerMP(MyIndex, Val(Parse(2)))
        If GetPlayerMaxMP(MyIndex) > 0 Then
            frmMirage.lblMP.Caption = Int(GetPlayerMP(MyIndex) / GetPlayerMaxMP(MyIndex) * 100) & "%"
        frmMirage.prgMP.Value = GetPlayerMP(MyIndex) / GetPlayerMaxMP(MyIndex) * 100
        End If
        Exit Sub
    End If
    
    ' ::::::::::::::::::::::
    ' :: Player sp packet ::
    ' ::::::::::::::::::::::
    ' prgSP = SP progress bar..added by WiLL
    If LCase(Parse(0)) = "playersp" Then
        Player(MyIndex).MaxSP = Val(Parse(1))
        Call SetPlayerSP(MyIndex, Val(Parse(2)))
        If GetPlayerMaxSP(MyIndex) > 0 Then
            frmMirage.lblSP.Caption = Int(GetPlayerSP(MyIndex) / GetPlayerMaxSP(MyIndex) * 100) & "%"
        frmMirage.prgSP.Value = GetPlayerSP(MyIndex) / GetPlayerMaxSP(MyIndex) * 100
        End If
        Exit Sub
    End If

But if you want to take the labels off, first you have to delete the labels and replace it for this code:
Code:
' ::::::::::::::::::::::
    ' :: Player hp packet ::
    ' ::::::::::::::::::::::
    ' prgHP = HP progress bar..added by WiLL
    If LCase(Parse(0)) = "playerhp" Then
        Player(MyIndex).MaxHP = Val(Parse(1))
        Call SetPlayerHP(MyIndex, Val(Parse(2)))
        If GetPlayerMaxHP(MyIndex) > 0 Then
        frmMirage.prgHP.Value = GetPlayerHP(MyIndex) / GetPlayerMaxHP(MyIndex) * 100
        End If
        Exit Sub
    End If

    ' ::::::::::::::::::::::
    ' :: Player mp packet ::
    ' ::::::::::::::::::::::
    ' prgMP = MP progress bar..added by WiLL
    If LCase(Parse(0)) = "playermp" Then
        Player(MyIndex).MaxMP = Val(Parse(1))
        Call SetPlayerMP(MyIndex, Val(Parse(2)))
        If GetPlayerMaxMP(MyIndex) > 0 Then
        frmMirage.prgMP.Value = GetPlayerMP(MyIndex) / GetPlayerMaxMP(MyIndex) * 100
        End If
        Exit Sub
    End If
    
    ' ::::::::::::::::::::::
    ' :: Player sp packet ::
    ' ::::::::::::::::::::::
    ' prgSP = SP progress bar..added by WiLL
    If LCase(Parse(0)) = "playersp" Then
        Player(MyIndex).MaxSP = Val(Parse(1))
        Call SetPlayerSP(MyIndex, Val(Parse(2)))
        If GetPlayerMaxSP(MyIndex) > 0 Then
        frmMirage.prgSP.Value = GetPlayerSP(MyIndex) / GetPlayerMaxSP(MyIndex) * 100
        End If
        Exit Sub
    End If
OBS: I did not test the code above...i'm using the labels above the progress bar so the player will know his\her HP, MP or SP percentage.

How it works:
Well when the player lose HP, MP or SP the progress bar ".Value" property changes to the % of the actual HP, MP or SP of the player...

Well...
Hope you guys like it...
Bye Smile
Reply
#2
Man, that is one of the best first posts I have ever seen.

If you're making tutorials in your first post I think you'll get along just fine Wink
Reply
#3
Very good start indeed Tongue
Reply
#4
oh... thanks :oops:
I wanted to make a good and simple tutorial.
and I guess it worked. Smile

And sorry if I did any english grammar errors, you know, it is not my native language... :roll:

thanks again
bye Smile
Reply
#5
willgtjr Wrote:oh... thanks :oops:
I wanted to make a good and simple tutorial.
and I guess it worked. Smile

And sorry if I did any english grammar errors, you know, it is not my native language... :roll:

thanks again
bye Smile

Don't worry, you're English is better than some of the English/American people here!
Reply
#6
Tongue hehe
Thanks I really appreciate that.

And by the way, if anyone have any questions or bugs, PM me or just post it here, I will be glad to help Big Grin
Reply
#7
Not saying this is dumb, but wouln't it be better to use a picture box instead of progress bar? Just to make it look more better.
Reply
#8
It's all a matter of opinion. If you fancy picture boxes, then use them
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)