Page 1 of 1

math = fun ...sometimes [Archive] - ForumsHQ

Posted: Wed Jan 01, 2003 3:27 pm
by syntax53
my monster exp dividing formula:





If DatFileVersion = v111j Then

If Monsterrec.ExpMulti = 1 Or Monsterrec.ExpMulti = 0 Then

nBase = SLong2ULong(Monsterrec.Experience)

nBase = Round(nBase / divisor)

If nBase 2147483646 Then nBase = 2147483646

Monsterrec.Experience = ULong2SLong(nBase)

Else

nBase = SLong2ULong(Monsterrec.Experience) * SLong2ULong(Monsterrec.ExpMulti)

nBase = Round(nBase / divisor)

If nBase > 2147483646 Then nBase = 2147483646



tryagain:

nMultiMax = 20

For x = 20 To 65538

If x * 32767 >= nBase Then

nMultiMax = x

Exit For

End If

Next x



nMulti = 1

For x = 3 To nMultiMax

temp = nBase Mod x

If temp = 0 Then nMulti = x

Next x



If nMulti = 1 Then

nBase = nBase - 1

GoTo tryagain:

End If



nBase = nBase / nMulti

If nBase <= 0 Then nBase = 1

Monsterrec.Experience = ULong2SLong(nBase)

Monsterrec.ExpMulti = ULong2SLong(nMulti)

End If

Else

nBase = SLong2ULong(Monsterrec.Experience)

nBase = Round(nBase / divisor)

If nBase <= 0 Then nBase = 1

Monsterrec.Experience = ULong2SLong(nBase)

End If

Re: math = fun ...sometimes [Archive] - ForumsHQ

Posted: Wed Jan 01, 2003 4:05 pm
by Durin
What is that written in? (Nightmare that is)

Re: math = fun ...sometimes [Archive] - ForumsHQ

Posted: Wed Jan 01, 2003 4:14 pm
by syntax53
VB 6

Re: math = fun ...sometimes [Archive] - ForumsHQ

Posted: Wed Jan 01, 2003 6:15 pm
by Locke Cole
Originally posted by syntax53

my monster exp dividing formula:

I haven't used VB in eons, so maybe all that is really needed, but all I do is multiply the ExpMulti by the old Experience field. The check for 1.11j is important tho. =)

Re: math = fun ...sometimes [Archive] - ForumsHQ

Posted: Wed Jan 01, 2003 6:23 pm
by Reckless
how's your term prog coming locke?

Re: math = fun ...sometimes [Archive] - ForumsHQ

Posted: Wed Jan 01, 2003 7:29 pm
by Locke Cole
Originally posted by Reckless

how's your term prog coming locke?

Slow but sure. =) No ETA or anything though, but with 1.11j out I've got more reason to keep plugging away on it. ;)

Re: math = fun ...sometimes [Archive] - ForumsHQ

Posted: Wed Jan 01, 2003 7:36 pm
by Reckless
no kidding....hehe...megapud just isn't gonna cut it much longer

Re: math = fun ...sometimes [Archive] - ForumsHQ

Posted: Wed Jan 01, 2003 9:29 pm
by syntax53
Originally posted by Locke Cole



I haven't used VB in eons, so maybe all that is really needed, but all I do is multiply the ExpMulti by the old Experience field. The check for 1.11j is important tho. =)



yeah that's easy to get how much total exp the monster gives. but i gotta then take that number, do math to it, and then figure out the new best numbers to use for the base and multiplier to write to the dats. that's what all that code is for.



-syn