WTFaq - Adding new liquid types.


Files Needed:

  constants.c -- defining names, values
  olc.h (if present) -- 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",
  "apple juice",
"\n"
};
Why? You're adding the short description to the liquid, basically... so, they'll get You drink the apple juice.

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 apple juice adding would be:

{0, 0, 13},  /* You have to add that comma */
{0, 1, 0}    /* No comma here */
};
Why? 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", "bright speckled polka-dot brown", (of course apple juice looks like that). Why? 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. Note: If you don't have olc, don't panic! Just skip this step. 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 apple juice, then make sure to add those too.

Why? 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_APPLE_JUICE              16
(16, or +1 higher than the liquid above it. Change APPLE_JUICE to whatever liquid you added.) Why? Circlemud loves numbers. 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)

Close structs.h

You're done! Recompile and reboot.



-- B. Brown, Webmaster - WTFaq