29-12-2007, 06:25 AM
That's pretty close to what I did for my bonus system. Mines a bit sloppier though I think.
This is what it looks like :p
My item/inventory code was changed so the code isn't what it would be for a vanilla mse but you get the point.
This is what it looks like :p
Code:
Function GetPlayerBonusSTR(ByVal Index As Long) As Byte ' get players extra strength from items
Dim ArmorSlot As Byte, HelmSlot As Byte, WeaponSlot As Byte, ShieldSlot As Byte
GetPlayerBonusSTR = 0
' Check for subscript out of range
If IsPlaying(Index) = False Or Index MAX_PLAYERS Then
Exit Function
End If
ArmorSlot = GetPlayerArmorSlot(Index)
HelmSlot = GetPlayerHelmetSlot(Index)
WeaponSlot = GetPlayerWeaponSlot(Index)
ShieldSlot = GetPlayerShieldSlot(Index)
If ArmorSlot > 0 Then GetPlayerBonusSTR = GetPlayerBonusSTR + (Item(ArmorSlot).StrBon)
If HelmSlot > 0 Then GetPlayerBonusSTR = GetPlayerBonusSTR + (Item(HelmSlot).StrBon)
If WeaponSlot > 0 Then GetPlayerBonusSTR = GetPlayerBonusSTR + (Item(WeaponSlot).StrBon)
If ShieldSlot > 0 Then GetPlayerBonusSTR = GetPlayerBonusSTR + (Item(ShieldSlot).StrBon)
If GetPlayerBonusSTR < 0 Then GetPlayerBonusSTR = 0 ' Gotta check, never know :p
End Function
My item/inventory code was changed so the code isn't what it would be for a vanilla mse but you get the point.