Problem with the sector types Water(Swim) and water(No swim)

  • Sascha
  • Sascha's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 2 weeks ago #7984 by Sascha
Is there something I'm missing about these two sector types? My players can access those rooms without the swim skill, or using boats.

[ 2238] In a Cold Pool of Streamwater [ NOBITS ] [ Water (Swim) ]
A deep depression in the earth has been worn smooth by the waters of a cold
stream, making a deep pool of frigid water. The stream feeds from the east, and
to the south the water trickles over the edge of a dam of rounded rocks. The
banks are too high to climb, and even if they could be scaled, the forest lining
the water's edge is pockmarked with thornbushes.
[ Exits: e s ]
Vivtest the Hunter is standing here.

You have 283 practice sessions remaining.
You know of the following skills:
bandage (superb)
bearhug (superb)
hide (superb)
kick (superb)
rescue (superb)
sneak (superb)
track (superb)

209H 343M 486V >

Will you stand against the coming Storm? After the Breaking: STORMRIDERS MUD - atbmud.dune.net port 4000

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

  • Sascha
  • Sascha's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 2 weeks ago #7985 by Sascha
Nevermind. Thought swim was a skill. Apparently it's just assumed that everyone can swim?

Will you stand against the coming Storm? After the Breaking: STORMRIDERS MUD - atbmud.dune.net port 4000

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

More
3 years 2 weeks ago - 3 years 2 weeks ago #7986 by lacrc
Yeah, looking at the movement code, I think in stock TBA it is assumed that everyone can swim, no specific skill needed.

You can find the checks for movement in act.movement.c under the (kind of big) function do_simple_move().
github.com/tbamud/tbamud/blob/master/src/act.movement.c#L113
(link to the comments before the function cause if you plan to change something you should read all of those eheh)

Movement to 'Water (Swim)' is allowed for everyone but movement to 'Water (No Swim)' sectors require the character to have a boat.
github.com/tbamud/tbamud/blob/master/src/act.movement.c#L176

You could add a similar if but checking instead if the player has the swim skill
if ((SECT(was_in) == SECT_WATER_SWIM) ||
      (SECT(going_to) == SECT_WATER_SWIM))
  {
    if (!IS_NPC(ch) && !GET_SKILL(ch, SKILL_SWIMMING)) /* note that this skill doesn't exist on stock code and needs to be created */
    {
      send_to_char(ch, "You don't know how to swim.\r\n");
      return (0);
    }
  }
Or simply an added movement cost if the player doesn't know the skill (code added after cost is set in need_movement):
  need_movement = (movement_loss[SECT(was_in)] +
		   movement_loss[SECT(going_to)]) / 2;

  if (!IS_NPC(ch) && !GET_SKILL(ch, SKILL_SWIMMING)) 
  {
      need_movement += 2; /* completely arbitrary number lol */
  }
Anyway, just some ideas! Hope it helps! :)
Last edit: 3 years 2 weeks ago by lacrc.
The following user(s) said Thank You: thomas, WhiskyTest, Chime

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

More
3 years 2 weeks ago #8001 by Chime
This is really handy, Iacrc. Great ideas for approaching swim as a skill.
The following user(s) said Thank You: lacrc

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

Time to create page: 0.089 seconds