Visual Graphing – Chest Trap Encounter


Background
Through out the game Joule finds treasure chests full of crafting components and blueprints to upgrade here robot companions. In rare cases Joule will find a trapped treasure chest that activates a Self Destruct Robyte that will lock on and chase her. Joule must dash far enough away to avoid dying in the blast radius.

Video:

Graph:

Graph Functionality:

A. Point of Entry – A graph node named “Interactible Object Listener” listens for the player to open the “Decoy” chest.

B. Toggle Encounter On – After a short delay and validating the encounter game object to verify it isn’t null, toggle on the encounter game object. Toggling on the encounter automatically spawns the Self Destruct enemy at a designated location in the Decoy Chest game object.

C. Toggle On/Off – After a short delay, toggle visual effects on. Toggle the interactive component on the Decoy Chest off to avoid seeing the interaction prompt and reactivating the trap multiple times.

D. Toggle Off – Deactivate the Decoy Chest beam visual effects.

E. Encounter State – The “Robok Spawner Listener” node has a branch that listens for any case where the Self Destruct Encounter despawns or deactivates. This would happen in the event the player is somehow able to teleport or dash away before the enemy locked on. This branch of the graph reactivates the Decoy Chest beam VFX, toggles the enemy encounter to be off and reactivates the interaction component on the Decoy Chest so it can be reopened by the player at a later time.

F. Destruction and Loot – If the encounter is defeated (meaning the encounter self destructed) an optional short cutscene will point the player camera to where the destroyed chest has dropped loot.

G. Persistence – Once the Decoy Chest has been interacted with a persistent value is saved so the encounter cannot be triggered twice.

H. Graph Enabled – When the graph is enabled the persistence value is checked.

I. Toggle On/Off – If the persistence value is True, the Decoy Chest is toggled off and the Loot is toggled on.