[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  Dawn of Time
. -> [Folder]  Configuration
. . -> [Subject]  Changing order in creation

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Changing order in creation
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please)
Maximum of 6000 characters. Text only please, no HTML.
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Kalahn   United Kingdom  (138 posts)  [Biography] bio   Moderator
Date Sat 02 Nov 2002 11:55 AM (UTC)  quote  ]
Message
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.


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     9


Add 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

Kalahn
Developer of the Dawn of Time codebase
http://www.dawnoftime.org/
[Go to top] top

Posted by Meerclar   USA  (554 posts)  [Biography] bio
Date Tue 29 Oct 2002 08:17 PM (UTC)  quote  ]
Message
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.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
[Go to top] top

Posted by Veshirak   USA  (5 posts)  [Biography] bio
Date Tue 29 Oct 2002 03:34 AM (UTC)  quote  ]
Message
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.
[Go to top] top

Posted by Veshirak   USA  (5 posts)  [Biography] bio
Date Mon 28 Oct 2002 04:28 PM (UTC)  quote  ]
Message
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.
[Go to top] top

Posted by Veshirak   USA  (5 posts)  [Biography] bio
Date Sun 27 Oct 2002 05:08 AM (UTC)  quote  ]
Message
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.
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


2,861 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]