Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
 Couple bugs
Today, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Yandex, Yahoo!

Members: 0
Guests: 19
Stats
Files
Topics
Posts
Members
Newest Member
477
3,705
19,232
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » MPMSET class/race on a PC (SM...
Forum Rules | Mark all | Recent Posts

MPMSET class/race on a PC (SMAUGFUSS 1.9) [Solved]
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Nov 10, 2010, 7:43 pm
Go to the top of the page
Go to the bottom of the page

Raine
Magician
GroupMembers
Posts126
JoinedDec 11, 2007

Like the title states I'm trying to allow a mob to edit (permantly) the class/race on a Playable Character. I've ran into a snag though. What I'm essentially trying to do is remove the option to choose class/race when you first log into the mud and then later in the game let the player be given the option to choose a race, then a class farther along. This however is as far as I've managed :(. I've looked for solutions to this problem but haven't found anything on any site google could provide.

I've managed to find the area in mpxset.c (231-269) that handles the "class" & "race" portion however they are geared towards working on npc's only. I tried several different avenues such as adding an else clause to change the value regardless, looping in the comm.c function (I was desperate :p), and other such failures :/. I was hoping if it wasn't to much trouble to get a hand with this little project. Thanks in advance!
       
Post is unread #2 Nov 11, 2010, 2:39 pm
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

Have you tried copying the logic from mset for class/race?
       
Post is unread #3 Nov 11, 2010, 3:42 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

You can also look at how AFKMud handled chargen since it uses a system which is effectively NPCs setting your class. I'm pretty sure I had to modify the mpmset command to handle that.
       
Post is unread #4 Nov 11, 2010, 6:23 pm
Go to the top of the page
Go to the bottom of the page

Raine
Magician
GroupMembers
Posts126
JoinedDec 11, 2007

I did that last night, though it seems I forgot to close the if statment... (I blame it on mid-afternoon programming!) Regardless, the following code is what I did to fix it incase others need this. Lines 231-286 in mpxset.c (SRC folder). Thanks for the replies guys :)!

 if( !str_cmp( arg2, "class" ) )
   {
      if( IS_NPC( victim ) )  /* Broken by Haus... fixed by Thoric */
      {
         if( value >= MAX_NPC_CLASS || value < 0 )
         {
            progbug( "MpMset: Invalid npc class", ch );
            return;
         }
         victim->Class = value;
         return;
      }
	  else
		{
			if( value < 0 || value >= MAX_CLASS )
				{
					progbug( "Class range is 0 to 10", ch);
					return;
				}
				progbug( "Mob is setting a PC's Class", ch);
				victim->Class = value;
				return;
		}
     
   }
   

   if( !str_cmp( arg2, "race" ) )
   {
      value = get_npc_race( arg3 );
      if( value < 0 )
         value = atoi( arg3 );
      if( IS_NPC( victim ) )
      {
         progbug( "MpMset: can't set pc race", ch );
         return;
      }
	  else
		{
			if( value < 0 || value >= MAX_RACE )
				{
					progbug( "Race range is 0 to 10", ch);
					return;
				}
				progbug( "Mob is setting a PC's Race", ch);
				victim->race = value;
				return;
		}
      if( value < 0 || value >= MAX_NPC_RACE )
      {
         progbug( "MpMset: Invalid npc race", ch );
         return;
      }
      victim->race = value;
      return; 
   }

   if( !str_cmp( arg2, "armor" ) )
   {
      if( value < -300 || value > 300 )
      {
         send_to_char( "AC range is -300 to 300.\r\n", ch );
         return;
      }
      victim->armor = value;
      return;
   }

   if( !str_cmp( arg2, "level" ) )
   {
      if( !IS_NPC( victim ) )
      {
         progbug( "MpMset: can't set pc level", ch );
         return;
      }

      if( value < 0 || value > LEVEL_AVATAR + 5 )
      {
         progbug( "MpMset: Invalid npc level", ch );
         return;
      }
      victim->level = value;
      return;
   }
       
Pages:<< prev 1 next >>