Score left for next rank? -
Face9000 - 15.04.2013
Hello, im wondering if there is any stock to calculate the score left.
I mean: I have a rank system in my server and i wanna show the score left for the next rank: (Ex: Player is rank 1 with 10 score, for be rank 2 you need 15 score, so the score left for rank 2 is 5).
Is possible?
Re: Score left for next rank? -
iJumbo - 15.04.2013
You need more variable to store
like
PlayerCurrenRank
PlayerCurrentScore
PlayerScoreToReach
you can subtract to get the score left
Re: Score left for next rank? -
DaTa[X] - 15.04.2013
yes you need more variable
or
pawn Код:
stock GetScore(playerid)
{
if(GetPlayerScore(playerid) <=0)
{
SendClientMessage(playerid,-1,"0/10");
}
}
Re: Score left for next rank? -
Face9000 - 15.04.2013
Ok, i have currently the rank and the score saved, so i just need to do something like:
pawn Код:
new Float:scoreleft= (float(GetPlayerScore(playerid))/float(pInfo[playerid][Rank]));
...?
Or i have to define what score you need for every rank?
Re: Score left for next rank? -
iJumbo - 15.04.2013
If every rank need a multiplied score to rank up like
rank 1-2 15
rank 2-3 30
you can do
pawn Код:
scoreneeded = pInfo[playerid][Rank] * 2;
scoreleft = GetPlayerScore(playerid) - scoreneeded;
Only if the multiply case
Re: Score left for next rank? -
Face9000 - 15.04.2013
Every rank has a different score needed, like rank 1: 100, rank 2: 200, rank 3: 350 and so on.
Re: Score left for next rank? -
iJumbo - 15.04.2013
And where you store the score needed for rank?
Re: Score left for next rank? -
Vince - 15.04.2013
Generally you would want an increase in rank to be exponentially bigger than the previous rank. So in the beginning you level up faster, but as you get higher in rank it becomes increasingly tougher to achieve the next rank. This keeps the game challenging. You can write an algorithm to calculate that, if you wish.
http://en.wikipedia.org/wiki/Exponential_growth
Re: Score left for next rank? -
Face9000 - 15.04.2013
Quote:
Originally Posted by Vince
Generally you would want an increase in rank to be exponentially bigger than the previous rank. So in the beginning you level up faster, but as you get higher in rank it becomes increasingly tougher to achieve the next rank. This keeps the game challenging. You can write an algorithm to calculate that, if you wish.
http://en.wikipedia.org/wiki/Exponential_growth
|
Yeah i know how the exponential growth works..i'll look on it further.
Quote:
Originally Posted by iJumbo
And where you store the score needed for rank?
|
I don't store it, maybe i have? I store just the current player score and rank.
EDIT: Sei italiano?
Re: Score left for next rank? -
LarzI - 15.04.2013
Quote:
Hello, im wondering if there is any stock to calculate the score left
|
They're called functions - "stock" is just the name of an attribute.
Quote:
I have a rank system in my server and i wanna show the score left for the next rank: (Ex: Player is rank 1 with 10 score, for be rank 2 you need 15 score, so the score left for rank 2 is 5).
|
This is entirely possible by subtracting the player's score from the score needed to achieve next rank. To do this just store all the needed scores in a variable.
When showing the score - simply subtract the score (GetPlayerScore) from the variable.
Example:
pawn Код:
// Globally you've defined the scores needed in an array, e.g.:
new
g_RankScores[] =
{
0, // Rank 1 should be the starting rank, so no score needed for that one
15, // Rank 2 should be at 15 score
// etc.
}
;
// Wherever you're showing the player's needed score to achieve next rank:
new
iNeededScore = ( g_RankScores[ VARIABLE_HOLDING_PLAYER_RANK ] - GetPlayerScore( playerid ))
;
Something like that.