Welcome to the Builder Academy

Question Trying to do two things to incorporate a form of drowning

More
17 Sep 2025 20:56 #10897 by wlessard1
First, I have all the pieces in place for aff_breathewater and spell_breathewater

So first question.
Can I use a line like this...
!IS_AFFECTED(ch, AFF_BREATHEWATER)
to check to see if character is not affected by Breathewater
AND
I am looking for it to update on the tick but not sure what function might do that?

Thanks

Just a guy coding a mud at home for no reason but the challenge.

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

More
18 Sep 2025 22:45 #10899 by thomas
If you make it like a spell (which is quite easy - look in magic.c for mag_affects), you can use AFF_FLAGGED(ch, AFF_BREATHEWATER) to check if the character is affected. Using standard magic setup also means the duration will decrease on every tick automatically
The following user(s) said Thank You: wlessard1

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

More
22 Sep 2025 10:18 #10900 by wlessard1
This goes in limits.c in the point_update function.
Just after aff_poison check and before if get_pos(i) <= POS_STUNNED
Code:
    /* Drowning effect for underwater room per Bramage */   if (IN_ROOM(i) != NOWHERE && world[IN_ROOM(i)].sector_type == SECT_UNDERWATER) {   if (AFF_FLAGGED(i, AFF_BREATHEWATER)) {               send_to_char(i, "\tcyou are able to breathe underwater.\tn\r\n");       } if (GET_LEVEL(i) >= LVL_IMMORT) {   send_to_char(i, "\r\n");   } else {         // Roll CON check first         if (rand_number(1, 25) <= GET_CON(i)) {             // Success - take half damage             int dam = rand_number(10, 75) / 2;             if (dam > 0) {                 damage(i, i, dam, TYPE_UNDEFINED);                 send_to_char(i, "Damage: %d!\r\n", dam);                 send_to_char(i, "You hold your breath barely, lessening the strain!\r\n");             }         } else {             // Failure - take full damage             int dam = damage(i, i, rand_number(10, 75), TYPE_UNDEFINED);             send_to_char(i, "\tRDamage:  %d!\tn\r\n", dam);             GET_MOVE(i) = MAX(0, (GET_MOVE(i) - (rand_number(5, 50))));             if (dam == -1) {                 continue; /* Oops, they died */             }             send_to_char(i, "\tRYou choke and struggle to breathe underwater!\tn\r\n");         }     } }

Not sure of the number of brackets, if I included all or not enough.
I also added spell_breathewater and aff_breathewater to make this all go together.

Just a guy coding a mud at home for no reason but the challenge.
The following user(s) said Thank You: thomas

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

Time to create page: 0.174 seconds