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

Show more stat requirements/benefits!


Braiton
 Share

Recommended Posts

Alright, this was an easy, but long edit to do. Partially because every item type returned a different value and debugging and finding that value took some time. (Although it was not much, it was annoying :p)

I decided to do this because i was tired of explaining what the item did, or if it had anything in special, in the item description, etc.

Anyway, its all client side.

First go to frmMirage and make the item description box larger. Then anywhere add 4 labels. Name them: descDmg, descDur, descAspd and descClass.

Now you might guess what each one does.
descDmg = Will return the power/protection value of the item
descDur = Will return the Durability of the item
descAspd = Will return the attacking speed of the item
descClass = Will return the class required to wield the item.

Now lets move onto the code.
Everything takes place in frmMirage. In frmMirage go into MouseMove. (Of course! When we move the mouse over the item the item desc menu will pop up. Its pretty much common sense)

Anyway, find this:
```
        descStr.Caption = Item(GetPlayerInvItemNum(MyIndex, d + 1)).StrReq & " " & STAT1
        descDef.Caption = Item(GetPlayerInvItemNum(MyIndex, d + 1)).DefReq & " " & STAT2
        descSpeed.Caption = Item(GetPlayerInvItemNum(MyIndex, d + 1)).SpeedReq & " " & STAT3
        descMagic.Caption = Item(GetPlayerInvItemNum(MyIndex, d + 1)).MagicReq & " " & STAT4
        descHpMp.Caption = "HP: " & Item(GetPlayerInvItemNum(MyIndex, d + 1)).AddHP & " MP: " & Item(GetPlayerInvItemNum(MyIndex, d + 1)).AddMP & " SP: " & Item(GetPlayerInvItemNum(MyIndex, d + 1)).AddSP
        descSD.Caption = STAT1 & ": " & Item(GetPlayerInvItemNum(MyIndex, d + 1)).AddSTR & " " & STAT2 & ": " & Item(GetPlayerInvItemNum(MyIndex, d + 1)).AddDEF
        descMS.Caption = STAT3 & ": " & Item(GetPlayerInvItemNum(MyIndex, d + 1)).AddMAGI & " " & STAT4 & ": " & Item(GetPlayerInvItemNum(MyIndex, d + 1)).AddSpeed
        desc.Caption = Trim$(Item(GetPlayerInvItemNum(MyIndex, d + 1)).desc)
```
Under that add the following:

```
        If Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type = ITEM_TYPE_WEAPON Or Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type = ITEM_TYPE_NECKLACE Or Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type = ITEM_TYPE_RING Or Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type = ITEM_TYPE_TWO_HAND Then
        descDmg.Caption = "Power: " & Item(GetPlayerInvItemNum(MyIndex, d + 1)).Data2
        ElseIf Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type >= ITEM_TYPE_ARMOR And Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type <= ITEM_TYPE_LEGS Then
        descDmg.Caption = "Protection: " & Item(GetPlayerInvItemNum(MyIndex, d + 1)).Data2
    Else
        descDmg.Caption = vbNullString
    End If
```
This is the Power/Protection part. What this does is check if the item type is weapon, two handed weapon, ring or necklace and then return its power. If the item is an armor type, etc. it will return the Protection value instead.

Now moving into the Durabilty part: Below add:

