| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Message
| SMAUG uses what are called "connection states" to know where the player's input is supposed to go. These should all be defined in mud.h. Examples are CON_GET_NAME, CON_GET_RACE, CON_PLAYING, CON_EDITING... etc.
There are three main groups, as I remember. Playing, editing, and everything else. Playing is pretty simple, if your connection state is playing, then anything you type is sent to the interpret function. If your connection state is editing, then what you type is sent to the editor buffer controller.
The third group, the "everything else", is mostly used during the initial connection phase. For example, when you first log on, the game needs to know what your name is so that it can log you in. Therefore, your connection state will be CON_GET_NAME or something like that.
From here, if you enter "new", it'll redirect you to CON_GET_NEW_NAME, otherwise, it'll ask you for your password, and redirect to CON_GET_PASSWORD.
So, basically, at one point in the character creation process, the user will be given the connection state CON_GET_CLASS. From that point onwards, the game will expect to receive the class text.
What you want to do is find that point at which the user is asked to enter their class, and when their con_state is switched to CON_GET_CLASS. Instead, there, you would ask them for their race, by setting their con_state CON_GET_RACE. Inside the CON_GET_RACE handler, look for the point at which it advances to CON_(something) (I can't remember what it is) and then make that CON_GET_CLASS. Then in your CON_GET_CLASS function, when the user normally is directed to enter a race, direct them to whatever it was you changed to CON_GET_CLASS in the race handler.
You'll have to do some extra work concerning racial class restrictions, i.e. so races can't be some classes. So you'll want to limit the choices available in CON_GET_CLASS to whatever their race allows them.
This is actually fairly easy to mess up. I'd be very careful with this, and test it very well.
By the way, I haven't looked at normal SMAUG for a long time, so I may have the names and all that wrong. However, I believe the general idea (and even most of the names) are the same. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|