Welcome to the Builder Academy

Question Adding Liquids

More
11 Jun 2012 03:35 #31 by Rumble
Adding Liquids was created by Rumble
If you have any additions or corrections please stop by the
Builder Academy at telnet://tbamud.com:9091 or email:
rumble@tbamud.com -- Rumble

Files Needed:
constants.c -- defining names, values
olc.h -- adding it to be used in OLC for liq containers
structs.h -- defining liquid

Open constants.c and do a search for /* LIQ_x */ const char *drinks[] =

Below "water" add the new liquid (or liquids) you plan on adding to your code.
For example, instead of:

"clear water",
"\n"
};

Make it:
"clear water",
"Tang",
"\n"
};

You're adding the short description to the liquid, basically... so, they'll get
You drink the Tang.

Next... search for const int drink_aff[][3] = { Below the last set of numbers
( {0, 0, 13}) Place your code... note, the 1st column is hunger, 2nd is thirst,
and 3rd is drunk... so 1,1,13 would mean... 1 hour of hunger is taken away, 1
hour of thirst is taken away, and 13 hours of drunk is taken away (I suppose
water makes you sober). For example, my Tang adding would be:

{0, 0, 13}, /* You have to add that comma */
{0, 1, 0} /* No comma here */
};

This lets the MUD know how to effect the player when they drink this wonderful
new liquid.

Next... search for /* color of the various drinks */ Below "crystal clear", add
the color of your drink. This is just what the players see... so you're not
restricted to basic colors; any color that you can come up with: "crystal
clear", "orange", (of course Tang looks like that). When a player looks into a
liquid container or fountain, they see the color. This defines what color they
see. Basically, we hope that players have better sense than to drink a dark
green liquid.

Now, close constants.c and open olc.h. This just adds the liquid to the olc
menu, so your builders can use this liquid.

Search for: #define NUM_LIQ_TYPES Add the number of liquids you added to that
number. So if it was 12, make it 13. If you added more liquids than just my
Tang, then make sure to add those too.

OLC requires these numbers to know how many liquids to display when somebody is
making a liquid container/fountain. By adding this number, you're setting olc
to allow builders to use this liquid.

Close olc.h and open structs.h.

Search for: #define LIQ_CLEARWATER Below that, add

#define LIQ_TANG 16

(16, or +1 higher than the liquid above it).

Basically, this assigns liquid #16 to the new liquid; it's used in the code
when a player drinks something to grab the stats on the drink. (Would be the
16th liquid on the short-desc list, etc)

You're done! Recompile and reboot.

Originally created by B. Brown

Rumble
The Builder Academy
tbamud.com 9091
rumble@tbamud.com

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

Time to create page: 0.179 seconds