Welcome to the Builder Academy

Question Group recall

More
10 Dec 2016 15:29 #6387 by JTP
Group recall was created by JTP
Hey
Made a group recall spell, but it only works 100% if the caster is the leader, if someone else is the leader, then only caster and those listed above caster is recalled, leaving one or more people behind..

Ideas to solve this ?

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

More
10 Dec 2016 21:53 #6388 by WhiskyTest
Replied by WhiskyTest on topic Group recall
My idea would be to iterate through all group members with the simple_list code kinda like this:
Code:
while ((k = (struct char_data *) simple_list(ch->group->members)) != NULL) { < your code for recalling the player here > }

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

More
10 Dec 2016 21:56 #6389 by JTP
Replied by JTP on topic Group recall
My group recall just uses normal recall, with a mag_group define

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

More
11 Dec 2016 22:16 #6391 by JTP
Replied by JTP on topic Group recall
Stock recall code
Attachments:

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

More
11 Dec 2016 22:56 #6392 by thomas
Replied by thomas on topic Group recall
Nice catch.

This happens because, once the caster leaves the room, the rest of the group is no longer with him. This is mag_groups ( github.com/tbamud/tbamud/blob/2f12752373...8a4/src/magic.c#L586 ):

(browser code, beware):
Code:
void mag_groups(int level, struct char_data *ch, int spellnum, int savetype) { struct char_data *tch; if (ch == NULL) return; if (!GROUP(ch)) return; while ((tch = (struct char_data *) simple_list(GROUP(ch)->members)) != NULL) { if (IN_ROOM(tch) != IN_ROOM(ch)) continue; + if (tch == ch) + continue; perform_mag_groups(level, ch, tch, spellnum, savetype); } + perform_mag_groups(level, ch, ch, spellnum, savetype); }

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

More
11 Dec 2016 22:59 #6393 by WhiskyTest
Replied by WhiskyTest on topic Group recall
This function only performs the spell on group members in the same room as the caster. So if the caster recalls before all of the other group members, they get left behind. Not sure if removing that check will cause other group spells to act strangely, but that would be the easiest fix..
Code:
void mag_groups(int level, struct char_data *ch, int spellnum, int savetype) { struct char_data *tch; if (ch == NULL) return; if (!GROUP(ch)) return; while ((tch = (struct char_data *) simple_list(GROUP(ch)->members)) != NULL) { > if (IN_ROOM(tch) != IN_ROOM(ch)) > continue; perform_mag_groups(level, ch, tch, spellnum, savetype); } }

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

Time to create page: 0.260 seconds