zeiksz2
01-11-2008, 11:29 PM
getting xp was a fabled thing those days i was playing. ya never knew how much you get, never knew how much to be done.. so here you go with some detailed xp.
description:
after "you gain experience/group xp" line you get line for xp and if needed aa xp. you get info that what kind of xp it is (normal or aa) then the amount then how much you are to do to gain a level and then how much of this exp gain you need to do the level.
example:
you gain experience!
normal: 10 (to go: 20 (2 from this)) - means you got 10 xp and you are to get 2 times 10 xp more to do the level.
//we get xp or group xp, so we set up message
if(this->IsGrouped())
this->Message_StringID(15,GAIN_GROUPXP);
else
this->Message_StringID(15,GAIN_XP);
********* start
//and we continue with some details..
char szoveg [256];
if (set_exp>m_pp.exp)
{
char ding [128];
int togo = GetEXPForLevel(GetLevel()+1)-set_exp;
//gain of normal xp
if (togo<0)
{
snprintf(ding,128,"%s","DING!");
} else {
if (togo/(set_exp-m_pp.exp)<10000)
{
snprintf(ding,128,"to go: %i (%i from this)",togo,togo/(set_exp-m_pp.exp));
} else {
snprintf(ding,128,"to go: %i (way to go)",togo);
}
}
//no ding on max level - replace 65 with the function
if (GetLevel()!=65)
{
snprintf(szoveg,256,"Normal: %i(%s)",set_exp-m_pp.exp,(char*)ding);
Message(15,(char*)szoveg);
}
}
if (set_aaxp>m_pp.expAA)
{
char ding2 [128];
int togo2 = max_AAXP-set_aaxp;
//gain of aa xp
if (togo2<0)
{
snprintf(ding2,128,"%s","DING!");
} else {
if (togo2/(set_aaxp-m_pp.expAA)<10000)
{
snprintf(ding2,128,"to go: %i (%i from this)",togo2,togo2/(set_aaxp-m_pp.expAA));
} else {
snprintf(ding2,128,"to go: %i (way to go)",togo2);
}
}
snprintf(szoveg,256,"AA: %i(%s)",set_aaxp-m_pp.expAA,(char*)ding2);
Message(15,(char*)szoveg);
}
}
}
******** end
else if((set_exp + set_aaxp) < (m_pp.exp+m_pp.expAA)){ //only loss message if you lose exp, no message if you gained/lost nothing.
Message(15, "You have lost experience.");
}
my questions - in what i like to get help:
- how to get the level cap? (what function?) i placed a simple 65 into code
- just my second code in c, so ... dumb newbie question: how to round UP numbers? if you see the code you will see that the (from this) values are rounded down - so you may get message 10xp "(to go: 1 (0 from this))"
description:
after "you gain experience/group xp" line you get line for xp and if needed aa xp. you get info that what kind of xp it is (normal or aa) then the amount then how much you are to do to gain a level and then how much of this exp gain you need to do the level.
example:
you gain experience!
normal: 10 (to go: 20 (2 from this)) - means you got 10 xp and you are to get 2 times 10 xp more to do the level.
//we get xp or group xp, so we set up message
if(this->IsGrouped())
this->Message_StringID(15,GAIN_GROUPXP);
else
this->Message_StringID(15,GAIN_XP);
********* start
//and we continue with some details..
char szoveg [256];
if (set_exp>m_pp.exp)
{
char ding [128];
int togo = GetEXPForLevel(GetLevel()+1)-set_exp;
//gain of normal xp
if (togo<0)
{
snprintf(ding,128,"%s","DING!");
} else {
if (togo/(set_exp-m_pp.exp)<10000)
{
snprintf(ding,128,"to go: %i (%i from this)",togo,togo/(set_exp-m_pp.exp));
} else {
snprintf(ding,128,"to go: %i (way to go)",togo);
}
}
//no ding on max level - replace 65 with the function
if (GetLevel()!=65)
{
snprintf(szoveg,256,"Normal: %i(%s)",set_exp-m_pp.exp,(char*)ding);
Message(15,(char*)szoveg);
}
}
if (set_aaxp>m_pp.expAA)
{
char ding2 [128];
int togo2 = max_AAXP-set_aaxp;
//gain of aa xp
if (togo2<0)
{
snprintf(ding2,128,"%s","DING!");
} else {
if (togo2/(set_aaxp-m_pp.expAA)<10000)
{
snprintf(ding2,128,"to go: %i (%i from this)",togo2,togo2/(set_aaxp-m_pp.expAA));
} else {
snprintf(ding2,128,"to go: %i (way to go)",togo2);
}
}
snprintf(szoveg,256,"AA: %i(%s)",set_aaxp-m_pp.expAA,(char*)ding2);
Message(15,(char*)szoveg);
}
}
}
******** end
else if((set_exp + set_aaxp) < (m_pp.exp+m_pp.expAA)){ //only loss message if you lose exp, no message if you gained/lost nothing.
Message(15, "You have lost experience.");
}
my questions - in what i like to get help:
- how to get the level cap? (what function?) i placed a simple 65 into code
- just my second code in c, so ... dumb newbie question: how to round UP numbers? if you see the code you will see that the (from this) values are rounded down - so you may get message 10xp "(to go: 1 (0 from this))"