HTML Code:
#define ADD_EXP_PER_KILL 30
#define MAX_LEVEL 30
Operation:
Required experience for Level2: 30
Required experience for Level3: 90 (Previous level required exp + 30 x Previous Level)
Required experience for Level4: 180 (Previous level required exp + 30 x Previous Level)
Required experience for Level5: 300 (Previous level required exp + ADD_EXP_PER_KILL x Previous Level)
so
Required kill for level2: 1
Required kill for level3: 1+2 = total 3
Required kill for level4: 1+2+3 = total 6
Required kill for level5: 1+2+3+4 = total 10
HTML Code:
if(currentExp >= 30 && currentExp < 90) {
p_Level[id] = 2
} else if(currentExp >= 90 && currentExp < 180) {
p_Level[id] = 3
} else if(currentExp >= 180 && currentExp < 300) {
p_Level[id] = 4
} else if(currentExp >= 300 && currentExp < 450) {
p_Level[id] = 5
} else if(currentExp >= 450 && currentExp < 630) {
p_Level[id] = 6
} else if(currentExp >= 630 && currentExp < 840) {
p_Level[id] = 7
} else if(currentExp >= 840 && currentExp < 1080) {
p_Level[id] = 8
} else if(currentExp >= 1080 && currentExp < 1350) {
p_Level[id] = 9
} else if(currentExp >= 1350 && currentExp < 1650) {
p_Level[id] = 10
} else if(currentExp >= 1650 && currentExp < 1980) {
p_Level[id] = 11
} else if(currentExp >= 1980 && currentExp < 2340) {
p_Level[id] = 12
} else if(currentExp >= 2340 && currentExp < 2730) {
p_Level[id] = 13
} else if(currentExp >= 2730 && currentExp < 3150) {
p_Level[id] = 14
} else if(currentExp >= 3150 && currentExp < 3600) {
p_Level[id] = 15
} else if(currentExp >= 3600 && currentExp < 4080) {
p_Level[id] = 16
} else if(currentExp >= 4080 && currentExp < 4590) {
p_Level[id] = 17
} else if(currentExp >= 4590 && currentExp < 5130) {
p_Level[id] = 18
} else if(currentExp >= 5130 && currentExp < 5700) {
p_Level[id] = 19
} else if(currentExp >= 5700 && currentExp < 6300) {
p_Level[id] = 20
} else if(currentExp >= 6300 && currentExp < 6930) {
p_Level[id] = 21
} else if(currentExp >= 6930 && currentExp < 7590) {
p_Level[id] = 22
} else if(currentExp >= 7590 && currentExp < 8280) {
p_Level[id] = 23
} else if(currentExp >= 8280 && currentExp < 9000) {
p_Level[id] = 24
} else if(currentExp >= 9000 && currentExp < 9750) {
p_Level[id] = 25
} else if(currentExp >= 9750 && currentExp < 10530) {
p_Level[id] = 26
} else if(currentExp >= 10530 && currentExp < 11340) {
p_Level[id] = 27
} else if(currentExp >= 11340 && currentExp < 12180) {
p_Level[id] = 28
} else if(currentExp >= 12180 && currentExp < 13050) {
p_Level[id] = 29
} else if(currentExp >= 13050) {
p_Level[id] = 30
}
Must be:
HTML Code:
#define MAX_LEVEL 30
public levelControl(id) {
for(new i = 1; i <= MAX_LEVEL; i++) {
//algorithm
p_Level[i]
break;
}
}
Help me, i couldn't calculate its algorithm