SRL Archive - Research & Development Lounge

Calculate combat


jhildy

2007-09-16 02:00:26

{********************************************}
{Function CalculateCombat(A,S,D,H,P,R,M: integer): extended;
This will calculate your combat level as close as possible. A stands
for attack, S for strength, D for defence, H for hitpoints, P for
prayer, R for range, and M for mage.
By: jhildy
{********************************************}
Function CalculateCombat(A,S,D,H,P,R,M: integer): extended;
var L: array [0..6] of extended;
var Base,melee,range,mage: extended;
begin
L[0]:=D*100;
L[1]:=H*100;
if p mod 2 = 0 then
l[2]:=P*50
else if p mod 2 <> 0 then
l[2]:=(p-1)*50;
Base:=(l[0]+l[1]+l[2])/400;
l[3]:=A*130;
l[4]:=s*130;
if r mod 2 = 0 then
l[5]:=r*195
else if r mod 2 <> 0 then
l[5]:= (((r-1)+(r*2))*65);
if m mod 2 = 0 then
l[6]:=m*195
else if m mod 2 <> 0 then
l[6]:=(((m-1)+(m*2))*65);
melee:=(l[3]+l[4])/400;
range:=l[5]/400;
mage:=l[6]/400;
if (melee > range) and (melee > mage) then
result:=melee+base
else if (range > melee) and (range > mage) then
result:=range+base
else if (mage > melee) and (mage > range) then
result:=mage+base
end;
there you go calculates combat as exact as possible.

Bourdou!

2007-09-16 02:08:33

Nice! Combat is supposed to be super hard to calculate?

jhildy

2007-09-16 02:11:56

it was on the runescape forums how to i just put it in scar terms.

BobboHobbo

2007-09-16 05:34:18

Nice man! looks like a bunch of letters an numbers to me though :*(

~alex~

2007-09-16 06:56:58

Ooo very nice. Is this the official formula or a player-made one?

King of Knives

2007-09-16 10:46:30

I know this is impossible, but still:
Writeln(FloatToStr(CalculateCombat(1,99,99,99,99,99,99)))
That writes out 0? Why?

But a very nice script :D Thumbs up

-Knives

jhildy

2007-09-16 10:53:33

well idk i havn't figured out the bugs but this is the official formula taken from the runescape forums.

Buckleyindahouse

2007-09-16 11:29:10

Wow, worked for me. I put in my exact tank ranger stats and it told me his cmb lvl which was correct. Very nice work :D.

Lalaji

2007-09-16 11:43:25

Very Nice!!