[code submission] Floating_zone

From: Mike Carpenter (abram@DELTANET.COM)
Date: 02/19/98


Coders,
I wanted to submit the following code as a way to say thanks
for all of those who have helped me.  I think its pretty cool.
This code was an idea i got from the movie KRULL.  In the movie
a black fortress changed its geographical location at the dawn of
each morning.  This code enables you to make a room change its
location in your mud.  Obviously you can attach more rooms to the
one room, making it a zone which will change its location in the
mud at every SUNRISE.  This zone idea is also cool, because it
gives the mortals something to look for if they are board.  In
this code there are only 3 rooms that it randomly chooses to attach
to, however, in my code I have it go to about 10 to 20 random rooms.
I hope you enjoy this and please if you would reference me in your
code Mike Carpenter.  Enjoy!
Abram@deltanet.com
Legends of Blades and Magic
mud.inc.net 9000


/* IN db.c add this */
/* at bottom of external functions */
void floating_zone(void);

/* still in db.c further down in void boot_world(void) */
/* right after renum_zone_table() add this */
log("Moving Black Fortress.");
  floating_zone();

/* in weather.c add this */
/* at bottom of external functions */
void floating_zone(void);

/* still in weather.c in void another_hour(int mode) */
/* with in case 5 add */
floating_zone();


/* in spec_procs.c add all of the following */
/* variable for floating zone */
int hereIwas=1; /* place this variable somewhere outside the function*/

/* place this function anywhere, I have it in spec_procs. */

/************************************************************************
* if you want to add more rooms for the zone to connect to, add more *
* variables like int forth_room = real_room(????);  Then be sure to     *
* increase the number(1,3) to number(1,4) or however many new variables *
* you add.  Also be sure to add a new case for each new variable you    *
* add.  That should be it.  Remember when creating a new room, in olc   *
* or manually, be sure to make the new room has an exit south to        *
* the entrance room.  Also make sure that in each case you add a line   *
* that closes the exits.  Like this (dont close exit south if it is the *
* room that is suppose to be open)  Here is the example:                *
* world[forth_room].dir_option[SOUTH]->to_room = NOWHERE;               *
* one other thing make sure you make an exit north from entrance room   *
* to one of the rooms it should connect to if you dont do this your mud *
* will crash.        *
************************************************************************/

void floating_zone()
{
extern struct room_data *world;
int entrance = real_room(15300); /* Make this your entrance */
int first_room = real_room(3000); /* change 3000 to whatever */
int second_room = real_room(3063); /* change 3063 to whatever */
int third_room = real_room(3006); /* change 3006 to whatever*/


 switch(number(1,3))
 {
 case 1:
   /* send closing door message to room it just left */
   if(hereIwas == 1)
   send_to_room("A door closes to the south.\n\r", first_room);
   if(hereIwas == 2)
   send_to_room("A door closes to the south.\n\r", second_room);
   if(hereIwas == 3)
   send_to_room("A door closes to the south.\n\r", third_room);
   /* connect entrance and first room */
   world[entrance].dir_option[NORTH]->to_room = first_room;
   send_to_room("The doors close and open somewhere new.\n\r", entrance);
   world[first_room].dir_option[SOUTH]->to_room = entrance;
   send_to_room("A door opens to the south.\n\r", first_room);
   /* Close second and third room exits south */
   world[second_room].dir_option[SOUTH]->to_room = NOWHERE;
   world[third_room].dir_option[SOUTH]->to_room = NOWHERE;
   hereIwas = 1;
   break;
 case 2:
   /* send closing door message to room it just left */
   if(hereIwas == 1)
   send_to_room("A door closes to the south.\n\r", first_room);
   if(hereIwas == 2)
   send_to_room("A door closes to the south.\n\r", second_room);
   if(hereIwas == 3)
   send_to_room("A door closes to the south.\n\r", third_room);
   /* connect entrance and second room */
   world[entrance].dir_option[NORTH]->to_room = second_room;
   send_to_room("The doors close and open somewhere new.\n\r", entrance);
   world[second_room].dir_option[SOUTH]->to_room = entrance;
   send_to_room("A door opens to the south.\n\r", second_room);
   /* Close first and third room exits south */
   world[first_room].dir_option[SOUTH]->to_room = NOWHERE;
   world[third_room].dir_option[SOUTH]->to_room = NOWHERE;
   hereIwas = 2;
   break;
 case 3:
   /* send closing door message to room it just left */
   if(hereIwas == 1)
   send_to_room("A door closes to the south.\n\r", first_room);
   if(hereIwas == 2)
   send_to_room("A door closes to the south.\n\r", second_room);
   if(hereIwas == 3)
   send_to_room("A door closes to the south.\n\r", third_room);
   /* connect entrance and third room */
   world[entrance].dir_option[NORTH]->to_room = third_room;
   send_to_room("The doors close and open somewhere new.\n\r", entrance);
   world[third_room].dir_option[SOUTH]->to_room = entrance;
   send_to_room("A door opens to the south.\n\r", third_room);
   /* Close first and second room exits south */
   world[first_room].dir_option[SOUTH]->to_room = NOWHERE;
   world[second_room].dir_option[SOUTH]->to_room = NOWHERE;
   hereIwas = 3;
   break;
   default:
   log("System Error in FLOATING_ZONE function!");
   break;
   } /* end switch */
  return;
} /* end function */


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST