Welcome to the Builder Academy

Question Need advice on restricting class choice based on race

More
10 Dec 2017 01:35 #7227 by Nibiru
I'm running TBA 3.68 on windows 10.
I've added races using the snippet posted for an earlier version of TBA as a guide.
Now I want to restrict class choices based on race. What is the best way to accomplish this? I'm decent at hand patching but when it comes to creating something new I'm still very weak. If someone has done this this and can give me a brief outline of what you did I should be able to use it as a starting point. I've tried modifying class.c by setting up a case for each race but ran into issues getting the choices to display during character creation, this solution also did not prevent someone from choosing a class that is not permitted for the selected race.

Nibiru

Please Log in or Create an account to join the conversation.

More
11 Dec 2017 00:26 #7230 by WhiskyTest
I have a sneaky suspicion this was included in the D20 mud releases, but it seems the links are broken :(
If your google-fu is on point you might be able to track down source code for it.

Or someone else here might have a valid link?..

Please Log in or Create an account to join the conversation.

More
11 Dec 2017 09:52 #7233 by JTP
Im using:
Code:
int class_ok_race[NUM_RACES][NUM_CLASSES] = { /* M, C, T, W */ /* Human */ { Y, Y, Y, Y }, /* Elf */ { Y, Y, Y, N }, /* Gnome */ { Y, Y, N, Y }, /* Dwarf */ { N, Y, N, Y } };

Please Log in or Create an account to join the conversation.

More
21 Dec 2017 17:47 #7278 by Nibiru
Thank you for the suggestion to use a table and take a look at the D20 versions. I downloaded one of the D20 versions (Rasputin) and the class.c file seems to have the solution I'm looking for. Other than interpreter.c, are there any other files I should take a close look at prior to patching the relevant sections from the rasputin version of class.c into the tba3.68 version of class.c?

Nibiru

Please Log in or Create an account to join the conversation.

More
22 Dec 2017 00:39 - 22 Dec 2017 00:40 #7279 by thomas
It's mostly those two - class.c for the definitions, interpreter.c for the usage.

Edit: and of course, the relevant .h files.
Last edit: 22 Dec 2017 00:40 by thomas.

Please Log in or Create an account to join the conversation.

More
24 Mar 2018 22:23 #7791 by Nibiru
I've got this partially in however I'm running into issue getting con_qclass to use my table.
I suspect I'm using the wrong syntax:
This is what I've done:
I created a table using JTP's suggestion in class.c
I added int class_ok_race[NUM_RACES][NUM_CLASSES]; in the list of external function prototypes in interpreter.h


I tried using the lines in interpreter.c from CWG rasputin for this function as a guideline but the few times I was able to get the code to recompile, the table was not used or everything was an invalid class.

So how do I rewrite this function to use the table I created?

case CON_QCLASS:
load_result = parse_class(*arg);
if (load_result == CLASS_UNDEFINED) {
write_to_output(d, "\r\nThat's not a class.\r\nClass: ");
return;
} else
GET_CLASS(d->character) = load_result;

Nibiru

Please Log in or Create an account to join the conversation.

Time to create page: 0.202 seconds