Welcome to the Builder Academy

Question Mob Hunting: A Minor Change for a Big (subjective) Improvement

More
09 May 2019 06:44 - 09 May 2019 09:08 #8390 by Sapphire
While my friend was testing our mud tonight, he noticed an interesting quirk. Rooms flagged NO_TRACK/NOTRACK would not only stop the mob from entering the room to mhunt the player, they would cause the mobile to forget the player they were hunting. I took a look at graph.c to see if I couldn't cause the mob to stop short of the NO_TRACK/NOTRACK room the player was in while also retaining the mobs memory for that hunt. I succeeded. Here is a quick workaround for this in graph.c.

Note: This is from a code that has deviated from TBA through additions for many, many years. Some syntax may need to be altered, but I'm pretty sure this will be a drag-n-drop deal if you wanted to test it. Please give credit where it is due if you use it. Thanks, and I hope this makes another mud more enjoyable. The idea of making mobiles appear smarter always intrigues me as a player!

Original Code pt. 1
Code:
static int VALID_EDGE(room_rnum x, int y) { if (world[x].dir_option[y] == NULL || TOROOM(x, y) == NOWHERE) return 0; if (CONFIG_TRACK_T_DOORS == FALSE && IS_CLOSED(x, y)) return 0; if (ROOM_FLAGGED(TOROOM(x, y), ROOM_NOTRACK) || IS_MARKED(TOROOM(x, y))) return 0; return 1; }

Original Code pt. 2 (From void hunt_victim at bottom of graph.c)
Code:
} else { perform_move(ch, dir, 1); if (IN_ROOM(ch) == IN_ROOM(HUNTING(ch))) hit(ch, HUNTING(ch), TYPE_UNDEFINED); } }

Code Change pt. 1
Code:
static int VALID_EDGE(room_rnum x, int y) { if (world[x].dir_option[y] == NULL || TOROOM(x, y) == NOWHERE) return 0; if (CONFIG_TRACK_T_DOORS == FALSE && IS_CLOSED(x, y)) return 0; if (IS_MARKED(TOROOM(x, y))) return 0; return 1; }

Code Change pt. 2
Code:
} else { if (ROOM_FLAGGED(EXIT(ch, dir)->to_room, ROOM_NOTRACK)) { act("$n appears to be waiting patiently for someone...", TRUE, ch, 0, 0, TO_ROOM); } if (!ROOM_FLAGGED(EXIT(ch, dir)->to_room, ROOM_NOTRACK)) { act("$n appears to be tracking $s prey...", TRUE, ch, 0, 0, TO_ROOM); perform_move(ch, dir, 1); act("$n appears to be tracking someone...", TRUE, ch, 0, 0, TO_ROOM); } if (IN_ROOM(ch) == IN_ROOM(HUNTING(ch))) { hit(ch, HUNTING(ch), TYPE_UNDEFINED); } } }
Last edit: 09 May 2019 09:08 by Sapphire.

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

Time to create page: 0.163 seconds