RE: [newbie] leveling

From: Gary Barnett (gbarnett@polarnet.com)
Date: 01/31/97


-----Original Message-----
From:	Mike Sulmicki [SMTP:mikesul@CapAccess.org]
Sent:	Friday, January 31, 1997 3:25 PM
To:	Circle List
Subject:	 [newbie] leveling

How would I go about changing the auto-leveling system to where you'd
have to type level in your guild to level.. If someone could give me
a walkthrough, all the beter :)

Thanks in advance,
Mike
----

First you'll need to add a 'gain' command.
Then you'll have to remove the automatic gaining process in the code.
Look for advance_level in the code.. probably fight.c

Here's my do_gain function.. with a couple caveats.

1) Don't use the method I'm using to calculate experience required.
    (we are currently finishing up the final world balancing... at which point
     I'll substitue a real method of calculating exp needed to level :-)  )

2) I have a mud school players start in.. at level 0.. that's the first part of the
code.. where it checks for level = 0 .. if you have none-such, you'll not want
to use that portion.

3) This is set up for 100 levels.. modify to suit.

4) I have a global info message sent to everyone whenever someone levels..
   Snip that if you dislike that sort of thing.

5) To restrict gaining to a certain room, add the following:

 if (world[ch->in_room].number != MY_GUILD_VNUM) {
    send_to_char("Do you see your guildmaster around here anywhere?!? I thought not.\r\n",ch);
    return; 
 }

 or you could loop through the mobs in the room looking for your guild master... like so:

 struct char_data *vict, *next_v;
 int got_one=0;

 for (vict = world[ch->in_room].people; vict; vict = next_v) {
      next_v = vict->next_in_room;
      if (IS_NPC(vict)) 
	   if (GET_MOB_VNUM(vict) == MY_GUILD_MASTER_VNUM) {
           got_one=1;
           break;
	   }
 }
 if (!gotone) {
    send_to_char("Do you see your guildmaster around here anywhere?!? I thought not.\r\n",ch);
    return; 
 }




ACMD(do_gain) {
  struct descriptor_data *i;
  if (GET_LEVEL(ch) == 0) {
	  GET_LEVEL(ch) =1;
	  char_from_room(ch);
	  char_to_room(ch, real_room(mortal_start_room));
	  look_at_room(ch, ch->in_room);
	  mob_script_ENTR_TGR(ch);
	  return;
  }
  if (GET_LEVEL(ch) >= 100) {
       send_to_char("You are maxed out.. You can't gain any more.",ch);
       return;
  }
  if (IS_NPC(ch)) {
	   send_to_char("You are a mob.. Get out of here!",ch);
	   return;
  }
  if (GET_EXP(ch) < (GET_LEVEL(ch)+1)*10000) {
	     send_to_char("You don't have enough experience to gain a level at this time.",ch);
	     return;
  }
  send_to_char("You gain a level!\r\n", ch);
  GET_EXP(ch) -= (GET_LEVEL(ch)+1)*10000;
  GET_LEVEL(ch) += 1;
  advance_level(ch);
  sprintf(buf,"%s[INFO] %s has gained level %d!%s", CCGRN(ch, C_NRM),GET_NAME(ch),GET_LEVEL(ch), CCNRM(ch, C_NRM));
  for (i = descriptor_list; i; i = i->next) {
          if (!i->connected &&  i->character &&
	       !PRF_FLAGGED(i->character, PRF_NOINFO) &&
	       !PLR_FLAGGED(i->character, PLR_WRITING)) {
           act(buf, FALSE, ch, 0, i->character, TO_VICT | TO_SLEEP);
          }
  }  
}

--Mallory
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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