en:rpd:immortal_npc
Table of Contents
Immortal NPC
Immortal NPCs in Remixed Dungeon are non-player characters that cannot be killed or damaged. Unlike earlier versions where this was implemented via an `ImmortalNPC` abstract Java base class, immortality is now configured per-entity via JSON in `mobsDesc/` with `“immortal”: true`.
Properties
- Immobile: Cannot move (`“movable”: false`, `“baseSpeed”: 0` or `0.5`)
- Invulnerable: Cannot take damage from any attacks (`“immortal”: true`)
- High Defense: Defense skill is set to 1000 (effectively impossible to hit)
- Low Speed: Speed is set to 0.5f or 0 (slower than normal)
- Buff Immunity: Cannot receive or be affected by buffs
- Defensive: Uses “wails” as its defense verb (from `Ghost_Defense` string resource)
- Reset Behavior: Automatically resets position after actions (`“persistOnReset”: true`)
Implemented NPCs
NPCs with immortal configuration include:
- Town Guard - Provides security in town areas
- Townsfolk - Regular citizens with various messages
- Silent Townsfolk - Quiet townspeople with minimal dialogue
- Townsfolk Movie NPC - References cinema's special service
- Healer NPC - Provides healing services
- Librarian NPC - Library-related services
- Fortune Teller NPC - Fortune telling services
- Service Man NPC - Service-related functions (ad theatre)
- Sociologist NPC - Social interaction NPC
- Inquirer NPC - Information-seeking NPC
- Scarecrow NPC - Scarecrow that serves as an NPC
- Necromancer NPC - Necromancer-related NPC
- Plague Doctor NPC - Plague-related NPC
- Bella NPC - Bella-related NPC
- Caged Kobold - Caged Kobold NPC
- Bard NPC - Music and entertainment NPC
- Bishop NPC - Religious NPC
- Drunkard NPC - Drunk NPC with dialogue
- Innkeeper NPC - Inn services NPC
- Mercenary NPC - Mercenary NPC
- Servant NPC - Servant NPC
- Black Cat NPC - Black cat NPC
- Other special NPCs in the game
Implementation
- JSON Configuration: Each NPC defines its properties in `RemixedDungeon/src/main/assets/mobsDesc/<NPCName>.json`
- Key Properties: `“immortal”: true`, `“movable”: false`, `“defenseSkill”: 1000`, `“aiState”: “Passive”`, `“fraction”: “NEUTRAL”`, `“defenceVerb”: “Ghost_Defense”`, `“npc”: true`, `“friendly”: true`
- Lua Behaviors: Custom behaviors in `scripts/npc/` (e.g., `scripts/npc/Townsfolk.lua`, `scripts/npc/Healer.lua`)
- Java Classes: Only NPCs with special logic (e.g., `ServiceManNPC.java` for ad theatre) retain Java classes; most are data-driven
- Purpose: Designed for safe NPCs that provide services, lore, or other functions without risk of being killed
Strategy
- These NPCs are completely safe to interact with
- They cannot be killed or damaged in any way
- They remain in fixed positions due to immobility
- They serve as permanent fixtures in the game world
- Players can interact with them without worry of accidental harm
Source Code
- JSON Config Examples: TownsfolkNPC.json, ServiceManNPC.json
- Lua Scripts: `scripts/npc/` directory
- Java (special cases): `com/nyrds/pixeldungeon/mobs/npc/ServiceManNPC.java`
- String Resource: Ghost_Defense (“wails”)
See Also
- NPCs - General information about non-player characters
- NPCs - List of all NPCs in the game
- Technical Details - Machine-readable reference page
en/rpd/immortal_npc.txt · Last modified: (external edit)
