Welcome to the Builder Academy

Question How to group charmies of other followers?

More
30 Sep 2022 04:21 - 30 Sep 2022 08:38 #10174 by Nero
I have an issue with group that I can't seem to figure out
The head of the group can add their charmie/follower to the group, however if another player is in the group their charmie cannot be added since the charmie is following the player and not the head of the group.
Is there a way to remedy this to prevent xp loss and allow groups to use group heal etc on other charmies and everyone can be in the same group?
Code:
int perform_group(struct char_data *ch, struct char_data *vict) {   if ((IS_NPC(ch)) && (AFF_FLAGGED(ch, AFF_CHARM))) {     act("$n looks puzzled.", FALSE, ch, 0, 0, TO_ROOM);     return (0);   }   if (AFF_FLAGGED(vict, AFF_GROUP) || !CAN_SEE(ch, vict))     return (0);   SET_BIT_AR(AFF_FLAGS(vict), AFF_GROUP);   if (ch != vict)     act("$N is now a member of your group.", FALSE, ch, 0, vict, TO_CHAR);   act("You are now a member of $n's group.", FALSE, ch, 0, vict, TO_VICT);   act("$N is now a member of $n's group.", FALSE, ch, 0, vict, TO_NOTVICT);   return (1); } void print_group(struct char_data *ch) {   struct char_data *k;   struct follow_type *f;   if (!AFF_FLAGGED(ch, AFF_GROUP))     send_to_char(ch, "But you are not the member of a group!\r\n");   else {     char buf[MAX_STRING_LENGTH];     send_to_char(ch, "Your group consists of:\r\n");     k = (ch->master ? ch->master : ch);     if (AFF_FLAGGED(k, AFF_GROUP)) {       snprintf(buf, sizeof(buf), "   @w[@r%3d@w/@R%3dH @g%3d@w/@G%3dM @y%3d@w/@Y%3dV@w] [%2d %s] $N (Head of group)@n",               GET_HIT(k), GET_MAX_HIT(k), GET_MANA(k), GET_MAX_MANA(k), GET_MOVE(k), GET_MAX_MOVE(k), GET_LEVEL(k), CLASS_ABBR(k));       act(buf, FALSE, ch, 0, k, TO_CHAR);     }     for (f = k->followers; f; f = f->next) {       if (!AFF_FLAGGED(f->follower, AFF_GROUP))         continue;       snprintf(buf, sizeof(buf), "   @w[@r%3d@w/@R%3dH @g%3d@w/@G%3dM @y%3d@w/@Y%3dV@w] [%2d %s] $N@n",               GET_HIT(f->follower), GET_MAX_HIT(f->follower), GET_MANA(f->follower), GET_MAX_MANA(f->follower),         GET_MOVE(f->follower), GET_MAX_MOVE(f->follower), GET_LEVEL(f->follower), CLASS_ABBR(f->follower));       act(buf, FALSE, ch, 0, f->follower, TO_CHAR);     }   } } ACMD(do_group) {   char buf[MAX_STRING_LENGTH];   struct char_data *vict;   struct follow_type *f;   int found;   one_argument(argument, buf);   if (!*buf) {     print_group(ch);     return;   }   if (ch->master) {     act("You can not enroll group members without being head of a group.",           FALSE, ch, 0, 0, TO_CHAR);     return;   }   if (!str_cmp(buf, "all")) {     perform_group(ch, ch);     for (found = 0, f = ch->followers; f; f = f->next)       found += perform_group(ch, f->follower);     if (!found)       send_to_char(ch, "Everyone following you is already in your group.\r\n");     return;   }   if (!(vict = get_char_room_vis(ch, buf)))     send_to_char(ch, "%s", CONFIG_NOPERSON);   else if ((vict->master != ch) && (vict != ch))     act("$N must follow you to enter your group.", FALSE, ch, 0, vict, TO_CHAR);   else {     if (!AFF_FLAGGED(vict, AFF_GROUP))       perform_group(ch, vict);     else {       if (ch != vict)         act("$N is no longer a member of your group.", FALSE, ch, 0, vict, TO_CHAR);       act("You have been kicked out of $n's group!", FALSE, ch, 0, vict, TO_VICT);       act("$N has been kicked out of $n's group!", FALSE, ch, 0, vict, TO_NOTVICT);       REMOVE_BIT_AR(AFF_FLAGS(vict), AFF_GROUP);     }   } } ACMD(do_ungroup) {   char buf[MAX_INPUT_LENGTH];   struct follow_type *f, *next_fol;   struct char_data *tch;   one_argument(argument, buf);   if (!*buf) {     if (ch->master || !(AFF_FLAGGED(ch, AFF_GROUP))) {       send_to_char(ch, "But you lead no group!\r\n");       return;     }     for (f = ch->followers; f; f = next_fol) {       next_fol = f->next;       if (AFF_FLAGGED(f->follower, AFF_GROUP)) {         REMOVE_BIT_AR(AFF_FLAGS(f->follower), AFF_GROUP);         act("$N has disbanded the group.", TRUE, f->follower, NULL, ch, TO_CHAR);         if (!AFF_FLAGGED(f->follower, AFF_CHARM))           stop_follower(f->follower);       }     }     REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_GROUP);     send_to_char(ch, "You disband the group.\r\n");     return;   }   if (!(tch = get_char_room_vis(ch, buf))) {     send_to_char(ch, "There is no such person!\r\n");     return;   }   if (tch->master != ch) {     send_to_char(ch, "That person is not following you!\r\n");     return;   }   if (!AFF_FLAGGED(tch, AFF_GROUP)) {     send_to_char(ch, "That person isn't in your group.\r\n");     return;   }   REMOVE_BIT_AR(AFF_FLAGS(tch), AFF_GROUP);   act("$N is no longer a member of your group.", FALSE, ch, 0, tch, TO_CHAR);   act("You have been kicked out of $n's group!", FALSE, ch, 0, tch, TO_VICT);   act("$N has been kicked out of $n's group!", FALSE, ch, 0, tch, TO_NOTVICT);   if (!AFF_FLAGGED(tch, AFF_CHARM))     stop_follower(tch); }
Last edit: 30 Sep 2022 08:38 by Nero.

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

