Welcome to the Builder Academy

Question Increasing LoS for Asciimap.c

More
17 Jun 2013 13:42 #3141 by Shulk
Hello,
I'm wanting to increase the Line of Sight from just 20 or so to about 50. Here is the line I am referring to.
Code:
if (worldmap && x < 28 && x > 22 && y < 28 && y > 22) {

Owner/Programmer - Heroes Online MUD

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

More
17 Jun 2013 21:35 #3143 by thomas

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

More
17 Jun 2013 22:39 #3145 by Shulk
Replied by Shulk on topic Increasing LoS for Asciimap.c

thomas wrote: I can't seem to find that line in github.com/welcor/tbamud/blob/master/src/asciimap.c


It's a add on.

Owner/Programmer - Heroes Online MUD

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

More
18 Jun 2013 19:28 #3156 by Vatiken
Is there a question here?

tbaMUD developer/programmer

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

More
21 Jun 2013 00:07 #3189 by Shulk
Replied by Shulk on topic Increasing LoS for Asciimap.c
Add on programmed by Vatiken

This snippet allows objects, npcs, and players to be seen on the map.

1.open asciimap
2. near the defines add
Code:
#define SECT_PC (SECT_HERE + 1) #define SECT_NPC (SECT_PC + 1) #define SECT_OBJ (SECT_NPC + 1) #define MAP_MODE_NONE 0 #define MAP_MODE_CHARS 1 #define MAP_MODE_OBJS 2 #define MAP_MODE_HIDDEN 3 #define MAP_MODE_ALL 4


3. find map_info and add
Code:
{ SECT_PC, "\tc[\tR*\tc]\tn" }, { SECT_NPC, "\tc[\tM*\tc]\tn" }, { SECT_OBJ, "\tc[\tY*\tc]\tn" }

4. find world_map_find and add:
Code:
{ SECT_PC, "\tc[\tR*\tc]\tn" }, { SECT_NPC, "\tc[\tM*\tc]\tn" }, { SECT_OBJ, "\tc[\tY*\tc]\tn" }

5. find void MapArea and under sh_int prospect_xpos, prospect_ypos; and
Code:
struct char_data *tch; struct obj_data *obj; int found = 0; int mode = MAP_MODE_ALL;

find:
Code:
if(room == IN_ROOM(ch)) map[x][y] = SECT_HERE; else map[x][y] = SECT(room);

under it add:
Code:
/* Search Room For Characters*/ if (mode == MAP_MODE_ALL || mode == MAP_MODE_CHARS) { for (tch = world[room].people; tch; tch = tch->next_in_room) { /* If not displaying world map and "tch" is within field of vision, display. -JA */ /* Field of Vision: The player is located at 25, 25 and the map draws out tiles from there. */ /* The following line displays PC/NPCs within 3 tiles EAST/WEST of the PC, and 3 tiles NORTH/SOUTH */ /* It works out to approximately 1 room... this is designed to keep NPCs from cluttering the map in largely*/ /* populated areas. */ if (!worldmap && x < 28 && x > 22 && y < 28 && y > 22) { if (!CAN_SEE(ch, tch)) /* Can't see? Ignore */ continue; if (!IS_NPC(tch)) { map[x][y] = SECT_PC; /* Assign MAP tile to SECT_PC */ break; /* If we find a PC, then we break the loop */ } else map[x][y] = SECT_NPC; /* Assign MAP tile to SECT_NPC, and continue the loop */ found++; /* Mark found so that a PC/NPC will take priority over objects */ } } } if (mode == MAP_MODE_ALL || mode == MAP_MODE_OBJS) { /* If we already found a PC or NPC ignore loop, else continue to search for objects */ for (obj = world[room].contents; obj && !found; obj = obj->next_content) { /* Once again, only search if not worldmap, and within field of view */ if (!worldmap && x < 28 && x > 22 && y < 28 && y > 22) { map[x][y] = SECT_OBJ; /* Mark MAP as SECT_OBJ */ found++; /* Mark found and break loop... kinda redundant*/ break; } } }


Now my question is how to increase the line of sight which is this line
Code:
if (!worldmap && x < 28 && x > 22 && y < 28 && y > 22) {

Owner/Programmer - Heroes Online MUD

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

More
21 Jun 2013 03:20 #3191 by Vatiken
Yeah that looks like my work...
Code:
/* If not displaying world map and "tch" is within field of vision, display. -JA */ /* Field of Vision: The player is located at 25, 25 and the map draws out tiles from there. */ /* The following line displays PC/NPCs within 3 tiles EAST/WEST of the PC, and 3 tiles NORTH/SOUTH */ /* It works out to approximately 1 room... this is designed to keep NPCs from cluttering the map in largely*/ /* populated areas. */ if (!worldmap && x < 28 && x > 22 && y < 28 && y > 22) {

Not sure how to explain it any differently then I already did, but if you want to have a larger field of view you simply need to increase the x/y differential (currently 3).
Code:
if (!worldmap && x < 28 && x > 22 && y < 28 && y > 22) { == if (!worldmap && x < (25+3) && x > (25-3) && y < (25+3) && y > (25-3)) {

tbaMUD developer/programmer

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

Time to create page: 0.197 seconds