AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Mini Help (https://forums.alliedmods.net/showthread.php?t=168343)

Krle 09-27-2011 14:56

Mini Help
 
My infinite level goes like this

player_level[id] * 2 * 75...
So experience for levels goes like this

150, 300, 450, 600...

I want it to be like this...
150, 300, 600, 1200...

But i tought about, like making global variable
new levelratio[33] = 75

And check if player level'd up and then do next

if(player_level[id] ++)
{
levelratio[id] ++
}

but im not shure this would work :|

Erox902 09-27-2011 15:23

Re: Mini Help
 
if(player_level[id] ++)
Well no this will definetly not work,
it says itself you cannot check ++/-- or anything like that in an if statement.

Krle 09-27-2011 15:28

Re: Mini Help
 
So anyway to do it, exept of writing millions of numbers in const?

Erox902 09-27-2011 16:17

Re: Mini Help
 
how do you loop the experince to know when to level up?
just add levelratio[id] ++ in that loop instead of just level up? :?

Krle 09-27-2011 16:44

Re: Mini Help
 
ok i found this
level * 10 * (level / 2)

->

1 * 10 * 1 / 2 = 5
2 * 10 * 2 / 2 = 20
3 * 10 * 3 / 2 = 45
4 * 10 * 4 / 2 = 80
5 * 10 * 5 / 2 = 125
6 * 10 * 6 / 2 = 180
7 * 10 * 7 / 2 = 245
8 * 10 * 8 / 2 = 320
9 * 10 * 9 / 2 = 405
10 * 10 * 10 / 2 = 500
11 * 10 * 11 / 2 = 605
12 * 10 * 12 / 2 = 720
13 * 10 * 13 / 2 = 845
14 * 10 * 14 / 2 = 980
15 * 10 * 15 / 2 = 1125
16 * 10 * 16 / 2 = 1280
17 * 10 * 17 / 2 = 1445
18 * 10 * 18 / 2 = 1620
19 * 10 * 19 / 2 = 1805
20 * 10 * 20 / 2 = 2000

Works :)

Thanks, anyway :)

D.Moder 09-27-2011 23:24

Re: Mini Help
 
use this is better:

#define XPREQ(%1) (150 * power(2, %1))


All times are GMT -4. The time now is 19:34.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.