mirror of
https://github.com/cliffe/BreakEscape.git
synced 2026-02-21 11:18:08 +00:00
2.5 KiB
2.5 KiB
NPC Influence System
Overview
Every NPC in Break Escape tracks an influence variable representing the player's relationship with them. Influence changes trigger visual feedback to show the player when they've improved or damaged a relationship.
Ink Implementation
Variable Declaration
In your Ink story, declare an influence variable for each NPC:
VAR influence = 0
VAR npc_name = "Agent Smith"
Triggering Influence Changes
When the player does something that changes the relationship, modify the influence variable and add the corresponding tag:
Increasing Influence
=== helpful_choice ===
You helped me out. I won't forget that.
~ influence += 1
# influence_increased
-> hub
This displays: "+ Influence: Agent Smith" (green)
Decreasing Influence
=== rude_choice ===
That was uncalled for. I expected better from you.
~ influence -= 1
# influence_decreased
-> hub
This displays: "- Influence: Agent Smith" (red)
Visual Feedback
The influence system automatically shows a popup notification:
- Position: Top center of screen
- Duration: 2 seconds
- Appearance: Pixel-art styled with sharp borders (no border-radius)
- Colors:
- Green (#27ae60) for increases
- Red (#e74c3c) for decreases
Example Usage
VAR influence = 0
VAR trust_level = "stranger"
=== hub ===
{influence >= 5: ~ trust_level = "friend"}
{influence >= 10: ~ trust_level = "trusted ally"}
{influence <= -5: ~ trust_level = "suspicious"}
Hey there, {trust_level}.
+ [Ask for help]
-> ask_help
+ [Be rude]
-> be_rude
=== ask_help ===
Sure, I can help with that.
~ influence += 1
# influence_increased
-> hub
=== be_rude ===
Wow, okay. Forget I asked.
~ influence -= 2
# influence_decreased
-> hub
Technical Details
- Tags processed:
# influence_increasedand# influence_decreased - Implementation:
js/minigames/helpers/chat-helpers.js - Popup function:
showInfluencePopup(npcName, direction) - NPC name source: Uses
displayName→name→npcIdfallback
Best Practices
- Use meaningful increments: ±1 for small actions, ±2-3 for significant choices
- Track thresholds: Use influence levels to unlock new dialogue options
- Show consequences: Let NPCs react differently based on influence
- Balance carefully: Avoid making influence too easy to maximize or minimize
- Be consistent: Similar actions should have similar influence impacts