- Posts: 452
- Thank you received: 79
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
WhiskyTest wrote: It depends how the new code is writing the extra race information, but assuming it is adding on one additional value to this line you would write something like:
Code:if (sscanf(line, " %d %d %d %d %d ", t, t + 1, t + 2, t + 3, t + 4) != 5) { log("SYSERR: Format error in last line of mob #%d, converting..\n" "...expecting line of form '# # # # #'", nr); //exit(1); comment this out until you have saved all the mobs with the new format t[4] = 0; // arbitrarily set a default race if none was scanned above } GET_POS(mob_proto + i) = t[0]; GET_DEFAULT_POS(mob_proto + i) = t[1]; GET_SEX(mob_proto + i) = t[2]; GET_CLASS(mob_proto + i) = t[3]; GET_RACE(mob_proto + i) = t[4];
Each of the %d's is a number that sscanf looks for, and puts the value into the t[] character. Make sure t[] has at least 5 when you declare it. I think stock has plenty.
t[4] = 0; means the default race for existing mobs will be race #0, change that to what you need.
Once you boot the MUD up go through and save all the mob files and they should write the new race values to file, then you can comment in the exit(1); part to catch errors in formatting again.
Please Log in or Create an account to join the conversation.
tbaMUD © 2024