Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Equip Bonus System
#5
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

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.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)