Saturday, May 28, 2005

Dawn of Time Snippet - Mining

I've been coding for my MUD game, Athens and wrote up the following hash of code that could be altered for fishing, hunting (as in game animals), panning for gold, ect. It's basically a hack of a lot of things that I dug around in.

Code Snippet and Instructions
Make sure to add an object type for PICK and to add mine.o to your makefile.

You can add more cases to give different amounts of gold or silver, or perhaps objects such as gems. I just put up two as an example.

To make this work, you'd have a mine shaft or cave or some other area, and flag the rooms ROOM2_MINE. You'd also have to have objects of type ORE reset into the room. I suggest making them not takable.

When a player walks into the mine and sees some ore in the room, he'll know he can mine (if he's got a pick). When he types MINE, one of the ore type objects in the room is purged. This prevents someone from simply typing MINE 200 times and getting a lot of money. When the area resets, more ore will show up and another player who comes along can mine again.

No comments:

Post a Comment

There was an error in this gadget