```
    'Since Potions, spells, etc, dont have durability, in fact, the ammount you set the potion to recover, or the spell id you set it too is gonna be the number of durability, we are gonna take advantage of it and make it say how much you'll recover.
    If Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type = ITEM_TYPE_POTIONADDHP Or Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type = ITEM_TYPE_POTIONADDMP Or Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type = ITEM_TYPE_POTIONADDSP Then
    descDur.Caption = "Recovers: " & Item(GetPlayerInvItemNum(MyIndex, d + 1)).Data1
    ElseIf Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type = ITEM_TYPE_POTIONSUBHP Or Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type = ITEM_TYPE_POTIONSUBMP Or Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type = ITEM_TYPE_POTIONSUBSP Then
    descDur.Caption = "Takes away: " & Item(GetPlayerInvItemNum(MyIndex, d + 1)).Data1
    ElseIf Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type = ITEM_TYPE_SPELL Or Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type = ITEM_TYPE_CURRENCY Or Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type = ITEM_TYPE_SCRIPTED Then
    descDur.Caption = vbNullString
    ElseIf Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type = ITEM_TYPE_KEY Then
    descDur.Caption = "Destroyed upon use"
    ElseIf Item(GetPlayerInvItemNum(MyIndex, d + 1)).Data1 = -1 Then
    descDur.Caption = "Durability: Indestructible"
    ElseIf Item(GetPlayerInvItemNum(MyIndex, d + 1)).Data1 <> -1 Then
    descDur.Caption = "Durability: " & Item(GetPlayerInvItemNum(MyIndex, d + 1)).Data1
    End If
```
Well, i guess you can easly guess what's going on by reading but ill explain anyway. If you read the comment i made youll see what i mean. Anyway, what this does is:
*If the item is a potion: it returns how much it will recover
*If the item is a Sub potion: it returns how much damage it will make
*If the item is a key: it returns text, for example: Destroyed Upon Use
*If the item is a spell item (to learn), currency, etc: Its Null - wont return anything
-The rest of the items can be destroyed so we check if the item's dur is -1\. If its -1 then it can't be destroyed. Else, if its different it will return the Actual Value of its durability.

Now the next piece of code:

This one is probably the easiest: Below add:

```
    If Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type >= ITEM_TYPE_WEAPON And Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type <= ITEM_TYPE_NECKLACE Then
    descAspd.Caption = "Attack Speed: " & Item(GetPlayerInvItemNum(MyIndex, d + 1)).AttackSpeed
    Else
    descAspd.Caption = vbNullString
    End If
```
Do i really need to explain? It will check for the items that have an attack speed modifier and then return its value. If the item doesnt modify the speed, then it wont return anything.

Now for the last section:
Below add:

```
Dim C0 As String
Dim C1 As String
Dim C2 As String
Dim C3 As String
Dim C4 As String
Dim UA As String

C0 = "Class 0"
C1 = "Class 1"
C2 = "Class 2"
C3 = "Class 3"
C4 = "Class 4"
UA = "Usable by All"

'Check for first class
'NOTE: Theres a problem with keys, currency, etc being assigned to class 0 instead of -1 so we gotta check if they are different.
If Item(GetPlayerInvItemNum(MyIndex, d + 1)).ClassReq = 0 And Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type <> ITEM_TYPE_CURRENCY And Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type <> ITEM_TYPE_KEY And Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type <> ITEM_TYPE_SPELL Then
descClass.Caption = "Class Required: " & C0
ElseIf Item(GetPlayerInvItemNum(MyIndex, d + 1)).ClassReq = -1 Then
descClass.Caption = "Class Required: " & UA
ElseIf Item(GetPlayerInvItemNum(MyIndex, d + 1)).ClassReq = 1 Then
descClass.Caption = "Class Required: " & C1
ElseIf Item(GetPlayerInvItemNum(MyIndex, d + 1)).ClassReq = 2 Then
descClass.Caption = "Class Required: " & C2
ElseIf Item(GetPlayerInvItemNum(MyIndex, d + 1)).ClassReq = 3 Then
descClass.Caption = "Class Required: " & C3
ElseIf Item(GetPlayerInvItemNum(MyIndex, d + 1)).ClassReq = 4 Then
descClass.Caption = "Class Required: " & C4
Else
descClass.Caption = vbNullString
End If
```
If you want it to return a class number instead of text simply do this:

```
descClass.Caption = "Class Required: " & Item(GetPlayerInvItemNum(MyIndex, d + 1)).ClassReq
```
PS: Dont get bitchy at me for saving C0, etc. I tend to use it a lot and i prefer directly writing two letters than writing the whole name each time. Anyway, you might alter this.
You might have to change this to add or take away the number of classes. You are gonna have to change it also to suit your class name.