More
01 Oct 2022 21:39 #10179 by thomas
It's not difficult to alter those functions to allow "chaining"; The loops need to be made recursive. However, it's somewhat more complicated than a simple web post merits.
I'll see if I can come back with a more thorough answer later.

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

More
01 Oct 2022 22:40 #10181 by thomas
Hmm.. I realize now that the coe you're showing us is not the current tbamud code. This was changed a while back to Vatikens group system. Have a look in  github.com/tbamud/tbamud/blob/master/src/act.other.c#L369
This already supports what you want, but requires you to order your pets to join the group. 

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

More
01 Oct 2022 23:07 #10183 by Nero
Thank you I saw this was viewing this group setup after I had posted this question and had wondered if it would work for the pets. Thanks for clarifying.

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

More
02 Oct 2022 04:20 #10184 by Nero
For some reason I get this error when trying to boot up after inputting the group stuff
Attachments:

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

More
02 Oct 2022 09:03 #10185 by zusuk
Nero!! Is that you? Glad to see you are still at it man :) Come catch up with us sometime...

Just off the top of my head, you may be missing an #include or didn't add something that you need in the header file(s), or declared locally before using it.

Like two of those functions I have declared on the top of act.other.c (after the includes):
Code:
/* do_group utility functions */ static void print_group(struct char_data *ch); static void display_group_list(struct char_data *ch);

It's weird you don't have get_char_vis()...  it's in handler.h, so maybe just double check you aren't missing the function or maybe you didn't include the header:
Code:
#include "handler.h"

Best regards,
Zusuk
LuminariMUD.com:4100

Website
www.luminariMUD.com

Main Game Port
luminariMUD.com:4100

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

Time to create page: 0.204 seconds