mr:ai_behavior_mechanic
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| mr:ai_behavior_mechanic [2026/03/20 07:55] – Wiki maintenance: Fix formatting and add mr: namespace page for AI Behavior Qwen Assistant | mr:ai_behavior_mechanic [2026/03/20 07:59] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== AI Behavior Mechanic - Code References ====== | ||
| + | |||
| + | ===== Java Classes ===== | ||
| + | * **AI State Interface: | ||
| + | * **AI State Manager:** [[https:// | ||
| + | * **Mob Base Class:** [[https:// | ||
| + | |||
| + | ===== AI State Implementations ===== | ||
| + | * **Wandering AI:** [[https:// | ||
| + | * **Hunting AI:** [[https:// | ||
| + | * **Sleeping AI:** [[https:// | ||
| + | * **Passive AI:** [[https:// | ||
| + | * **Fleeing AI:** [[https:// | ||
| + | * **RunningAmok AI:** [[https:// | ||
| + | * **Horrified AI:** [[https:// | ||
| + | * **ThiefFleeing AI:** [[https:// | ||
| + | * **ControlledAI AI:** [[https:// | ||
| + | |||
| + | ===== JSON Configuration ===== | ||
| + | AI states can be specified in mob JSON descriptors with the " | ||
| + | * **Mob Descriptors: | ||
| + | * **Example: | ||
| + | |||
| + | ===== String Resources ===== | ||
| + | <code xml> | ||
| + | <!-- AI Status Strings --> | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | </ | ||
| + | |||
| + | ===== Lua Scripts ===== | ||
| + | AI states can be manipulated via Lua scripts for custom mob behaviors: | ||
| + | * **Script Location:** '' | ||
| + | * **AI Control:** Lua scripts can call Mob.setState() to change AI behavior | ||
| + | |||
| + | ===== AI State Transitions ===== | ||
| + | * **Damage Trigger:** When mob takes damage → typically transitions to Hunting AI | ||
| + | * **Sight Trigger:** When mob sees enemy while Sleeping/ | ||
| + | * **Health Trigger:** When mob's health is low → may transition to Fleeing AI | ||
| + | * **Scripted Trigger:** Lua scripts can force AI state changes | ||
| + | |||
| + | ===== AiState Interface Methods ===== | ||
| + | <code java> | ||
| + | public interface AiState { | ||
| + | void act(@NotNull Char me); // Called each turn to execute AI behavior | ||
| + | String status(Char me); // Returns status string for display | ||
| + | String getTag(); | ||
| + | void gotDamage(Char me, NamedEntityKind src, int dmg); // Called when mob takes damage | ||
| + | void onDie(@NotNull Char me); // Called when mob dies | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== Entity Kind ===== | ||
| + | * **Interface: | ||
| + | * **Package: | ||
| + | * **Pattern: | ||
mr/ai_behavior_mechanic.txt · Last modified: by 127.0.0.1
