New Group System: Version 1.1

  • Vatiken
  • Vatiken's Avatar Topic Author
  • Offline
  • Administrator
  • Administrator
  • tbaMUD Programmer
More
6 years 5 months ago #59 by Vatiken
New Group System: Version 1.1 was created by Vatiken

CHANGELOG FROM 1.0 -> 1.1:
1) Fixed Memory Leak in free_group()
2) Moved from SimpleList to Iterated List for safety reason
3) Summoned Creatures now automatically join your group if you are the leader
4) Groups started by NPCs or inhabited by NPCS no longer appear on the group list
5) NPC and PC groups are identified when looking at the room.

Group System 1.1 Download

tbaMUD developer/programmer

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

More
6 years 5 months ago - 6 years 5 months ago #60 by Halenbane
Replied by Halenbane on topic New Group System: Version 1.1
This is much appreciated. I had the prior group version working just fine, but a few errors im still tracking down while doing this.

act.other.c:362: error: expected identifier or '(' before 'if'
act.other.c:369: error: expected identifier or '(' before 'else'
act.other.c:372: error: expected identifier or '(' before '}' token

static void display_group_list(struct char_data * ch)
{
  struct group_data * group;
  int count = 0;

  if (group_list->iSize) {
    send_to_char(ch, "#   Group Leader     # of Members    In Zone\r\n"
                     "---------------------------------------------------\r\n");

    while ((group = (struct group_data *) simple_list(group_list)) != NULL)
       if (IS_SET(GROUP_FLAGS(group), GROUP_NPC))
         continue;
       if (GROUP_LEADER(group) && !IS_SET(GROUP_FLAGS(group), GROUP_ANON))
         send_to_char(ch, "%-2d) %s%-12s     %-2d              %s%s\r\n",
           ++count,
           IS_SET(GROUP_FLAGS(group), GROUP_OPEN) ? CCGRN(ch, C_NRM) : CCRED(ch, C_NRM),
           GET_NAME(GROUP_LEADER(group)), group->members->iSize, zone_table[world[IN_ROOM(G$
           CCNRM(ch, C_NRM));
       else
        send_to_char(ch, "%-2d) Hidden\r\n", ++count);

            }
        }
        if (count)
    send_to_char(ch, "\r\n"
                     "%sSeeking Members%s\r\n"
                     "%sClosed%s\r\n",
                     CCGRN(ch, C_NRM), CCNRM(ch, C_NRM),
                     CCRED(ch, C_NRM), CCNRM(ch, C_NRM));

    else
      send_to_char(ch, "\r\n"
               "Currently no groups formed.\r\n");
}



Also, weird thing is , the snip you have for spells.c , I don't seem to have

load_mtrigger(undead);
add_follower(undead, ch);

or

for (tobj = obj->contains; tobj; tobj = next_obj) {
next_obj = tobj->next_content;
obj_from_obj(tobj);

I don't recall deleting any portion of that code. My spells.c is only 451 lines..

Is this something maybe you have added to the source you are working on?
Last edit: 6 years 5 months ago by Vatiken. Reason: Code Tags

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

More
6 years 5 months ago #61 by Halenbane
Replied by Halenbane on topic New Group System: Version 1.1
Also I have noticed you reference to -528,6 +528,9 in the update, but spells.c sits around 450 lines or so. I double checked the one on SVN to make sure I wasn't just missing something in mine, and its around the same , 450 some.

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

  • Vatiken
  • Vatiken's Avatar Topic Author
  • Offline
  • Administrator
  • Administrator
  • tbaMUD Programmer
More
6 years 5 months ago #62 by Vatiken
Replied by Vatiken on topic New Group System: Version 1.1
while ((group = (struct group_data *) simple_list(group_list)) != NULL)
Should be:
while ((group = (struct group_data *) simple_list(group_list)) != NULL) {
Thanks for pointing out the spells.c things, I just removed that from the file. It's unnecessary. The "update" is just an svn diff from my own MUD, and I have a custom animate dead spell in spells.c that uses that code. I also apologize if some of the formatting is a little weird, Geany (IDE) likes to hide tabs in the code, and I apparently missed removing a couple.

tbaMUD developer/programmer

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

More
6 years 5 months ago #63 by Halenbane
Replied by Halenbane on topic New Group System: Version 1.1
Not tearing apart your code, just figured I would show what is coming up from a manual patch.

handler.c:1443: error: 'tch' undeclared (first use in this function)
handler.c:1443: error: (Each undeclared identifier is reported only once
handler.c:1443: error: for each function it appears in.)
handler.c:1443: error: 'Iterator' undeclared (first use in this function)
handler.c:1446: error: 'found_pc' undeclared (first use in this function)

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

  • Vatiken
  • Vatiken's Avatar Topic Author
  • Offline
  • Administrator
  • Administrator
  • tbaMUD Programmer
More
6 years 5 months ago #64 by Vatiken
Replied by Vatiken on topic New Group System: Version 1.1
Looks like you forgot to add the top part:
@@ -1513,6 +1518,9 @@
 void leave_group(struct char_data *ch)
 {
   struct group_data *group;
+  struct char_data *tch;
+  struct iterator_data Iterator;
+  bool found_pc = FALSE;
 	
   if ((group = ch->group) == NULL)
     return;
@@ -1522,6 +1530,14 @@
   remove_from_list(ch, group->members);
   ch->group = NULL;
   
+  if (group->members->iSize)
+    for (tch = (struct char_data *) merge_iterator(&Iterator, group->members);
+      tch; 
+        tch = next_in_list(&Iterator))
+          if (!IS_NPC(tch)) found_pc = TRUE;
+          
+  remove_iterator(&Iterator);  
+ 
+ if (!found_pc)
+   SET_BIT(GROUP_FLAGS(group), GROUP_NPC);
 

tbaMUD developer/programmer
The following user(s) said Thank You: Halenbane

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

More
6 years 5 months ago #65 by Liko
Replied by Liko on topic New Group System: Version 1.1
It was pretty simple to upgrade from 1.0 to 1.1.

DragonBall: Tournament (1.2.0)
Owner/Developer

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

More
6 years 5 months ago #66 by Halenbane
Replied by Halenbane on topic New Group System: Version 1.1
Yeah not sure how I overlooked that, but compiles fine. I'll test it thoroughly over the next few days and post any issues.

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

More
6 years 5 months ago #68 by Halenbane
Replied by Halenbane on topic New Group System: Version 1.1
Few issues I've seen.

It is my understanding you didn't want others to be able to join a group that included npc's.
If a player starts a group, and then summons a follower, the follower joins the group, but the group
is still listed as a normal group, and others are able to join.

Also I crashed the mud doing the following:

Start group -> Summon follower -> group leave -> (Follower becomes leader)

-> group join follower -> order follower group leave (Leaving only me)

-> group leave (Leave the group as the last person) = CRASH

Crashlog = Jun 13 06:59:20 :: SYSERR: Attempting to remove iterator from NULL list.

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

  • Vatiken
  • Vatiken's Avatar Topic Author
  • Offline
  • Administrator
  • Administrator
  • tbaMUD Programmer
More
6 years 4 months ago #71 by Vatiken
Replied by Vatiken on topic New Group System: Version 1.1

It is my understanding you didn't want others to be able to join a group that included npc's.
If a player starts a group, and then summons a follower, the follower joins the group, but the group
is still listed as a normal group, and others are able to join.

Incorrect:
The point is that groups consisting purely of NPCs (like a band of npc patrols) would not appear on the group list. The sole purpose of this was just to cut down on clutter on the group list.

Also I crashed the mud doing the following:

Unfortunately Correct:
Another porting issue, I'm gonna need to find a more streamlined approach to releasing snippets.

In handler.c: leave_group()
-  if (group->members->iSize)
+  if (group->members->iSize) {
    for (tch = (struct char_data *) merge_iterator(&Iterator, group->members);
      tch; 
        tch = next_in_list(&Iterator))
          if (!IS_NPC(tch)) found_pc = TRUE;
          
  remove_iterator(&Iterator);  
+  }

tbaMUD developer/programmer

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

More
6 years 4 months ago #72 by Halenbane
Replied by Halenbane on topic New Group System: Version 1.1
Aha! I never even thought of grouping npc's. *Develops a sinister grin*

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

More
6 years 4 months ago - 6 years 4 months ago #73 by Halenbane
Replied by Halenbane on topic New Group System: Version 1.1
Something else ive noticed, and maybe you intended it this way.

When someone is in a group by themselves, it displays

(leader) Halenbane is standing here.(leader)

with leader being in red (I thought that was if the group was closed, as it is in group list)

When someone is leader of a group that consists of more than 1 person, then it toggles to green (leader).


Did you want it to show before and after their name?

It does the same thing for followers.

(group) Halenbane is standing here.(group)
Last edit: 6 years 4 months ago by Halenbane.

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

More
6 years 4 months ago #74 by Halenbane
Replied by Halenbane on topic New Group System: Version 1.1
Another thing :)

If PlayerA starts the group

PlayerB joins group

PlayerB casts a summon spell (animate dead)

The follower doesn't autojoin the group.

This does function correctly if you are leader of the group or have no group tho.

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

  • Vatiken
  • Vatiken's Avatar Topic Author
  • Offline
  • Administrator
  • Administrator
  • tbaMUD Programmer
More
6 years 4 months ago #75 by Vatiken
Replied by Vatiken on topic New Group System: Version 1.1
The trailing group was removed when moving to 1.1, the reason was to allow the "(group)" tag to display on the same line for both NPCs and PCs.

tbaMUD developer/programmer

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

More
6 years 4 months ago - 6 years 4 months ago #76 by Halenbane
Replied by Halenbane on topic New Group System: Version 1.1
You mean with what you released recently? I patched all of that in and still have (leader) before and after the name.


Also, I could have swore that earlier it was creating a group for a person summoning followers automatically. Now it doesn't seem to be. Weeird :P
Last edit: 6 years 4 months ago by Halenbane.

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

  • Vatiken
  • Vatiken's Avatar Topic Author
  • Offline
  • Administrator
  • Administrator
  • tbaMUD Programmer
More
6 years 4 months ago #77 by Vatiken
Replied by Vatiken on topic New Group System: Version 1.1

Another thing :)

If PlayerA starts the group

PlayerB joins group

PlayerB casts a summon spell (animate dead)

The follower doesn't autojoin the group.

This does function correctly if you are leader of the group or have no group tho.

This is intentional to prevent other members of the group, or NPC members from adding to the group through summoning spells.
Perhaps you could set it so summoned NPC's from non-leaders would only be auto-added to the group if the group is flagged open.

Also, I could have swore that earlier it was creating a group for a person summoning followers automatically. Now it doesn't seem to be. Weeird :P

I do believe this was something you had added to your own as mentioned in an earlier thread. Because some players might not want summoned NPC's to join their group (Shared exp), I felt it best to only apply an AUTO-JOIN if the player commits him/herself to the leader of a new group.

You mean with what you released recently? I patched all of that in and still have (leader) before and after the name.

My apologies as this apparently didn't make it into the group.update, it is however, consistent with the actual patch.

tbaMUD developer/programmer
The following user(s) said Thank You: Halenbane

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

More
5 years 6 months ago #2183 by JTP
Replied by JTP on topic New Group System: Version 1.1
Is there a more detailed help for the new Group, help Group online doesnt tell how to open close a Group.

Cant find Group options.

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

More
5 years 6 months ago #2184 by Rumble
Replied by Rumble on topic New Group System: Version 1.1
Updated help file on TBA:

Usage: group
group < list | new | join | leave | options | kick >

GROUP with no arguments shows the status of your group. GROUP list will show
you a listing of all groups within the game, as well as their zone location and
whether or not they are seeking new members.

If you are a group member, then you will share experience points for killing
monsters equally among the group. Experience points will only be shared among
group members that are in the same location, at the time of the killing
blow. Sharing is regardless of whether the group members have been
participating in the fight.

To join a group, you must target a member of an "open" group (as in accepting
new members) and use GROUP join <player name>.

Example:
Rumble wishes to join Vatiken's group, so assuming Vatiken has set his group
to open. Rumble then types:

> group join Vatiken

To make a group, the wannabe "leader" will use the GROUP new command:
> group new

To leave a group, simple use GROUP leave:
> group leave

If the leader leaves the group and one or more members still exists, a new
leader will be chosen at random, otherwise the group will be disbanded.

Group Leaders:

To edit the options in a group, use the GROUP option <option> commands.
> group option anonymous : Group information will be hidden/revealed
> group option open : Group will be open/closed to new members

To kick someone from the group, use GROUP kick <player name>
> group kick rumble

See also: FOLLOW, EXPERIENCE, UNGROUP, GSAY, ASSIST, GROUPS, REPORT


Rumble
The Builder Academy
tbamud.com 9091

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

Time to create page: 2.243 seconds