I want to change around the order of creation so that a player chooses their class before rolling stats. This is so I can prioritize which values will go with what stat based on their chosed class. For example, strength is a warrior's most important stat, so it will be given the highest stat rolled. If anyone knows exactly what this will entail, whether just reordering function calls or something more complex, I'd appreciate the info.
Changing order in creation
Posted by Veshirak on Sun 27 Oct 2002 05:08 AM — 5 posts, 22,177 views.
Alright, nevermind, I figured it out. It just involves changing around the redirection function calls in nanny.cpp, though there are a few other changes that need to be made. If anyone wants to know, post a reply here, and I'll give the jist of the changes once I finish it up.
All right, new question, same idea. I want to add an array that has the stats priority order to the class_type struct, but I'm not sure which file has the code that imports the class info from file. If someone could fill me in on that, I'd appreciate it greatly.
Veshirak, what it sounds like you want to do is going to very near require recoding the entire process of stat rolling at creation. Also, keep in mind the classedit function allows for 2 Major stats per class to complicate matters further. Personally, I'd recommend adjusting the bonuses each class gets to their primary stats rather than having the highest numbers automatically assigned to the prime stats for the class. Also consider that there are unusual players that will want a stat thats not a prime for the class to be higher than the primes before the class bonuses are applied. My mage on Stormbringer is one such creation.... he has a CO better than most warriors before eq bonuses are applied, and an even more impressive CO after eq bonuses. Just some friendly advise from a fellow coder.
Quote:
All right, new question, same idea. I want to add an array that has the stats priority order to the class_type struct, but I'm not sure which file has the code that imports the class info from file. If someone could fill me in on that, I'd appreciate it greatly.
All right, new question, same idea. I want to add an array that has the stats priority order to the class_type struct, but I'm not sure which file has the code that imports the class info from file. If someone could fill me in on that, I'd appreciate it greatly.
How I would probably tackle this.
In params.h, we have:
// Stat stuff
#define MAX_STATS 10
#define STAT_ST 0
#define STAT_QU 1
#define STAT_PR 2
#define STAT_EM 3
#define STAT_IN 4
#define STAT_CO 5
#define STAT_AG 6
#define STAT_SD 7
#define STAT_ME 8
#define STAT_RE 9Add an array in the class_type struct (structs.h).
e.g.
sh_int stat_priority[MAX_STATS];If strength is the highest priority for the warrior class, presence has second, quickness has the fourth, then the values would be defined a long the lines of:
class_table[warrior_class_index].stat_priority[STAT_ST]=1;
class_table[warrior_class_index].stat_priority[STAT_QU]=4;
class_table[warrior_class_index].stat_priority[STAT_PR]=2;
NOTE: You wouldn't use the above code though, you would write an olc editor to set this stuff, and don't use STAT_?? in the code, instead use a variable to reference by index and look up the index into a name using stat_flags[] defined in tables.cpp. Search for 'stat_flags' in raceedit.cpp you will see what I mean about using a variable to access stuff.
Assuming you manage to get in the class table, a sorted list of priorities...
Within roll_stats() (nanny.cpp), after the call to gen_rolemaster_stats(), there is a transfer of stats to the character. Just before that, sort them.
To achieve this, first sort the rm_stats_set, so highest stat is first in the array, lowest is last. Then use something like the following loop to transfer them to the character.
// i = transfers stats one by one
// p = locates the correct position to get stat from
int i,p;
for(i=0; i<MAX_STATS; i++){
p=class_table[ch->clss].stat_priority;
ch->perm_stats= rm_stats_set.perm[p];
ch->potential_stats=rm_stats_set.potential[p];
}
I would probably go a bit flasher than this in real development... e.g. make it so you can set a variable amount of prority for different classes, say for mage 5 stats are sorted in priority, warrior only has the first two stats in priority. To achieve this, I would most likely stop my sorting routine sorting after the specified number of values.
Also the above system assumes the priorities are unique... if not you have to develop a more extensive system.
In order to save the priority information, I would probably just put into the class_type gio structure in class (search for GIO_START(class_type) in dynamics.cpp),
GIO_SHINTH(stat_priority[STAT_ST], "statprior_ST")
GIO_SHINTH(stat_priority[STAT_QU], "statprior_QU")
GIO_SHINTH(stat_priority[STAT_PR], "statprior_PR")
GIO_SHINTH(stat_priority[STAT_EM], "statprior_EM")
GIO_SHINTH(stat_priority[STAT_IN], "statprior_IN")
GIO_SHINTH(stat_priority[STAT_CO], "statprior_CO")
GIO_SHINTH(stat_priority[STAT_AG], "statprior_AG")
GIO_SHINTH(stat_priority[STAT_SD], "statprior_SD")
GIO_SHINTH(stat_priority[STAT_ME], "statprior_ME")
GIO_SHINTH(stat_priority[STAT_RE], "statprior_RE")
I did something simular a long time ago with racial stat modifiers (search for GIO_START(race_data) in races.cpp).
Hope this helps, let us know how you get on.
- Kal