MOB Flags Reference

Complete reference for mobile behavior flags

This document provides comprehensive information about all mobile flags (MOB_*) used in LuminariMUD. Mobile flags control NPC behaviors, abilities, restrictions, and special mechanics throughout the game world.


Overview

Mobile flags are bitflags defined in src/structs.h (lines 1131-1232) and are checked throughout the codebase using the MOB_FLAGGED() macro. There are currently 101 mobile flags (indices 0-100) that control everything from basic AI behavior to special monster abilities.

Usage Pattern:

if (MOB_FLAGGED(mob, MOB_FLAGNAME)) {
    // Flag is set, apply behavior/restriction
}

Basic Behavior Flags

MOB_SPEC (Index: 0) System

Effect: Indicates the mobile has a special procedure (spec-proc) attached.

  • Special procedures provide custom scripted behaviors
  • Executed during mobile activity updates
  • Used for quest NPCs, shopkeepers, trainers, etc.

Code References: spec_procs.c, spec_assign.c

MOB_SENTINEL (Index: 1) Behavior

Effect: Mobile will not move from its current location.

  • Prevents wandering and random movement
  • Mobile stays in its spawn location
  • Can still be dragged/summoned by magic
  • Used for stationary guards, shopkeepers, and landmark NPCs

Code References: mob_act.c:397, 419, 431 | utils.c:7171

MOB_SCAVENGER (Index: 2) Behavior

Effect: Mobile picks up items from the ground.

  • Randomly collects objects in the same room
  • 1 in 10 chance per update cycle
  • Used for goblin looters, pack rats, etc.

Code References: mob_act.c:162

MOB_AWARE (Index: 4) Combat

Effect: Mobile cannot be backstabbed or surprise attacked.

  • Prevents backstab attacks from rogues
  • Blocks sneak attacks and similar abilities
  • Used for alert guards, paranoid NPCs, creatures with special senses

Code References: act.offensive.c:4076, 8940

MOB_WIMPY (Index: 7) Behavior

Effect: Mobile flees when severely injured.

  • Automatically flees when HP drops below threshold
  • Used for cowardly creatures and civilians
  • Behavior similar to player wimpy setting

Code References: fight.c:5779 | mob_act.c:196

MOB_SENTIENT (Index: 19) Classification

Effect: Marks mobile as sentient/intelligent.

  • Used for intelligent creatures and humanoids
  • May affect certain spell interactions
  • Thematic flag for creature classification

MOB_LISTEN (Index: 34) Behavior

Effect: Mobile enters room if it hears fighting nearby.

  • Responds to combat sounds in adjacent rooms
  • Used for reinforcement mechanics
  • Guards and aggressive creatures use this

MOB_LIT (Index: 35) Environment

Effect: Mobile emits light.

  • Acts as a light source in dark rooms
  • Creatures made of fire, glowing undead, etc.
  • Affects visibility calculations

Aggression & Alignment Flags

MOB_AGGRESSIVE (Index: 5) Combat

Effect: Mobile automatically attacks all nearby characters.

  • Attacks everyone who enters the room
  • Conflicts with MOB_HELPER flag
  • Used for hostile monsters and aggressive creatures
Note: When set, MOB_HELPER is automatically removed to prevent conflicts.

Code References: mob_act.c:221 | limits.c:2245 | db.c:3173-3177

MOB_AGGR_EVIL (Index: 8) Combat

Effect: Mobile attacks evil-aligned characters on sight.

  • Only attacks players/NPCs with evil alignment
  • Requires MOB_AGGRESSIVE to also be set
  • Used for paladins, good-aligned guards

MOB_AGGR_GOOD (Index: 9) Combat

Effect: Mobile attacks good-aligned characters on sight.

  • Only attacks players/NPCs with good alignment
  • Requires MOB_AGGRESSIVE to also be set
  • Used for demons, evil priests, undead

MOB_AGGR_NEUTRAL (Index: 10) Combat

