Welcome to the Builder Academy

Question Adding Sector Types

More
11 Jun 2012 03:16 #27 by Rumble
Adding Sector Types was created by Rumble
By Tink

Introduction
I wrote this guide to help people add in more sector types to their OLC, which as you can see is pretty simple. Just don't forget to change the number flags any time you add one. This code is written, tested, and works on stock tbaMUD. It may or may not work if your game is heavily modified or from an older version.

The Code
Code:
// In constants.c scroll down to where it lists the basic sector types. (Inside, City, Field, Forest, etc.) and add to the bottom of the list. const char *sector_types[] = { "Inside", "City", "Field", "Forest", "Hills", "Mountains", "Water (Swim)", "Water (No Swim)", "In Flight", "Underwater", + "Desert", "\n", }; // Further down in constants.c (under int movement_loss) you'll want to define how much movement is lost per step with your new terrain type. Note: Make sure the last line doesn't have the comma after the number, but all the previous ones do. int movement_loss[] = { 1, /* Inside */ 1, /* City */ 2, /* Field */ 3, /* Forest */ 4, /* Hills */ 6, /* Mountains */ 4, /* Swimming */ 1, /* Unswimable */ 1, /* Flying */ - 5 /* Underwater */ + 5, /* Underwater */ + 3 /* Desert */ }; // In structs.h scroll down to where the list is again, for basic sector types. /* Sector types: used in room_data.sector_type */ #define SECT_INSIDE 0 /**< Indoors, connected to SECT macro. */ #define SECT_CITY 1 /**< In a city */ #define SECT_FIELD 2 /**< In a field */ #define SECT_FOREST 3 /**< In a forest */ #define SECT_HILLS 4 /**< In the hills */ #define SECT_MOUNTAIN 5 /**< On a mountain */ #define SECT_WATER_SWIM 6 /**< Swimmable water */ #define SECT_WATER_NOSWIM 7 /**< Water - need a boat */ #define SECT_FLYING 8 /**< Flying */ #define SECT_UNDERWATER 9 /**< Underwater */ + #define SECT_DESERT 10 /**< Desert */ // Be sure to bump up NUM_ROOM_SECTORS by 1 + #define NUM_ROOM_SECTORS 11 // In asciimap.c scroll down to the first instance of sector types. At the next -1 at the bottom fill in your new sector type. static struct map_info_type map_info[] = { { SECT_INSIDE, "@c[@n.@c]@n" }, /* 0 */ { SECT_CITY, "@c[@wC@c]@n" }, { SECT_FIELD, "@c[@g,@c]@n" }, { SECT_FOREST, "@c[@gY@c]@n" }, { SECT_HILLS, "@c[@Mm@c]@n" }, { SECT_MOUNTAIN, "@c[@rM@c]@n" }, /* 5 */ { SECT_WATER_SWIM, "@c[@c~@c]@n" }, { SECT_WATER_NOSWIM, "@c[@b=@c]@n" }, { SECT_FLYING, "@c[@C^@c]@n" }, { SECT_UNDERWATER, "@c[@bU@c]@n" }, - { -1, "" }, /* 10 */ + { SECT_DESERT, "@c[@Y-@c]@n" }, /* 10 */ // Scroll down a bit more to the next set and do the same. Since we used @Y- for the symbol above, use it again here. static struct map_info_type world_map_info[] = { { SECT_INSIDE, "@n." }, /* 0 */ { SECT_CITY, "@wC" }, { SECT_FIELD, "@g," }, { SECT_FOREST, "@gY" }, { SECT_HILLS, "@Mm" }, { SECT_MOUNTAIN, "@rM" }, /* 5 */ { SECT_WATER_SWIM, "@c~" }, { SECT_WATER_NOSWIM, "@b=" }, { SECT_FLYING, "@C^" }, { SECT_UNDERWATER, "@bU" }, - { -1, "" }, /* 10 */ + { SECT_DESERT, "@y-" }, /* 10 */ // Finally, jump down even more to where they're listed again like this, and add your new sector. count += sprintf(buf + count, "@n%s Swim\\\\", map_info[SECT_WATER_SWIM].disp); count += sprintf(buf + count, "@n%s Boat\\\\", map_info[SECT_WATER_NOSWIM].disp); count += sprintf(buf + count, "@n%s Flying\\\\", map_info[SECT_FLYING].disp); count += sprintf(buf + count, "@n%s Underwater\\\\", map_info[SECT_UNDERWATER].disp); + count += sprintf(buf + count, "@n%s Desert\\\\", map_info[SECT_DESERT].disp);

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.506 seconds