Whoa! Deep! Thanks:) (nt):

[ Follow Ups ] [ Post Followup ] [ Dioxide's CForum ]

Posted by Strelno on September 6, 2000 at 19:29:39:

In Reply to: well here is some actual code of how xp is calculated and an explanation of how it works. posted by pintose on September 6, 2000 at 19:17:33:

> This is the code that was used for computing it in first or second age, taken from the nevernever land code base. they have definentaly altered it slightly so that if the level range is greater then a certain number the experience is drastically reduced. But the tank does not get more exp, it is random how much each player gets cause it is computed for each individual person those of you who code will better under stand this so i will sumerize it

> the level range is the level of the victim minus the level of the killer. this is then put into a table that checks if it is certain values. for istance the victim was level 12 and the killer level 13. then it would subtract and find the level range to be -1, this then goes into the title and the base exp is 66. so at this point you get 66 xp, then it does a check to see about alignment adjustments. if you and the victim are neutral it multiplies it by 1.1 but if you are neutral and the victim is not then it is multiplied by 1.3, for those out there who think neutrals have no learning disadvantage. if one person in the fight is good and the other evil then it is multiplied by 8/5 or 1.6. and if evil kills evil their is no multiplier and it is just the base xp. next is the little randomizer and basically it finds a number betwen 75% of the xp from before or 125% of the xp from before. next is an adjustment that i am not totaly sure about but is based on your level and such in comparison to either hero rank or all the levels in your group combined. then is the adjusting for groups.

>
> note that they might have totaly changed the code since when this was written but it is to give you guys a general idea of it.


>
> /*
> * Compute xp for a kill.
> * Also adjust alignment of killer.
> * Edit this function to change xp computations.
> */
> int xp_compute(CHAR_DATA *gch, CHAR_DATA *victim, int total_levels,int members)
> {
> int xp;
> int base_exp;
> /* int align; */
> int level_range;
> /* int change; */
> /* int time_per_level; */
>
> level_range = victim->level - gch->level;
>
> /* compute the base exp */
> switch (level_range)
> {
> default : base_exp = 0; break;
> case -9 : base_exp = 1; break;
> case -8 : base_exp = 2; break;
> case -7 : base_exp = 5; break;
> case -6 : base_exp = 9; break;
> case -5 : base_exp = 11; break;
> case -4 : base_exp = 22; break;
> case -3 : base_exp = 33; break;
> case -2 : base_exp = 50; break;
> case -1 : base_exp = 66; break;
> case 0 : base_exp = 83; break;
> case 1 : base_exp = 99; break;
> case 2 : base_exp = 121; break;
> case 3 : base_exp = 143; break;
> case 4 : base_exp = 165; break;
> }
>
> if (level_range > 4)
> base_exp = 150 + 20 * (level_range - 4);
>
>
>
> /* calculate exp multiplier */
> if (IS_SET(victim->act,ACT_NOALIGN))
> xp = base_exp;
>
> /* New alignment computations for xp */
>
> else if ((IS_EVIL(gch) && IS_GOOD(victim)) || (IS_EVIL(victim) && IS_GOOD(gch)))
> xp = base_exp * 8/5;
>
> else if ( IS_GOOD(gch) && IS_GOOD(victim) )
> xp = 0;

> else if ( !IS_NEUTRAL(gch) && IS_NEUTRAL(victim) )
> xp = base_exp * 1.1;

> else if ( IS_NEUTRAL(gch) && !IS_NEUTRAL(victim) )
> xp = base_exp * 1.3;

> else xp = base_exp;
>
> /* randomize the rewards */
> xp = number_range (xp * 3/4, xp * 5/4);

> /* adjust for grouping */
> xp = xp * gch->level/total_levels;

> if (members == 2)
> xp *= 2;
> else if (members == 3)
> xp *= 4;

> return xp;
> }


Follow Ups:

Post a Followup

Name:
E-mail:
Subject:
Comments:


[ Follow Ups ] [ Post Followup ] [ Dioxide's CForum ]