Effect: Mobile attacks neutral-aligned characters on sight.

  • Only attacks players/NPCs with neutral alignment
  • Requires MOB_AGGRESSIVE to also be set
  • Used for extremist NPCs

Immunity & Restriction Flags

MOB_NOCHARM (Index: 13) Immunity

Effect: Mobile cannot be charmed or mind-controlled.

  • Blocks charm person, dominate, and similar spells
  • Used for strong-willed creatures, undead, constructs
  • Essential for boss monsters

Code References: spells.c:388 | spec_abilities.c:611, 622, 640, 1359

MOB_NOSUMMON (Index: 14) Immunity

Effect: Mobile cannot be summoned or teleported.

  • Prevents summon monster spells from bringing this mob
  • Blocks gate and similar effects
  • Used for bosses and unique creatures

MOB_NOSLEEP (Index: 15) Immunity

Effect: Mobile cannot be put to sleep.

  • Blocks sleep spells and effects
  • Used for elves, undead, constructs
  • Essential for creatures that don't sleep

MOB_NOBASH (Index: 16) Immunity

Effect: Mobile cannot be bashed or knocked down.

  • Prevents shield bash and similar attacks
  • Used for trees, huge creatures, incorporeal beings
  • Affects tactical combat options

MOB_NOBLIND (Index: 17) Immunity

Effect: Mobile cannot be blinded.

  • Blocks blindness spells and effects
  • Used for creatures with special vision (tremorsense, blindsight)
  • Oozes, creatures without eyes

MOB_NOKILL (Index: 18) Immunity

Effect: Mobile cannot be attacked by players.

  • Complete immunity to player attacks
  • Used for quest NPCs, essential storyline characters
  • Can still be damaged by environmental effects

MOB_NODEAF (Index: 22) Immunity

Effect: Mobile cannot be deafened.

  • Blocks deafness effects
  • Used for creatures without hearing or magical entities

MOB_NOGRAPPLE (Index: 25) Immunity

Effect: Mobile cannot be grappled or grabbed.

  • Prevents grapple combat maneuvers
  • Used for incorporeal creatures, very large/small creatures
  • Affects melee combat tactics

MOB_NOCONFUSE (Index: 62) Immunity

Effect: Mobile cannot be confused.

  • Blocks confusion spells and effects
  • Used for mindless creatures, high-intelligence beings

MOB_NOPARALYZE (Index: 97) Immunity

Effect: Mobile cannot be paralyzed.

  • Blocks hold person, paralysis, and similar effects
  • Used for creatures immune to paralysis
  • Essential for certain creature types

MOB_NOSTEAL (Index: 37) Immunity

Effect: Mobile cannot be stolen from.

  • Prevents pickpocket attempts
  • Used for important NPCs, alert guards
  • Protects quest items

Movement & Blocking Flags

MOB_STAY_ZONE (Index: 6) Movement

Effect: Mobile will not wander outside its home zone.

  • Restricts random movement to current zone
  • Prevents mobs from wandering into neighboring zones
  • Used for zone-specific creatures

Directional Blocking Flags (Index: 45-54) Blocking

Effect: Mobile physically blocks movement in specific directions.

  • MOB_BLOCK_N (45) - Blocks north
  • MOB_BLOCK_E (46) - Blocks east
  • MOB_BLOCK_S (47) - Blocks south
  • MOB_BLOCK_W (48) - Blocks west
  • MOB_BLOCK_NE (49) - Blocks northeast
  • MOB_BLOCK_SE (50) - Blocks southeast
  • MOB_BLOCK_SW (51) - Blocks southwest
  • MOB_BLOCK_NW (52) - Blocks northwest
  • MOB_BLOCK_U (53) - Blocks up
  • MOB_BLOCK_D (54) - Blocks down

Characters cannot pass through in the blocked direction unless they meet bypass conditions.

Code References: movement.c:622-640

Blocking Exemption Flags (Index: 55-59, 90-92) Blocking

