Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

mob_combat

mob_combat is the generic monster combat switch scheme. It listens for monster combat events and uses common switch conditions to move the object to another section.

Parameters

mob_combat has no scheme-specific config fields. It reads common switch fields from the section.

on_info, on_info1, …

Type: condlist.

Switch when the condlist selects another section.

on_timer, on_timer1, …

Type: milliseconds | condlist.

Switch after the section has been active for the duration.

on_signal, on_signal1, …

Type: signal | condlist.

Switch when a signal is set.

Runtime behavior

The manager only acts on the combat event. If the scheme is enabled, the monster has an enemy, and the object has an active scheme, it calls the common section switcher.

The scheme can be disabled through SchemeMobCombat.disable, which sets its runtime enabled flag to false.

Runtime sequence

  1. SchemeMobCombat.activate parses common switch fields and sets enabled = true.
  2. SchemeMobCombat.add subscribes a MobCombatManager.
  3. MobCombatManager.onCombat runs only when the state is enabled, object.get_enemy() is not null, and the object still has an active scheme.
  4. The manager calls trySwitchToAnotherSection.
  5. disable leaves the action in place but sets enabled = false, so later combat events are ignored.

Example

[logic]
active = mob_home@idle
on_combat = mob_combat@combat

[mob_combat@combat]
on_info = mob_walker@attack

Notes

  • This is normally referenced from a monster logic section through on_combat.
  • It does not perform combat movement by itself.
  • Put movement behavior in the target monster section, such as mob_home, mob_walker, or another monster scheme.