Welcome to the Builder Academy

Question Charmed MOBs and new Summoned MOBs not assisting master.

More
16 Oct 2025 05:23 #10932 by wlessard1
Basic problem is that Charmed MOBs are not assisting and additionally the new summoned mobs are not either.

I added a MOB flag
MOB_ASSIST
I set the flag, via NPC FLAGS. 

I have tried adding a check for "MOB_ASSIST"

But I am not sure I am writing it correctly or even putting it where it needs to go.
in fight.c under perform_violence
or
in spell_charm itself
or somewhere else?
Code:
    /* Auto-assist for mobs with MOB_ASSIST flag */     if (IS_NPC(ch) && MOB_FLAGGED(ch, MOB_ASSIST) && ch->master && IN_ROOM(ch) == IN_ROOM(ch->master)) {       if (FIGHTING(ch->master) && !FIGHTING(ch)) {         log("DEBUG: %s attempting to assist %s.", GET_NAME(ch), GET_NAME(ch->master));         do_assist(ch, GET_NAME(ch->master), 0, 0); // Call do_assist to join master's fight       } else {         log("DEBUG: %s not assisting: master not fighting or mob already fighting.", GET_NAME(ch));       }     } else {       log("DEBUG: %s failed MOB_ASSIST check: not NPC, no MOB_ASSIST, no master, or wrong room.", GET_NAME(ch));       }     if (GET_POS(ch) < POS_FIGHTING) {       send_to_char(ch, "You can't fight while sitting!!\r\n");       continue;     }

I put this in perform_violence in fight.c between get_mob_wait and if Group(ch)

BUT still no go with getting the mobs to assist.

Thanks for any help.

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
16 Oct 2025 22:23 #10933 by thomas
I would put the check in perform_violence, after the block setting autoassist.

I think you need to check "the other way". The list you are checking there is the combat_list, and only those fighting are on it.
Instead, I'd loop over the followers list, check if they were in the same room, mobs, had the flag, not fighting. If all is true, set them fighting ch's target.
The following user(s) said Thank You: wlessard1

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

More
Yesterday 20:58 #10934 by wlessard1
Okay took your advice and did a little rework. Now summoned MOBs and charmed MOBs are assisting as they should, in my opinion.
I probably didn't need to go so far as to add a "MOB_ASSSIST" flag as a summoned mob is given "aff_charm"

So here it is both ways. Not that I looked at some act.offensive.c code and I got lazy and just kept the k variable concept. Probably didn't have to do that either. BUT it works fine for both charmed and summoned.
Code:
non mob_assist code /* Auto-assist for charmed followers */ struct follow_type *k; /* Declared properly */ for (k = ch->followers; k; k = k->next) {   struct char_data *mob = k->follower;   if (IS_NPC(mob) && AFF_FLAGGED(mob, AFF_CHARM) &&       IN_ROOM(ch) == IN_ROOM(mob) && FIGHTING(ch) && !FIGHTING(mob)) {     log("DEBUG: %s auto-assisting master %s.", GET_NAME(mob), GET_NAME(ch));     do_assist(mob, GET_NAME(ch), 0, 0); /* Call do_assist to join master's fight */   } else {     log("DEBUG: %s not assisting %s: failed NPC, AFF_CHARM, same room, or not fighting check.",         GET_NAME(mob), GET_NAME(ch));   } } mob_assist code. /* Auto-assist for charmed or MOB_ASSIST followers */     for (k = ch->followers; k; k = k->next) {       struct char_data *mob = k->follower;       if (IS_NPC(mob) && (MOB_FLAGGED(mob, MOB_ASSIST) || AFF_FLAGGED(mob, AFF_CHARM)) &&           IN_ROOM(ch) == IN_ROOM(mob) && FIGHTING(ch) && !FIGHTING(mob)) {         log("DEBUG: %s auto-assisting master %s.", GET_NAME(mob), GET_NAME(ch));         do_assist(mob, GET_NAME(ch), 0, 0); /* Call do_assist to join master's fight */       } else {         log("DEBUG: %s not assisting %s: failed NPC, MOB_ASSIST/AFF_CHARM, same room, or not fighting check.",             GET_NAME(mob), GET_NAME(ch));       }     }

I goes right after the group check and before the hit(ch, FIGHTING(ch), TYPE_UNDEFINED); line.

Thanks for the suggestions and help figuring this out. 

ALWAYS much appreciated.

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.

Time to create page: 0.269 seconds