03-10-2008, 08:29 PM
ItemRec
Added the array to hold any values for modified stats / vitals.
The following function will go though all your equipment and add up any stats plus the base stat value.
The following function will go though all your equipment and add up any vitals plus the base vital value.
Just using the new modStat and modVital to calculate the max vitals.
Just using the new modStat and modVital to calculate the max vitals.
You'll have to change "Current_" to "GetPlayer".
I was just messing around on how to do stats on equipment.
Added the array to hold any values for modified stats / vitals.
Code:
Type ItemRec
Name As String * NAME_LENGTH
Pic As Integer
Type As Byte
Data1 As Integer
Data2 As Integer
Data3 As Integer
ModVital(1 To Vitals.Vital_Count - 1) As Long
ModStat(1 To Stats.Stat_Count - 1) As Long
End Type
The following function will go though all your equipment and add up any stats plus the base stat value.
Code:
'***************************************
' Calculate current modified stats
'***************************************
Public Function Current_ModStat(ByVal Index As Long, ByVal Stat As Stats) As Long
Dim i As Long, ItemNum As Long
Current_ModStat = Current_Stat(Index, Stat)
For i = 1 To Equipment.Equipment_Count - 1
If Current_EquipmentSlot(Index, i) > 0 Then
Current_ModStat = Current_ModStat + Item(Current_InvItemNum(Index, Current_EquipmentSlot(Index, i))).ModStat(Stat)
End If
Next
End Function
The following function will go though all your equipment and add up any vitals plus the base vital value.
Code:
'***************************************
' Calculate current modified vitals
'***************************************
Public Function Current_ModVital(ByVal Index As Long, ByVal Vital As Vitals) As Long
Dim i As Long, ItemNum As Long
Current_ModVital = 0
For i = 1 To Equipment.Equipment_Count - 1
If Current_EquipmentSlot(Index, i) > 0 Then
Current_ModVital = Current_ModVital + Item(Current_InvItemNum(Index, Current_EquipmentSlot(Index, i))).ModVital(Vital)
End If
Next
End Function
Just using the new modStat and modVital to calculate the max vitals.
Code:
'***************************************
' Calculate Max Vital
'***************************************
Public Function Current_MaxVital(ByVal Index As Long, ByVal Vital As Vitals) As Long
Select Case Vital
Case HP
Current_MaxVital = (Current_Level(Index) + Int(Current_ModStat(Index, Stats.Strength) / 2) + Class(Current_Class(Index)).Stat(Stats.Strength)) * 2
Case MP
Current_MaxVital = (Current_Level(Index) + Int(Current_ModStat(Index, Stats.Magic) / 2) + Class(Current_Class(Index)).Stat(Stats.Magic)) * 2
Case SP
Current_MaxVital = (Current_Level(Index) + Int(Current_ModStat(Index, Stats.Speed) / 2) + Class(Current_Class(Index)).Stat(Stats.Speed)) * 2
End Select
Current_MaxVital = Current_MaxVital + Current_ModVital(Index, Vital)
End Function
Just using the new modStat and modVital to calculate the max vitals.
Code:
'***************************************
' Calculate base damage
'***************************************
Public Function Current_Damage(ByVal Index As Long) As Long
Current_Damage = 0
' Check for subscript out of range
If IsPlaying(Index) = False Or Index MAX_PLAYERS Then
Exit Function
End If
Current_Damage = Int(Current_ModStat(Index, Stats.Strength) / 2)
If Current_Damage 0 Then
Current_Damage = Current_Damage + Item(Current_InvItemNum(Index, Current_EquipmentSlot(Index, Weapon))).Data2
End If
End Function
You'll have to change "Current_" to "GetPlayer".
I was just messing around on how to do stats on equipment.