Welcome to the Builder Academy

Question How do "mob_noXXX" in structs.h connect to the code to do NO_XXX

More
25 Sep 2025 22:40 #10903 by wlessard1
As I look though the code, for example, in constants.c you have under const_char *action_bits[] = {

NO_SUMMN

And somehow this connects with structs.h mob_nosummon along with the other mob_noXXX items.

Just trying to understand the relationship in the code as I cannot find any definitions or functions that seem to use the MOB_NOXXX but they still work.

More a curiosity than anything else.

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
25 Sep 2025 22:56 - 25 Sep 2025 22:58 #10904 by thomas
It is simply set on mob creatin and checked when the summon is attempted:





[ltr] src/structs.h [/ltr]

#define MOB_MEMORY        11  /**< remember attackers if attacked */
#define MOB_HELPER        12  /**< attack PCs fighting other NPCs */
#define MOB_NOCHARM        13  /**< Mob can't be charmed */
#define MOB_NOSUMMON      14  /**< Mob can't be summoned */
#define MOB_NOSLEEP        15  /**< Mob can't be slept */
#define MOB_NOBASH        16  /**< Mob can't be bashed (e.g. trees) */
#define MOB_NOBLIND        17  /**< Mob can't be blinded */


src/spells.c
    }
  }
  if (MOB_FLAGGED(victim, MOB_NOSUMMON) ||
      (IS_NPC(victim) && mag_savingthrow(victim, SAVING_SPELL, 0))) {
    send_to_char(ch, "%s", SUMMON_FAIL);
    return;
Last edit: 25 Sep 2025 22:58 by thomas.

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

More
26 Sep 2025 12:59 #10905 by wlessard1
It was more about the no_anything that I am curious about.

Structs.h doesn't seem to match up with constants.c

Yes in structs.h you have NO_SUMMON
BUT what is no_summn in constants.c? I can see a typo.

I guess what the thing I am asking is...

Structs.h
#define MOB_NO_CHARM 13 /**< Mob can't be charmed */
#define MOB_NOSUMMON 14 /**< Mob can't be summoned */
#define MOB_NOSLEEP 15 /**< Mob can't be slept */
#define MOB_NOBASH 16 /**< Mob can't be bashed (e.g. trees) */
#define MOB_NOBLIND 17 /**< Mob can't be blinded */
#define MOB_NOKILL 18 /**< Mob can't be attacked */

in constants.c except for no_charm they don't match the structs.h defines.

"NO_CHARM",
"NO_SUMMN", Not the same
"NO_SLEEP", Underscore
"NO_BASH", For
"NO_BLIND", These
"NO_KILL", Four

Just trying to understand the relation between constants.c and structs.h in this case.

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
27 Sep 2025 00:26 #10906 by thomas
They match up:
Code:
const char *action_bits[] = { "SPEC", "SENTINEL", "SCAVENGER", "ISNPC", "AWARE", "AGGR", "STAY-ZONE", "WIMPY", "AGGR_EVIL", "AGGR_GOOD", "AGGR_NEUTRAL", "MEMORY", "HELPER", "NO_CHARM", "NO_SUMMN", "NO_SLEEP", "NO_BASH", "NO_BLIND", "NO_KILL", "DEAD", /* You should never see this. */ "\n" };

and
Code:
/* Mobile flags: used by char_data.char_specials.act */ #define MOB_SPEC 0 /**< Mob has a callable spec-proc */ #define MOB_SENTINEL 1 /**< Mob should not move */ #define MOB_SCAVENGER 2 /**< Mob picks up stuff on the ground */ #define MOB_ISNPC 3 /**< (R) Automatically set on all Mobs */ #define MOB_AWARE 4 /**< Mob can't be backstabbed */ #define MOB_AGGRESSIVE 5 /**< Mob auto-attacks everybody nearby */ #define MOB_STAY_ZONE 6 /**< Mob shouldn't wander out of zone */ #define MOB_WIMPY 7 /**< Mob flees if severely injured */ #define MOB_AGGR_EVIL 8 /**< Auto-attack any evil PC's */ #define MOB_AGGR_GOOD 9 /**< Auto-attack any good PC's */ #define MOB_AGGR_NEUTRAL 10 /**< Auto-attack any neutral PC's */ #define MOB_MEMORY 11 /**< remember attackers if attacked */ #define MOB_HELPER 12 /**< attack PCs fighting other NPCs */ #define MOB_NOCHARM 13 /**< Mob can't be charmed */ #define MOB_NOSUMMON 14 /**< Mob can't be summoned */ #define MOB_NOSLEEP 15 /**< Mob can't be slept */ #define MOB_NOBASH 16 /**< Mob can't be bashed (e.g. trees) */ #define MOB_NOBLIND 17 /**< Mob can't be blinded */ #define MOB_NOKILL 18 /**< Mob can't be attacked */ #define MOB_NOTDEADYET 19 /**< (R) Mob being extracted */

match up. The action_bits array is used when showing the bits to the user (typically during stat or olc). For instance, at github.com/tbamud/tbamud/blob/f6339b495e...rc/medit.c#L387-L389 :
Code:
sprintbitarray(MOB_FLAGS(OLC_MOB(d)), action_bits, AF_ARRAY_MAX, flags); write_to_output(d, "\r\nCurrent flags : %s%s%s\r\nEnter mob flags (0 to quit) : ", cyn, flags, nrm);

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

More
27 Sep 2025 14:19 - 27 Sep 2025 14:20 #10907 by wlessard1
I think you are missing my question or I am not asking it right, probably the latter.
How  does MOB_NOKILL connect code wise with NO_KILL

MOB_NOKILL
VS
NO_KILL

I am curious as much as I am trying to understand how they work together?

Might be my latent OCD. I am just trying to understand how it works in the code.

Just a guy coding a mud at home for no reason but the challenge.
Last edit: 27 Sep 2025 14:20 by wlessard1.

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

More
29 Sep 2025 23:20 #10916 by thomas
They both are at the same place in the arrays. So the action_bit "NO_KILL" is on the 18th index in the array.
Code:
action_bits[MOB_NOKILL] == "NO_KILL"

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

Time to create page: 0.286 seconds