Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Making advanced items
#12
Here's a sub I have to see if you can use an item:

In the item UDT:
Code:
LevelReq As Long
    ClassReq(0 To MAX_CLASSES) As Byte
    StatReq(1 To Stats.Stat_Count - 1) As Byte

Code:
'***************************************
' Check to see if you can use an item
'***************************************
Public Function CanUseItem(ByVal Index As Long, ByVal ItemNum As Long) As Boolean
Dim i As Long

    CanUseItem = False
    
    ' Check for level requirement
    If Item(ItemNum).LevelReq > 0 Then
        ' If there's a level requirement then check if you can use it
        ' Checks if your level is below the req and if so - will exit
        If Current_Level(Index) < Item(ItemNum).LevelReq Then
            SendActionMsg Current_Map(Index), "[Level Req: " & Item(ItemNum).LevelReq & "]", ActionColor, ACTIONMSG_SCREEN, 0, 0, Index
            Exit Function
        End If
    End If
    
    ' Check for class requirement
    ' Will check your current class to the item
    ' If your class is 0 then that means you can not use the item so we exit
    If Item(ItemNum).ClassReq(Current_Class(Index))  0 Then
            If Current_BaseStat(Index, i) < Item(ItemNum).StatReq(i) Then
                SendActionMsg Current_Map(Index), "[" & StatName(i) & " req: " & Item(ItemNum).StatReq(i) & "]", ActionColor, ACTIONMSG_SCREEN, 0, 0, Index
                Exit Function
            End If
        End If
    Next
    
    ' If we get through all the checks it means we can use the item
    CanUseItem = True
End Function
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)