Effect: Define exemptions to directional blocking.

  • MOB_BLOCK_CLASS (55) - Allows same class to pass
  • MOB_BLOCK_RACE (56) - Allows same race to pass
  • MOB_BLOCK_LEVEL (57) - Allows lower levels to pass
  • MOB_BLOCK_ALIGN (58) - Allows same alignment to pass
  • MOB_BLOCK_ETHOS (59) - Allows same ethos to pass
  • MOB_BLOCK_EVIL (90) - Specifically blocks evil
  • MOB_BLOCK_NEUTRAL (91) - Specifically blocks neutral
  • MOB_BLOCK_GOOD (92) - Specifically blocks good

Code References: movement.c:643-661


Combat Helper Flags

MOB_MEMORY (Index: 11) Combat

Effect: Mobile remembers characters who attack it.

  • Tracks attackers even after combat ends
  • Will attack remembered enemies on sight
  • Memory persists until mob dies or memory is cleared
  • Used for intelligent creatures and guards

Code References: mob_memory.c:31 | fight.c:5154, 5475, 12301 | graph.c:411

MOB_HELPER (Index: 12) Combat

Effect: Mobile assists other NPCs fighting against players.

  • Jumps into combat to help fellow NPCs
  • Conflicts with MOB_AGGRESSIVE flag
  • Used for pack tactics and coordinated defense

Code References: mob_act.c:190, 285, 291 | limits.c:2246

MOB_GUARD (Index: 31) Combat

Effect: Mobile protects citizens and assists them in combat.

  • Specifically protects NPCs with MOB_CITIZEN flag
  • More selective than MOB_HELPER
  • Used for city guards and protectors

Code References: mob_act.c:285, 290, 311, 313 | missions.c:511, 633, 732

MOB_CITIZEN (Index: 32) Classification

Effect: Mobile is protected by guards.

  • Guards will defend this NPC
  • Used for shopkeepers, quest NPCs, civilians
  • Creates natural guard/citizen relationships

Code References: mob_act.c:311, 313 | missions.c:518, 640, 739

MOB_HUNTER (Index: 33) Combat

Effect: Mobile actively tracks down and hunts enemies.

  • Aggressively pursues targets across multiple rooms
  • Combines with MOB_MEMORY for persistent pursuit
  • Used for predators and assassins

Code References: mob_act.c:371 | fight.c:5486

MOB_MOB_ASSIST (Index: 61) Combat

Effect: Mobile will assist other mobs in its group/following.

  • Enables mob-to-mob cooperation
  • Used for coordinated monster groups
  • Affects tactical combat

Code References: mob_act.c:303

MOB_HUNTS_TARGET (Index: 63) Combat

Effect: Mobile hunts specific target(s).

  • More focused than general hunter behavior
  • Used for assassination missions and bounty hunters

Companion & Summoned Creature Flags

These flags identify creatures summoned or obtained through various class abilities and spells. They affect how the creatures scale, their abilities, and special rules that apply to them.

MOB_C_ANIMAL (Index: 26) Companion

Effect: Mobile is a ranger's animal companion.

MOB_C_FAMILIAR (Index: 27) Companion

Effect: Mobile is a wizard's/sorcerer's familiar.

MOB_C_MOUNT (Index: 28) Companion

Effect: Mobile is a summoned/companion mount.

MOB_MOUNTABLE (Index: 21) Companion

Effect: Mobile can be mounted and ridden.

Code References: act.other.c:2457, 2561 | movement_cost.c:38 | evolutions.c:715

MOB_ELEMENTAL (Index: 29) Companion

Effect: Mobile is an elemental creature.

MOB_ANIMATED_DEAD (Index: 30) Companion

Effect: Mobile is animated undead.

MOB_MERCENARY (Index: 41) Companion

Effect: Mobile is a hired mercenary (only one per person).

MOB_SHADOW (Index: 43) Companion

Effect: Mobile is a shadowdancer's shadow companion.

MOB_EIDOLON (Index: 89) Companion

Effect: Mobile is a summoner's eidolon (powerful customizable companion).

MOB_RETAINER (Index: 95) Companion

Effect: Mobile is a leadership retainer/cohort.

