Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Cant figure this formula out. (https://forums.graalonline.com/forums/showthread.php?t=80910)

wild8900 07-28-2008 01:31 PM

Cant figure this formula out.
 
So I slept through this chapter in math class (Really I did, when I looked at this pattern I KNEW I remembered it somewhere)
I need to write a experience system formula but to find the exp of the next level. Something like clientr.nextlvl=7+((clientr.level*2)+1);
Obviously thats wrong but its as close as I got...
Heres how I wanted to have it progress as you level:
NPC Code:

level1 - 7
+3
level2 - 10
+5
level3 - 15
+7
level4 - 22
+9
level5 - 31
+11
level6 - 42
+13
level7 - 55


DustyPorViva 07-28-2008 01:47 PM

clientr.nextlvl= 7 + clientr.level^2 - 1;

wild8900 07-28-2008 01:51 PM

Thanks a TON. n_n

napo_p2p 07-28-2008 07:38 PM

See what happens when you sleep during class? :asleep:

DrakilorP2P 07-28-2008 09:11 PM

Most character level systems I've read use a predefined list. Usually there aren't going to be more than a hundred levels anyway, so constructing the list isn't particularly tedious.

zokemon 07-28-2008 09:17 PM

Quote:

Originally Posted by DustyPorViva (Post 1409293)
clientr.nextlvl= 7 + clientr.level^2 - 1;

So 6 + clientr.level^2? lol

Crow 07-28-2008 09:27 PM

Quote:

Originally Posted by zokemon (Post 1409376)
So 6 + clientr.level^2? lol

I counter such things pretty often, and I often have to choose between making a more simple formula or one that makes more sense (when looking at things belonging to the formula) and I usually choose the latter. I would use Dusty's formula.

DustyPorViva 07-28-2008 10:25 PM

Quote:

Originally Posted by zokemon (Post 1409376)
So 6 + clientr.level^2? lol

Good point! I flunked math... though he wanted a base of 7, so...

wild8900 07-29-2008 12:49 AM

lol Dusty's was fine, works exactly like I wanted to. I even learned something (sorta).

LoneAngelIbesu 07-29-2008 12:58 AM

They both do the same thing. ^^ One just does it with less operations (Zero's).

zokemon 07-29-2008 06:28 PM

It makes more sense to use less operations when it comes to algorithms. You can always put the original, unsimplified algorithm in a comment on the side.

wild8900 07-30-2008 03:44 AM

Im having more problems with formulas. Im trying to get the maxhp to be itself + a percentage of it per each point of vitality. The way I have it setup now adds on the percentage each time you add to vitality manually. At level 1 your maxhp is 100 so I guess the base is 100.
clientr.maxhp=int(clientr.maxhp+(clientr.maxhp*0.0 8));
What I'm aiming for a script to check it and adjust it automatically which if I used my formula it would increase nonstop...

Switch 07-30-2008 04:33 AM

Quote:

Originally Posted by wild8900 (Post 1409699)
Im having more problems with formulas. Im trying to get the maxhp to be itself + a percentage of it per each point of vitality. The way I have it setup now adds on the percentage each time you add to vitality manually. At level 1 your maxhp is 100 so I guess the base is 100.
clientr.maxhp=int(clientr.maxhp+(clientr.maxhp*0.0 8));
What I'm aiming for a script to check it and adjust it automatically which if I used my formula it would increase nonstop...

You need to have the stats (vitality) determine part of it.
For example
clientr.maxhp=int(clientr.vitality*5*2+(clientr.vi tality*0.08));
If you start with 10 vitality, this'd equal 100hp (I forget if int rounds xD)
Then with 11 vitality it'd be 110
Then with 12 vitality it'd be 120
Then with 13 vitality it'd be 131
etc.
You can't have clientr.maxhp part of it because that's a loop.
How much do you want the HP to go up by, though? That's the real issue.

Edit:
clientr.maxhp=int(100*player.level+(clientr.vitali ty*0.08));
Base = 100 so that should work. xD
You'd need more than 8 percent for the vitality to take effect.

Edit 2:
You'd need to have an "onVitalityUp()" for each time vitality goes up so you can use clientr.maxhp as a percentage without looping.

DrakilorP2P 07-30-2008 01:23 PM

People who got C in elementary mathematics ITT.

Crow 07-30-2008 01:47 PM

Quote:

Originally Posted by drakilorp2p (Post 1409808)
people who got c in elementary mathematics itt.

Hehe :D


All times are GMT +2. The time now is 05:36 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.