Author Topic: Loosing exp  (Read 1153 times)

Zydu

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Loosing exp
« on: July 31, 2011, 01:44:13 PM »
So as far as I managed to test newest version of war3source this bug appears randomly on kills. Custom races have nothing to do with it since it also happens on standard races.

When player kills someone he gets message "You received 2 gold." and exp is not mentioned. After this when checking xp status you can see it has been lowered by the amount of exp you were supposed to gain.

I have also tested it with clan sql base but the bug still appears.
 

Ownz

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2437
  • chmod -R 777 *
    • View Profile
    • OwnageClan
Re: Loosing exp
« Reply #1 on: July 31, 2011, 01:46:04 PM »
do you have extra xp by level cvar enabled?

I can confirm that you LOSE xp for making kills and I can see where this is coming from, I just got to find the actual line in the code...

If YOU as level 2 kill a player at lets say level 30 you get lets say 150xp

If they kill you they lose around 150xp

Basically the function is written as (30-2)x=xp so when it goes (2-30)x=xp you go negative...

To fix the problem open Engine_XPGold and change the contents of GiveKillXPCreds to:

Code: [Select]
GiveKillXPCreds(client,playerkilled,bool:headshot,bool:melee)
{
//PrintToChatAll("1");
new race=War3_GetRace(client);
if(race>0){
new killerlevel=War3_GetLevel(client,War3_GetRace(client));
new victimlevel=War3_GetLevel(playerkilled,War3_GetRace(playerkilled));
new leveldiff;

leveldiff=victimlevel-killerlevel;

//check for negitive and assign to 0 so no bonus is awarded
if(leveldiff<0)
{
leveldiff=0;
}

new killxp=W3GetKillXP(client,leveldiff);

new addxp=killxp;
if(headshot) addxp+=((killxp*GetConVarInt(HeadshotXPCvar))/100);
if(melee) addxp+=((killxp*GetConVarInt(MeleeXPCvar))/100);



new String:killaward[64];
Format(killaward,sizeof(killaward),"%T","a kill",client);
W3GiveXPGold(client,XPAwardByKill,addxp,W3GetKillGold(),killaward);
}
}

The above will ensure that no xp is ever removed and that if you kill a player lower level than yourself you get no bonus. In theory you could make your own function here to reward some functional less xp without going negative if you wanted some addational customization.

Zydu

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Re: Loosing exp
« Reply #2 on: July 31, 2011, 01:48:54 PM »
Yes I do and that must be the issue I guess.

Is it fixed in final 1.2.2.9 or must I edit Engine_XPGold myself?

Ownz

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2437
  • chmod -R 777 *
    • View Profile
    • OwnageClan
Re: Loosing exp
« Reply #3 on: July 31, 2011, 01:49:27 PM »
its fixed on the SVN only. and the fix is different from above.