Other Companion Flags: MOB_PLANAR_ALLY (36), MOB_C_O_T_N (85), MOB_VAMP_SPWN (86), MOB_DRAGON_KNIGHT (87), MOB_MUMMY_DUST (88), MOB_GENIEKIND (93), MOB_C_DRAGON (94)


Special Ability Flags

These flags grant NPCs special combat abilities, breath weapons, and magical powers. Many correspond to classic D&D monster abilities.

Combat Abilities

  • MOB_ABIL_GRAPPLE (64) - Can perform grapple attacks
  • MOB_ABIL_PETRIFY (65) - Can turn enemies to stone
  • MOB_ABIL_TAIL_SPIKES (66) - Can fire tail spikes
  • MOB_ABIL_LEVEL_DRAIN (67) - Can drain character levels
  • MOB_ABIL_CHARM (68) - Can charm enemies
  • MOB_ABIL_ENGULF (70) - Can engulf/surround enemies
  • MOB_ABIL_SWALLOW (73) - Can swallow enemies whole
  • MOB_ABIL_PARALYZE (77) - Can paralyze enemies

Breath Weapons

  • MOB_ABIL_FIRE_BREATH (78) - Fire breath weapon
  • MOB_ABIL_LIGHTNING_BREATH (79) - Lightning breath weapon
  • MOB_ABIL_POISON_BREATH (80) - Poison breath weapon
  • MOB_ABIL_ACID_BREATH (81) - Acid breath weapon
  • MOB_ABIL_FROST_BREATH (82) - Frost/cold breath weapon

Special Powers

  • MOB_ABIL_BLINK (69) - Can blink/teleport in combat
  • MOB_ABIL_CAUSE_FEAR (71) - Fear aura/attack
  • MOB_ABIL_CORRUPTION (72) - Corruption/disease touch
  • MOB_ABIL_FLIGHT (74) - Can fly
  • MOB_ABIL_POISON (75) - Poisonous attacks
  • MOB_ABIL_REGENERATION (76) - Regenerates HP quickly
  • MOB_ABIL_MAGIC_IMMUNITY (83) - Immune to magic
  • MOB_ABIL_INVISIBILITY (84) - Naturally invisible

System & Internal Flags

MOB_ISNPC (Index: 3) System

Effect: Read-only flag automatically set on all NPCs.

CRITICAL: System flag - never manually toggle!

MOB_NOTDEADYET (Index: 20) System

Effect: Read-only flag indicating mobile is being extracted.

CRITICAL: System flag - never manually toggle!

MOB_INFO_KILL (Index: 38) System

Effect: Broadcasts message to entire game when killed (world bosses).

MOB_INFO_KILL_PLR (Index: 60) System

Effect: Broadcasts message when this mob kills a player.

MOB_AI_ENABLED (Index: 98) System

Effect: Mobile uses advanced AI for responses.

MOB_UNLIMITED_SPELL_SLOTS (Index: 100) System

Effect: Mobile has unlimited spell slots (used for powerful casters, bosses).

MOB_BUFF_OUTSIDE_COMBAT (Index: 96) System

Effect: UNUSED - Kept for backward compatibility.

Note: Do not use - no longer functional.

Complete Flag Reference

