Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

SP Bar Fix [EE 2.7 and Stable] [1/5]


Athagekin
 Share

Recommended Posts

Alright, this is very simple.  There's another stat thing in Eclipse like HP and MP, and they have bars in the game to keep track of how much you have.  But there is no SP bar in the game, so we'd have to code this in.  It isn't too hard if you have some basic experience with VB6, because all you really need to do is add in two objects and code them in so they work.

Note:  The SP stat is already coded in, so there is no major edit we need to do. 

This is all client sided.

First, go into your client project and load "frmMirage.frm."  Next, look for your HP and MP bars, by default, located at the bottom left of the form.  Go to "picStats" in the form, and delete the current lblSP and the other label to the left of it that says "ENERGY."  Add in a Shape object to the form, and name it "shpSP," and change the shape to a rectangle, and make the size:  15 Height, 150 Width.  Next, add a label and name it "lblSP," and place it over top of shpSP, and change the BackStyle to transparent.  Next, open "modHandleData.bas," and look for this code:

```
    ' ::::::::::::::::::::::
    ' :: Player sp packet ::
    ' ::::::::::::::::::::::
    If casestring = "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) & "%"
        End If
        Exit Sub
    End If
```
Replace that entire code with this:
```
    ' ::::::::::::::::::::::
    ' :: Player sp packet ::
    ' ::::::::::::::::::::::
    If LCase$(casestring) = "playersp" Then
        Player(MyIndex).MaxSP = Val(parse(1))
        Call SetPlayerSP(MyIndex, Val(parse(2)))
        If GetPlayerMaxSP(MyIndex) > 0 Then
            ' frmMirage.shpSP.FillColor = RGB(208, 11, 0)
            frmMirage.shpSP.Width = ((GetPlayerSP(MyIndex)) / (GetPlayerMaxSP(MyIndex))) * 150
            frmMirage.lblSP.Caption = GetPlayerSP(MyIndex) & " / " & GetPlayerMaxSP(MyIndex)
        End If
        Exit Sub
    End If
```
Now, the reason why the SP bar wouldn't have worked if you just added it in to frmMirage, was because it was missing this line:

```
            frmMirage.shpSP.Width = ((GetPlayerSP(MyIndex)) / (GetPlayerMaxSP(MyIndex))) * 150
```
Also, the code below it for lblSP was a bit weird.  So, we changed that line to make it act like an HP or MP bar.

Now, open up "modGameLogic.bas," and look for this:

```
    ' Check for divide by 0 error
    If GetPlayerMaxMP(MyIndex) > 0 Then
        frmMirage.shpMP.Width = ((GetPlayerMP(MyIndex)) / (GetPlayerMaxMP(MyIndex))) * 150
        frmMirage.lblMP.Caption = GetPlayerMP(MyIndex) & " / " & GetPlayerMaxMP(MyIndex)
    End If
```
Right under that, add this code:
```
    ' Check for divide by 0 error
    If GetPlayerMaxSP(MyIndex) > 0 Then
        frmMirage.shpSP.Width = ((GetPlayerSP(MyIndex)) / (GetPlayerMaxSP(MyIndex))) * 150
        frmMirage.lblSP.Caption = GetPlayerSP(MyIndex) & " / " & GetPlayerMaxSP(MyIndex)
    End If
```
That's all!  Now, compile the project and test out your new SP bar!

EDIT:  Found a small problem.  Fixed the main post.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...