RTE 9 means exactly what it says. A value is outside of its range.
When the error happens, hover over each value and see which one is causing the RTE.
I know what could be causing the error. If the player doesn’t have a weapon, the WeaponNum is 0 which is outside the range of the Item types (1 to MAX_ITEMS)
This happens both when i have a weapon on and not.
That is exactly what is causing the error here. Could you paste that piece of code into a code tag so we can correct it?
Function GetPlayerDamage(ByVal index As Long) As Long
Dim WeaponNum As Long
' Check for subscript out of range
If IsPlaying(index) = False Or index < 1 Or index > Player_HighIndex Then Exit Function
If GetPlayerEquipment(index, Equipment.Weapon) > 0 Then
If Not GetPlayerEquipmentDur(index, GetPlayerEquipment(index, Equipment.Weapon)) = 0 Or Item(GetPlayerEquipment(index, Equipment.Weapon)).Indestructable = 1 Then
WeaponNum = GetPlayerEquipment(index, Equipment.Weapon)
GetPlayerDamage = 1
'Max = 5 + STRLVL * (STRBONUS + 64) / 64
GetPlayerDamage = 5 + (GetPlayerStat(index, Strength) * (Item(WeaponNum).Data2 + 64) / 64)
The last line before End Function is the highlighted one.