Index Flag Name Category Primary Purpose
0MOB_SPECSystemHas special procedure
1MOB_SENTINELBehaviorWon't move
2MOB_SCAVENGERBehaviorPicks up items
3MOB_ISNPCSystemIs NPC (read-only)
4MOB_AWARECombatCan't be backstabbed
5MOB_AGGRESSIVECombatAttacks everyone
6MOB_STAY_ZONEMovementStays in zone
7MOB_WIMPYBehaviorFlees when hurt
8MOB_AGGR_EVILCombatAttacks evil
9MOB_AGGR_GOODCombatAttacks good
10MOB_AGGR_NEUTRALCombatAttacks neutral
11MOB_MEMORYCombatRemembers attackers
12MOB_HELPERCombatAssists other NPCs
13MOB_NOCHARMImmunityCan't be charmed
14MOB_NOSUMMONImmunityCan't be summoned
15MOB_NOSLEEPImmunityCan't be slept
16MOB_NOBASHImmunityCan't be bashed
17MOB_NOBLINDImmunityCan't be blinded
18MOB_NOKILLImmunityCan't be attacked
19MOB_SENTIENTClassificationIntelligent being
20MOB_NOTDEADYETSystemBeing extracted
21MOB_MOUNTABLECompanionCan be ridden
22MOB_NODEAFImmunityCan't be deafened
23MOB_NOFIGHTBehaviorWon't fight
24MOB_NOCLASSClassificationNo class
25MOB_NOGRAPPLEImmunityCan't be grappled
26-30MOB_C_* / MOB_ELEMENTALCompanionVarious companions
31MOB_GUARDCombatProtects citizens
32MOB_CITIZENClassificationProtected by guards
33MOB_HUNTERCombatTracks foes
34MOB_LISTENBehaviorHears fighting
35MOB_LITEnvironmentEmits light
37MOB_NOSTEALImmunityCan't be stolen from
38MOB_INFO_KILLSystemBroadcasts death
45-54MOB_BLOCK_*BlockingDirectional blocking
55-59MOB_BLOCK_*BlockingBlock exemptions
60MOB_INFO_KILL_PLRSystemBroadcasts PC death
61MOB_MOB_ASSISTCombatAssists other mobs
62MOB_NOCONFUSEImmunityCan't be confused
63MOB_HUNTS_TARGETCombatHunts specific target
64-84MOB_ABIL_*AbilitySpecial abilities
90-92MOB_BLOCK_*BlockingAlignment blocking
98MOB_AI_ENABLEDSystemAdvanced AI
99MOB_QUARTERMASTERSystemSupply orders
100MOB_UNLIMITED_SPELL_SLOTSSystemNo spell limits

Usage Guidelines

Common Mob Archetypes

1. City Guard

MOB_SENTINEL + MOB_GUARD + MOB_MEMORY

Protects citizens, doesn't wander, remembers criminals

2. Aggressive Monster

MOB_AGGRESSIVE + MOB_MEMORY + MOB_HUNTER

Attacks on sight, pursues, remembers enemies

3. Alignment Guardian

MOB_SENTINEL + MOB_AGGRESSIVE + MOB_AGGR_EVIL (or GOOD/NEUTRAL)

Stationary guardian that attacks specific alignments

4. Pack Hunter

MOB_HELPER + MOB_MEMORY + MOB_MOB_ASSIST

Works with other mobs, remembers threats

5. Boss Monster

MOB_NOCHARM + MOB_NOSUMMON + MOB_MEMORY + relevant MOB_ABIL_*

Immune to cheap tactics, dangerous abilities

6. Ambient NPC

MOB_SENTINEL + MOB_NOKILL + MOB_NOFIGHT

Decorative NPC that can't fight and can't be attacked

Flag Conflicts & Requirements

  • MOB_AGGRESSIVE conflicts with MOB_HELPER (automatically removed)
  • MOB_AGGRESSIVE requires alignment aggro flags (AGGR_EVIL/GOOD/NEUTRAL) to target specific alignments
  • Multiple MOB_BLOCK_* direction flags work together

For Developers

Checking Flags:

if (MOB_FLAGGED(mob, MOB_AGGRESSIVE)) {
    // Mob is aggressive
}

// Multiple flag check
if (MOB_FLAGGED(mob, MOB_GUARD) && MOB_FLAGGED(mob, MOB_MEMORY)) {
    // Guard with memory
}

Setting/Removing Flags:

// Set flag
SET_BIT_AR(MOB_FLAGS(mob), MOB_SENTINEL);

// Remove flag
REMOVE_BIT_AR(MOB_FLAGS(mob), MOB_AGGRESSIVE);

System Flags to Never Modify:

  • MOB_ISNPC (automatically set)
  • MOB_NOTDEADYET (extraction system)
  • MOB_BUFF_OUTSIDE_COMBAT (deprecated)

Code References

Primary Files:


Notes