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

[EO] 2.0 Show Level OPTION


gdog12356
 Share

Recommended Posts

Ok, i thought i have been asking too much of the community, and not sharing enough, so here is a super quick edit i did which took mabe 2 mins max.

This tutorial is based off of the one made by sheldon here
>! [http://www.touchofdeathforums.com/smf/index.php/topic,67213.0.html](http://www.touchofdeathforums.com/smf/index.php/topic,67213.0.html)

ok, first open up modconstants and at the bottom, add```
Public Level_Show As Boolean
```now open up mod text, and add
```
Dim TextA As Long
Dim TextB As Long
```below
```
Public Sub DrawPlayerName(ByVal Index As Long)
```
now find```
Call DrawText(TexthDC, TextX, TextY, Name, color)
```(still in mod text)

and below that add```
    If Level_Show = True Then
    ' calc pos
    TextA = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$("Level " & GetPlayerLevel(Index))))
    If GetPlayerSprite(Index) < 1 Or GetPlayerSprite(Index) > NumCharacters Then
        TextB = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 5
    Else
        ' Determine location for text
        TextB = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight / 4) + 5
    End If
```
ok, now open up frmMain. And go to the side, and choose picOptions then where it shows the squared outline, right click and hit bring to front. ![](http://i55.tinypic.com/2q0ilhk.png)

Now make a new CHECKBOX, and name it```
level_chk
```
now double click on the check box, and replace all the code that is there with this```
Private Sub level_chk_Click()
If level_chk.Value = 0 Then
Level_Show = True
Else
Level_Show = False
End If
End Sub
```
now make a label, and for the caption, put hide player level. now just put that next to the checkbox, and your done!! :).

in the end u shuld get something like this ![](http://i54.tinypic.com/2cfvypw.png)
Link to comment
Share on other sites

```
    If Level_Show = True Then
    ' calc pos
    TextA = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$("Level " & GetPlayerLevel(Index))))
    If GetPlayerSprite(Index) < 1 Or GetPlayerSprite(Index) > NumCharacters Then
        TextB = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 5
    Else
        ' Determine location for text
        TextB = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight / 4) + 5
    End If

```
I have problem with this code, all working properly but the level don't shows.

//sorry for my eng ;p

//edit: Ok, it's work. I don't write all of post.
Link to comment
Share on other sites

so it works but i had to change it up just a lil bit.  heres your code that you said to add.

```
    If Level_Show = True Then 
' calc pos   
TextA = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$("Level " & GetPlayerLevel(Index)))) 
  If GetPlayerSprite(Index) < 1 Or GetPlayerSprite(Index) > NumCharacters Then 
      TextB = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 5 
Else     
  ' Determine location for text     
TextB = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight / 4) + 5 
End If
```
so i did it a little diferently.  i had to add just this.
```
If Level_Show = True Then 
```above like you said.

```
end if
```at the bottom  and i skipped the middle section as its already there if you did the previous step of the show level tut.  the rest was spot on.
Link to comment
Share on other sites

  • 3 months later...
Or you can make your life easier by doing this:
Make a checkbox, name it chkLevel.
Go to modText, and in Sub DrawPlayerName, in it's declarations, add
```
Dim TextA As Long
Dim TextB As Long
```
Still in modText, add at the bottom:
```
    ' calc pos
    TextA = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$("Level " & GetPlayerLevel(Index))))
    If GetPlayerSprite(Index) < 1 Or GetPlayerSprite(Index) > NumCharacters Then
        TextB = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 5
    Else
        ' Determine location for text
        TextB = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight / 4) + 5
    End If

    'Draw level
    If frmMain.chkLevel.Value = 1 Then
        Call DrawText(TexthDC, TextA, TextB, "Level " & GetPlayerLevel(Index), color)
    Else
        ' nothing, don't show it
    End If
```
**NOTE:** This uses Sheldon's tutorial.
Link to comment
Share on other sites

  • 5 weeks later...
to me work this way…

im remplace Public Sub DrawPlayerName for this:

```
Public Sub DrawPlayerName(ByVal Index As Long)
Dim TextA As Long
Dim TextB As Long
Dim TextX As Long
Dim TextY As Long
Dim color As Long
Dim Name As String

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    ' Check access level
    If GetPlayerPK(Index) = NO Then

        Select Case GetPlayerAccess(Index)
            Case 0
                color = RGB(255, 96, 0)
            Case 1
                color = QBColor(DarkGrey)
            Case 2
                color = QBColor(Cyan)
            Case 3
                color = QBColor(BrightGreen)
            Case 4
                color = QBColor(Yellow)
        End Select

    Else
        color = QBColor(BrightRed)
    End If

    Name = Trim$(Player(Index).Name)
    ' calc pos
    TextX = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(Name)))
    If GetPlayerSprite(Index) < 1 Or GetPlayerSprite(Index) > NumCharacters Then
        TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 16
    Else
        ' Determine location for text
        TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight / 4) + 16
    End If

    ' Draw name
    Call DrawText(TexthDC, TextX, TextY, Name, color)

    If Level_Show = True Then
    ' calc pos
    TextA = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$("" & GetPlayerLevel(Index))))
    If GetPlayerSprite(Index) < 1 Or GetPlayerSprite(Index) > NumCharacters Then
        TextB = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 5
    Else
        ' Determine location for text
        TextB = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight / 4) + 5
    End If
    'Draw level
    Call DrawText(TexthDC, TextA, TextB, "" & GetPlayerLevel(Index), color)
    End If
    ' Error handler
    Exit Sub
errorhandler:
    HandleError "DrawPlayerName", "modText", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub
```
Link to comment
Share on other sites

  • 1 month later...
i did this, for some reson if i have more than one npc  a wird lvl 0 pops up on top left of my maps? plus my lvl only pups up when a npc is on the map? Edit: Fixed it nvm.. heres my code i put tags in there for admins to

```
Public Sub DrawPlayerName(ByVal Index As Long)
Dim TextX As Long
Dim TextY As Long
Dim color As Long
Dim Name As String

    ' Check access level
    If GetPlayerPK(Index) = NO Then

        Select Case GetPlayerAccess(Index)
            Case 0
                color = RGB(255, 96, 0)
            Case 1
                color = QBColor(DarkGrey)
            Case 2
                color = QBColor(Cyan)
            Case 3
                color = QBColor(BrightGreen)
            Case 4
                color = QBColor(Yellow)
        End Select

    Else
        color = QBColor(BrightRed)
    End If

    If GetPlayerAccess(Index) = 0 Then
    Name = Trim$(Player(Index).Name) & " Lvl: " & GetPlayerLevel(Index)
    ElseIf GetPlayerAccess(Index) = 1 Then
    Name = "[Player Relations] " & Trim$(Player(Index).Name) & " Level: " & GetPlayerLevel(Index)
    ElseIf GetPlayerAccess(Index) = 2 Then
    Name = "[Mapper] " & Trim$(Player(Index).Name) & " Lvl: " & GetPlayerLevel(Index)
    ElseIf GetPlayerAccess(Index) = 3 Then
    Name = "[Admin] " & Trim$(Player(Index).Name) & " Lvl: " & GetPlayerLevel(Index)
    ElseIf GetPlayerAccess(Index) = 4 Then
    Name = "[Developer] " & Trim$(Player(Index).Name) & " Lvl: " & GetPlayerLevel(Index)
    End If

    ' calc pos
    TextX = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(Name)))
    If GetPlayerSprite(Index) < 1 Or GetPlayerSprite(Index) > NumCharacters Then
        TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 16
    Else
        ' Determine location for text
        TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight / 4) + 16
    End If

    ' Draw name
    Call DrawText(TexthDC, TextX, TextY, Name, color)
        ' Error handler
    Exit Sub
errorhandler:
    HandleError "DrawPlayerName", "modText", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub
```
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...