If you did everything right, you should see this:
![](http://i44.tinypic.com/264j9jl.jpg)

I tested it a few times and couldn't find any errors. If you do, please send them my way!

Regards,
Braiton
Link to comment
Share on other sites

Great tutorial.Just have a little problem i think i can fix if i search just gonna announce it anyway,even if i make the description thing bigger when i put my mouse on a wep or armor only then first 2 parts(requirement and additional benifit show up)but if i put the label a bit up the labels work so there s probebly somwhere in code a specifique size for itemdesc when it s for a wep

edit:ok found it picInv_MouseMove the size for specifique items should be removed or well changed(just trying to help)
Link to comment
Share on other sites

Yea, i kinda assumed people would know how to change the size, but anyway, in the same module (frmMirage)

Search for
```
Private Sub picInv_MouseMove
```
and a few lines below you should see

```
    If Player(MyIndex).Inv(d + 1).num > 0 Then
        If Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type = ITEM_TYPE_CURRENCY Or Item(GetPlayerInvItemNum(MyIndex, d + 1)).Stackable = 1 Then
            If Trim$(Item(GetPlayerInvItemNum(MyIndex, d + 1)).desc) = vbNullString Then
                itmDesc.Top = X
                itmDesc.Height = X
            Else
                itmDesc.Top = X
                itmDesc.Height = X
            End If
        Else
            If Trim$(Item(GetPlayerInvItemNum(MyIndex, d + 1)).desc) = vbNullString Then
                itmDesc.Top = X
                itmDesc.Height = X
            Else
                itmDesc.Top = X
                itmDesc.Height = X
            End If
        End If
```
Its pretty much common sense now. Just change the height to a bigger value. You can also alter it to show the size bigger when its a weapon, etc. and to show it smaller when its a key, or currency that doesnt need all that space.

EDIT: Oh, didn't see you could resolve it. Anyway, im leaving this up just in case someone else encounters the same problem.
Link to comment
Share on other sites

For some reason, I'm occasionally getting Run-time error '9' when I edit items after I implemented this. Sometimes I can manage to edit the item, but the game ultimately crashes with run-time error '9'. Here's my code:

```
Private Sub picInv_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, y As Single)
    Dim d As Long
    d = Index

    If Player(MyIndex).Inv(d + 1).num > 0 Then
        If Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type = ITEM_TYPE_CURRENCY Or Item(GetPlayerInvItemNum(MyIndex, d + 1)).Stackable = 1 Then
            If Trim$(Item(GetPlayerInvItemNum(MyIndex, d + 1)).desc) = vbNullString Then
                itmDesc.Top = 224
                itmDesc.Height = 17
            Else
                itmDesc.Top = 8
                itmDesc.Height = 321
            End If
        Else
            If Trim$(Item(GetPlayerInvItemNum(MyIndex, d + 1)).desc) = vbNullString Then
                itmDesc.Top = 96
                itmDesc.Height = 209
            Else
                itmDesc.Top = 8
                itmDesc.Height = 321
            End If
        End If
        If Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type = ITEM_TYPE_CURRENCY Or Item(GetPlayerInvItemNum(MyIndex, d + 1)).Stackable = 1 Then
            descName.Caption = Trim$(Item(GetPlayerInvItemNum(MyIndex, d + 1)).Name) & " (" & GetPlayerInvItemValue(MyIndex, d + 1) & ")"
        Else
            If GetPlayerWeaponSlot(MyIndex) = d + 1 Then
                descName.Caption = Trim$(Item(GetPlayerInvItemNum(MyIndex, d + 1)).Name) & " (Worn)"
            ElseIf GetPlayerArmorSlot(MyIndex) = d + 1 Then
                descName.Caption = Trim$(Item(GetPlayerInvItemNum(MyIndex, d + 1)).Name) & " (Worn)"
            ElseIf GetPlayerHelmetSlot(MyIndex) = d + 1 Then
                descName.Caption = Trim$(Item(GetPlayerInvItemNum(MyIndex, d + 1)).Name) & " (Worn)"
            ElseIf GetPlayerShieldSlot(MyIndex) = d + 1 Then
                descName.Caption = Trim$(Item(GetPlayerInvItemNum(MyIndex, d + 1)).Name) & " (Worn)"
            ElseIf GetPlayerLegsSlot(MyIndex) = d + 1 Then
                descName.Caption = Trim$(Item(GetPlayerInvItemNum(MyIndex, d + 1)).Name) & " (Worn)"
            ElseIf GetPlayerRingSlot(MyIndex) = d + 1 Then
                descName.Caption = Trim$(Item(GetPlayerInvItemNum(MyIndex, d + 1)).Name) & " (Worn)"
            ElseIf GetPlayerNecklaceSlot(MyIndex) = d + 1 Then
                descName.Caption = Trim$(Item(GetPlayerInvItemNum(MyIndex, d + 1)).Name) & " (Worn)"
            Else
                descName.Caption = Trim$(Item(GetPlayerInvItemNum(MyIndex, d + 1)).Name)
            End If
        End If

        descStr.Caption = Item(GetPlayerInvItemNum(MyIndex, d + 1)).StrReq & " " & STAT1
        descDef.Caption = Item(GetPlayerInvItemNum(MyIndex, d + 1)).DefReq & " " & STAT2
        descSpeed.Caption = Item(GetPlayerInvItemNum(MyIndex, d + 1)).SpeedReq & " " & STAT3
        descMagic.Caption = Item(GetPlayerInvItemNum(MyIndex, d + 1)).MagicReq & " " & STAT4
        descHpMp.Caption = "HP: " & Item(GetPlayerInvItemNum(MyIndex, d + 1)).AddHP & " MP: " & Item(GetPlayerInvItemNum(MyIndex, d + 1)).AddMP & " SP: " & Item(GetPlayerInvItemNum(MyIndex, d + 1)).AddSP
        descSD.Caption = STAT1 & ": " & Item(GetPlayerInvItemNum(MyIndex, d + 1)).AddSTR & " " & STAT2 & ": " & Item(GetPlayerInvItemNum(MyIndex, d + 1)).AddDEF
        descMS.Caption = STAT3 & ": " & Item(GetPlayerInvItemNum(MyIndex, d + 1)).AddMAGI & " " & STAT4 & ": " & Item(GetPlayerInvItemNum(MyIndex, d + 1)).AddSpeed
        desc.Caption = Trim$(Item(GetPlayerInvItemNum(MyIndex, d + 1)).desc)

        itmDesc.Visible = True
    Else
        itmDesc.Visible = False
    End If

'Adds Attack Speed

    If Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type >= ITEM_TYPE_WEAPON And Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type <= ITEM_TYPE_NECKLACE Then
    descAspd.Caption = "Attack Speed: " & Item(GetPlayerInvItemNum(MyIndex, d + 1)).AttackSpeed
    Else
    descAspd.Caption = "Attack Speed: N/A"
    End If

Dim C0 As String
Dim C1 As String
Dim C2 As String
Dim C3 As String
Dim C4 As String
Dim C5 As String
Dim UA As String

C0 = "Class 1"
C1 = "Class 2"
C2 = "Class 3"
C3 = "Class 4"
C4 = "Class 5"
C5 = "Class 6"
UA = "None"

'Check for first class
'NOTE: Theres a problem with keys, currency, etc being assigned to class 0 instead of -1 so we gotta check if they are different.
If Item(GetPlayerInvItemNum(MyIndex, d + 1)).ClassReq = 0 And Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type <> ITEM_TYPE_CURRENCY And Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type <> ITEM_TYPE_KEY And Item(GetPlayerInvItemNum(MyIndex, d + 1)).Type <> ITEM_TYPE_SPELL Then
descClass.Caption = "Class Required: " & C0
ElseIf Item(GetPlayerInvItemNum(MyIndex, d + 1)).ClassReq = -1 Then
descClass.Caption = "Class Required: " & UA
ElseIf Item(GetPlayerInvItemNum(MyIndex, d + 1)).ClassReq = 1 Then
descClass.Caption = "Class Required: " & C1
ElseIf Item(GetPlayerInvItemNum(MyIndex, d + 1)).ClassReq = 2 Then
descClass.Caption = "Class Required: " & C2
ElseIf Item(GetPlayerInvItemNum(MyIndex, d + 1)).ClassReq = 3 Then
descClass.Caption = "Class Required: " & C3
ElseIf Item(GetPlayerInvItemNum(MyIndex, d + 1)).ClassReq = 4 Then
descClass.Caption = "Class Required: " & C4
ElseIf Item(GetPlayerInvItemNum(MyIndex, d + 1)).ClassReq = 5 Then
descClass.Caption = "Class Required: " & C5
Else
descClass.Caption = "None"
End If

End Sub
```
Link to comment
Share on other sites

Works fine for me. Maybe you changed something in the item that you shouldnt. I used to get that error when editing items before making this code when editing certain items but i fixed em. Try deleting the item's .dat file and then making it again.
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...