Help regarding to EXP system.
#1

Hello, I'm scripting a EXP system and there is one thing, which I don't know how to make it. Recieving EXP and textdraw are already done.

So basically, when you kill your opponent, you recieve 1 EXP (Experience Point) and it appears in the textdraws like this "EXP: 1", but I want it to appear like "EXP: 1/100" and when a player reaches 100, his current rank changes and then next will be like "EXP: 100/250". How to make it like that?
Reply
#2

Well, after giving player the XP, you can create a variable and a switch and for each rank or level, whatever you got, the required XP gets higher. Something like this:
Код:
new xp;

switch (rank)
{
    case 1: xp = 100;
    case 2: xp = 250;
    case 3: xp = 500;
}
After that you can check if player's XP equals or is higher than the required xp, if yes, you can rank the player up.
Reply
#3

PHP код:
new string[50]; format(stringsizeof string"EXP: 1/%d"NextLevelUp(playerid)); 
And create a function..
PHP код:
NextLevelUp(playerid)
{
    new 
score GetPlayerScore(playerid);
    switch(
score)
    {
        case 
0..100: return 100;
        case 
100..250: return 250;
        
//ect...
    
}

Reply
#4

But I don't want to use it as a GetPlayerScore(playerid);, because there is already a seperated score thingy. There should be like GetPlayerXP or I don't know.

For example If PlayerInfo[playerid][EXP] >= 100) then it should be 100/200 next goal 200 XP
Reply
#5

Quote:
Originally Posted by D1am0nd
Посмотреть сообщение
But I don't want to use it as a GetPlayerScore(playerid);, because there is already a seperated score thingy. There should be like GetPlayerXP or I don't know.

For example If PlayerInfo[playerid][EXP] >= 100) then it should be 100/200 next goal 200 XP
Did you even read what I replied? I explained that.
Reply
#6

i can give you some algorithms
declare a var (string) to get detail in a string so as you can use them in a string,and two more vars to set "out of"
and xp.
format can be done like this
PHP код:

format
(str,sizeof str,"%d/%d",xp,out); 
But before doing that we have to set them to their corresponding values.the value xp changes through out..and var "out" is depended on it.So we can put var xp in a condition so as to get a value for out of.Switch is better method:
PHP код:

switch(xp)
{
 case 
0..99:
{
  
out 100;
}
case 
100..199:
{
  
out 200;
}
//.............
//............
//............

then now do that format statement we seen above.try it in your own method and if that dont work show the code you made with this algorithm.
Tip:
*As you said the var name that stores xp so you can replace var xp with PlayerInfo[playerid][EXP]
*You can make it as a function that returns this string so as you can use them through out.
Reply
#7

Don't bother hard coding arbitrary limits. Find a proper formula that can calculate the amount of required XP for you. The curve can either be linear or exponential, i.e. leveling up is easy with low levels but becomes progressively harder. Excel is your friend. Experiment.
PHP код:
GetRequiredXPForLevel(level)
{
    return 
floatround(floatpower(level1.32) * 100); 

Reply
#8

I was taking an example from this FS > https://sampforum.blast.hk/showthread.php?tid=177743

but the max XP there is 50 and I need to get it higher and higher. 0/50 50/100 100/250 etc

To previous replies: I didn't understand much of that and where to add it..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)