-
Notifications
You must be signed in to change notification settings - Fork 1
Enemy Converting to Friendly Upon Defeat
Upon the defeat of an enemy NPC, the entity is transformed into a "friendly" version of itself. This new friendly NPC can then participate in combat alongside the player, providing support and assistance. The conversion process involves altering the entity’s AI, behaviour, animations, and attributes to reflect its new role as an ally. This not only changes the entity's interaction with the player but also adjusts its behaviour towards other enemies, making it a valuable asset in the player's team.
On the game win screen, spawnConvertedNPCs(defeatedEnemy)
is called. This method systematically converts the enemy into a friendly NPC by removing components specific to its hostile nature, such as attack capabilities and enemy AI behaviours. It then replaces these with a friendly AI controller that enables cooperative behaviours like wandering near the player, avoiding other enemies, and pausing to interact with the player or other friendly NPCs.
-
Remove Enemy Components: Enemy-specific components such as TouchAttackComponent and CombatStatsComponent are removed to disable hostile behaviours.
-
Update AI Behaviour: The enemy's aggressive AI is replaced with a friendly AI that includes tasks like wandering around, pausing to interact, and avoiding other enemies, making the NPC act more like an ally.
-
Adjust Animations: The entity's animations are updated to reflect its new friendly status, using configurations that are specific to friendly NPCs, such as idle or float animations.
-
Enhance Interaction: Event triggers are added to facilitate interactions with the player.
Each entity has unique characteristics like whether they provide general game hints, quest specific hints, drop items that can prove fruitful later etc. Their details can be found below:
NPC | Image | Documentation Link |
---|---|---|
Chicken | Chicken Documentation | |
Frog | Frog Documentation | |
Monkey | Monkey Documentation | |
Bear | Bear Documentation | |
Eel | Eel Documentation | |
Octopus | Octopus Documentation | |
Bee | Bee Documentation | |
Pigeon | Pigeon Documentation | |
Bigsawfish | Bigsawfish Documentation | |
Macaw | Macaw Documentation |
Triggered upon game win in combat.
-
Dialogue Initiation: Upon conversion, the NPC can trigger dialogues or sound effects that provide hints or encouragement, using the
initiateDialogue
method fromNPCFactory
. -
Behavioural Adjustments: Specific events like
PauseStart
andPauseEnd
are used to manage how and when the NPC interacts with the player.