Re: well my exp thing.

From: VampLestat (vamp@csulb.edu)
Date: 07/19/94


On Mon, 18 Jul 1994, The Chronicler wrote:

> what i did was this....now i have less exp.
> 
> 1. get exp for damage.
> 2. add all of groups levels.
> 3. exp gain = group_gain/num_of_levels * GET_LEVEL(ch);
> 
> so a 30, a 25, and 1 would be a grtoup of 56 levels...
> ws the 1st level woulg get 1/56 of group exp, the 30 would gert 30/56 etc...

Actually I thought this question was already solved in Circle 3.0.  Xp 
was divided based on level as above, with a max XP gain cap as well.
I've simply implemented it so that you can only gain 1/4 of the current 
level width, or 100,000xp, which ever is smaller.

It also checks and doesnt let people auto-immort either.  Just a couple 
simple checks.  Here's my gain_exp function.


void    gain_exp(struct char_data *ch, int gain)
{
   int  i;
   long maxgain;
   bool is_altered = FALSE;

   if (IS_NPC(ch) || ((GET_LEVEL(ch) < LEVEL_IMMORT) && (GET_LEVEL(ch) > 0))) {

      if (gain > 0) {

/* Max gain for a pc is 1/4 of the width to the next level -vamp 12/22 */

         if (IS_NPC(ch)){
         gain = MIN(100000, gain);
         } else {
         maxgain = (titles[GET_CLASS(ch)-1][GET_LEVEL(ch)+1].exp - titles[GET_CLASS(ch)-1][GET_LEVEL(ch)].exp) * .1;
         gain = MIN(maxgain, gain);
       }

         GET_EXP(ch) += gain;
         if (!IS_NPC(ch)) {
            for (i = 0; titles[GET_CLASS(ch)-1][i].exp <= GET_EXP(ch); i++) {

/* Do not allow lv 30 players to advance to lv 31 via simple exp.
   Must use the advance command, even though XP continues to pile up 
   -vamp 12/22
 */

               if ((i > GET_LEVEL(ch)) && (GET_LEVEL(ch) < LEVEL_MORTAL_MAX)) {
                  send_to_char("You rise a level!\n\r", ch);
                  GET_LEVEL(ch) = i;
                  advance_level(ch);
                  is_altered = TRUE;
               }
            }
         }
      }

      if (gain < 0) {
         gain = MAX(-500000, gain);  /* Never loose more than 1/2 mil */
         GET_EXP(ch) += gain;
         if (GET_EXP(ch) < 0)
            GET_EXP(ch) = 0;
      }

      if (is_altered) {
         set_title(ch);
         check_autowiz(ch);
      }
   }
}


_O_ Ryan L. Watkins                   e-mail: vamp@csulb.edu
 |  Academic Computing Services       url   : http://www.acs.csulb.edu/~vamp/
 |  CSU Long Beach - Network Support  pgpkey: finger vamp@gothic.acs.csulb.edu
    Darkside Consulting   -   Unix  /  Windows  /  Mac  /  Internet  /  Design



This archive was generated by hypermail 2b30 : 12/07/00 PST