mr:barman_npc_mob
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| mr:barman_npc_mob [2025/12/25 18:23] – auto lint fix Mikhael | mr:barman_npc_mob [2026/03/25 21:22] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Barman NPC - Code References ====== | ||
| + | |||
| + | {{ rpd: | ||
| + | |||
| + | **Barman** is a passive NPC in Remixed Dungeon that serves as a test/demo character for NPC functionality. | ||
| + | |||
| + | ===== Entity Type ===== | ||
| + | NPC (Non-Player Character) - JSON configuration with Lua script | ||
| + | |||
| + | ===== Java Classes ===== | ||
| + | This entity is implemented through JSON configuration with Lua script, no dedicated Java class exists. | ||
| + | Uses standard NPC classes from: | ||
| + | * `com.watabou.pixeldungeon.actors.mobs.npcs.NPC` - Base NPC class | ||
| + | * `com.watabou.pixeldungeon.actors.Actor` - Actor system base | ||
| + | |||
| + | ===== JSON Configuration ===== | ||
| + | **mobsDesc/ | ||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | **Configuration Breakdown**: | ||
| + | * **baseSpeed**: | ||
| + | * **spriteDesc**: | ||
| + | * **scriptFile**: | ||
| + | * **friendly**: | ||
| + | * **movable**: | ||
| + | * **aiState**: | ||
| + | * **fraction**: | ||
| + | |||
| + | **spritesDesc/ | ||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | **Animation Details**: | ||
| + | * **Texture**: | ||
| + | * **Idle**: 8 frames [0, | ||
| + | * **Run**: 3 frames [0,1,2] at 8 FPS, looped (not used - NPC is stationary) | ||
| + | * **Attack**: 3 frames [0,1,2] at 8 FPS, looped (not used - NPC is friendly) | ||
| + | * **Die**: 3 frames [0,1,2] at 8 FPS, looped (not used - NPC is friendly) | ||
| + | |||
| + | ===== String Resources ===== | ||
| + | English (values/ | ||
| + | <code xml> | ||
| + | <string name=" | ||
| + | </ | ||
| + | |||
| + | Russian (values-ru/ | ||
| + | <code xml> | ||
| + | <string name=" | ||
| + | </ | ||
| + | |||
| + | ===== Lua Scripts ===== | ||
| + | **scripts/ | ||
| + | <code lua> | ||
| + | local RPD = require " | ||
| + | local mob = require" | ||
| + | |||
| + | local dialog = function(index) | ||
| + | if index == 0 then | ||
| + | local hero = RPD.Dungeon.hero | ||
| + | local pos = RPD.getXy(hero) | ||
| + | RPD.Dungeon.hero: | ||
| + | return | ||
| + | end | ||
| + | |||
| + | if index == 1 then | ||
| + | RPD.glog(" | ||
| + | end | ||
| + | end | ||
| + | |||
| + | return mob.init({ | ||
| + | interact = function(self, | ||
| + | RPD.chooseOption( dialog, | ||
| + | "Test title", | ||
| + | "Go back", | ||
| + | " | ||
| + | " | ||
| + | end | ||
| + | }) | ||
| + | </ | ||
| + | |||
| + | **Script Functionality**: | ||
| + | * Uses `RPD` module for game API access | ||
| + | * `interact` function triggers dialog when player interacts | ||
| + | * Dialog options: | ||
| + | * Option 0: Moves hero 3 tiles up from current position | ||
| + | * Option 1: Prints " | ||
| + | * Demonstrates basic NPC interaction pattern for modders | ||
| + | |||
| + | ===== Related mr Entities ===== | ||
| + | * [[mr: | ||
| + | * [[mr: | ||
| + | * [[mr: | ||
| + | |||
| + | ===== Game Mechanics ===== | ||
| + | * **Purpose**: | ||
| + | * **Interaction**: | ||
| + | * **Location**: | ||
| + | * **Behavior**: | ||
| + | * **Modding Use**: Reference implementation for custom NPCs | ||
| + | |||
| + | ===== Code Fragments ===== | ||
| + | Example interaction pattern from Barman.lua: | ||
| + | <code lua> | ||
| + | -- Basic NPC interaction template | ||
| + | return mob.init({ | ||
| + | interact = function(self, | ||
| + | RPD.chooseOption( dialog, | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | end | ||
| + | }) | ||
| + | </ | ||
| + | |||
| + | ===== See Also ===== | ||
| + | * Other NPC examples in `scripts/ | ||
| + | * `scripts/ | ||
| + | * `scripts/ | ||
