Need help with a formula I am working on
Well I've been sitting down at my desk for the past 2 hours and I bet the answer is probably easy, but I am trying to work on a formula to tell exactly how many levels are needed to get to the next level on a game I play, Runescape, this is within the rules of the game so I know it shouldn't be a problem. Below is the formula to get the characters combat level. So now I am trying to figure out a formula to see how many levels are needed to get to the next level. I was trying as hard as I could, but I couldn't even get past Melee levels.
Code:
Public Function CalcCombat(Attack As Integer, Defence As Integer, Strength As Integer, HP As Integer, Prayer As Integer, Ranged As Integer, Magic As Integer) As Double
On Error Resume Next
Dim Base As Double, Melee As Double, Mage As Double, Range As Double
Base = ((Defence + HP + Int(Prayer / 2)) * 0.25)
Melee = (Attack + Strength) * 0.325
Range = Int(Ranged * 1.5) * 0.325
Mage = Int(Magic * 1.5) * 0.325
If Melee > Range And Melee > Mage Then
CalcCombat = Int(Melee + Base)
strClass = "Knight"
ElseIf Range > Melee And Range > Mage Then
CalcCombat = Int(Range + Base)
strClass = "Archer"
Else
CalcCombat = Int(Mage + Base)
strClass = "Mage"
End If
End Function
Re: Need help with a formula I am working on
You want to know "how many levels are needed to get to the next level". Besides the fact that one gets confused by the double-use of level, how do you collect levels. What does the storyoard of the game tell you. Not knowing the game we can't even guess.
Looking at your function, you seem to have an idea what to calculate. You use as String-variable(strclass) which isn't declared in or handed over to the function. Why are you declaring the function return as a double although it is calculated like and probably used as an integer.
Re: Need help with a formula I am working on
It is a double because when I first wrote the function, I did not convert the variables to integers. Now what I mean is you 7 separate skills that calculate your combat level. Now based on the levels of your skills, your combat level increases. There is no set number by which your combat increases, because your base can change your level as well. Do you understand?