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

(EO) Change Equipment Layout


Murdoc
 Share

Recommended Posts

**Difficulty** : Beginner
*Tested*

This is a simple tutorial to show how you can place each equipment type where you want.

First go to Sub BltEquipment in modDirectDraw7, and find this code:

```
With rec_pos
                .Top = EqTop + 20
                .Bottom = .Top + PIC_Y
                .Left = EqLeft + ((EqOffsetX + 32) * (((I - 1) Mod EqColumns)))
                .Right = .Left + PIC_X
            End With
```
Replace that code with this:

```
Select Case Item(itemnum).Type
    Case ITEM_TYPE_WEAPON
    With rec_pos
                .Top = EqTop + 20
                .Bottom = .Top + PIC_Y
                .Left = EqLeft + ((EqOffsetX + 32) * (((I - 1) Mod EqColumns)))
                .Right = .Left + PIC_X
            End With
    Case ITEM_TYPE_HELMET
    With rec_pos
                .Top = EqTop
                .Bottom = .Top + PIC_Y
                .Left = EqLeft + ((EqOffsetX + 32) * (((I - 1) Mod EqColumns)))
                .Right = .Left + PIC_X
            End With
    Case ITEM_TYPE_ARMOR
    With rec_pos
                .Top = EqTop
                .Bottom = .Top + PIC_Y
                .Left = EqLeft + ((EqOffsetX + 32) * (((I - 1) Mod EqColumns)))
                .Right = .Left + PIC_X
            End With
    Case ITEM_TYPE_SHIELD
    With rec_pos
                .Top = EqTop
                .Bottom = .Top + PIC_Y
                .Left = EqLeft + ((EqOffsetX + 32) * (((I - 1) Mod EqColumns)))
                .Right = .Left + PIC_X
            End With

    End Select
```
Now you can change the placement values for each type. Example : Helmets might have ".Top = EqTop +15" or whichever.

If you want to change where the equipment is displayed (instead of default imgChar) do this bit:

Create a new picturebox (picEQ for example) and place it where you want. To have the equipment pop up, set the picturebox to Visible=false in properties, and create a button somewhere with:

```
picEQ.Visible=true
```
Go to Sub BltEquipment and change:

```
frmMainGame.picCharacter.Cls
```
to

```
frmMainGame.picEQ.Cls
```

Next we call the Sub BltEquipment when equipment is clicked on or scrolled over for the new picturebox. View Code for frmMainGame and find this:

```
Private Sub picCharacter_Click()
    Dim EqNum As Long
    EqNum = IsEqItem(EqX, EqY)

    If EqNum <> 0 Then
        SendUnequip EqNum
    End If

End Sub

Private Sub picCharacter_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim EqNum As Long
    Dim x2 As Long, y2 As Long
    EqX = X
    EqY = Y
    EqNum = IsEqItem(X, Y)

    If EqNum <> 0 Then
        y2 = Y + picCharacter.Top - frmMainGame.picItemDesc.height - 2
        x2 = X + picCharacter.Left + 2
        UpdateDescWindow GetPlayerEquipment(MyIndex, EqNum), 0, x2, y2
        LastItemDesc = GetPlayerEquipment(MyIndex, EqNum) ' set it so you don't re-set values
        Exit Sub
    End If

    picItemDesc.Visible = False
    LastItemDesc = 0 ' no item was last loaded
End Sub
```
Replace all the "picCharacter" with "picEQ". And Voila!

Let me know if there's any bugs :)
Link to comment
Share on other sites

@[Cake:

> Vitin â„¢ link=topic=64698.msg693019#msg693019 date=1284654376]
> Whats the pointless of this.IMO this is useless

It's just a beginner tutorial. One general purpose is to display the certain types of equipment in SPECIFIC spots, like say if you had a picture of a body, and wanted to have the equipment show up on different parts or on a paperdoll, you know? It's not completely useless, just not that hard. I'm not even intermediate in VB 6 and I figured this one out. I wanted to put it up to show other "n00bs" how to do it lol. Sorry, it doesn't tickle your fancy :P
Link to comment
Share on other sites

@[Cake:

> Vitin â„¢ link=topic=64698.msg693051#msg693051 date=1284660562]
> I just think that having An place only for Equipment is pointless but as I said its just my opinion

That's why people make different GUI appearances. It's got very little to do with an obvious point, and more to do with aesthetics. It's also quite pointless to have pictures for links, when you can just use text. But it doesn't look as good.  ;)
Link to comment
Share on other sites

Change the equipment position constants in modConstants if you want to change where items appear. It's a very easy to edit system, only having to change a couple of numbers to change the order. I suggest you look into them.

```
' Character consts
Public Const EqTop As Byte = 200
Public Const EqLeft As Byte = 12
Public Const EqOffsetX As Byte = 15
Public Const EqColumns As Byte = 4

```
As for the order, your way of doing things bypasses the original way I handled equipment. It's no longer the dynamic system I have as you've made it static. As such you'll need to go through the IsEqItem function and change that to match your new, inferior, system.
Link to comment
Share on other sites

@Robin:

> Change the equipment position constants in modConstants if you want to change where items appear. It's a very easy to edit system, only having to change a couple of numbers to change the order. I suggest you look into them.
>
> ```
> ' Character consts
> Public Const EqTop As Byte = 200
> Public Const EqLeft As Byte = 12
> Public Const EqOffsetX As Byte = 15
> Public Const EqColumns As Byte = 4
>
> ```
> As for the order, your way of doing things bypasses the original way I handled equipment. It's no longer the dynamic system I have as you've made it static. As such you'll need to go through the IsEqItem function and change that to match your new, inferior, system.

Alright. Thanks Robin, I didn't realize there was constants for this already :)
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...