# Source URL: https://dev.epicgames.com/community/snippets/YjL/fortnite-memory-sequence-device
# Local doc: epic-docs/community/snippets/YjL/fortnite-memory-sequence-device.md
using { /Fortnite.com/Devices }
using { /Verse.org/Random }
using { /Verse.org/Simulation }
using { /Verse.org/Simulation/Tags }
using { /UnrealEngine.com/Temporary/Diagnostics }
# This tag is used to identify devices that are part of the memory sequence.
memory_sequence_item_tag := class(tag){}
# We use a creative device to store and use both the "interaction" device and the "viewer" device in a single device
# that we can find via gameplay tags.
# We must do this since there must be a 1:1 relationship between the device the player interacts with and the device that
# is used to "show" the sequence.
# Retrieving devices with gameplay tags doesn't guarantee a specific order, which means that the nth interaction device might not
# match the nth viewer device. For example, the third button might not visually match the third cinematic sequence device.
memory_sequence_item := class(creative_device):
# We use a button to detect the player interacting with the memory_sequence_item.
# You can use any other device that works for your experience and modify how you signal ItemInteractedEvent accordingly.
@editable
Button:button_device = button_device{}
# We use a cinematic_sequence_device to show the memory_sequence_item activation.
# You can use any other device that works for your experience and modify Play accordingly.
@editable
Cinematic:cinematic_sequence_device = cinematic_sequence_device{}
# This event is raised each time the device the player interacts with is used.
# We use this instead of directly using the interactable device events to enable easier customization.
# You just need to change how the ItemInteractedEvent is signaled and your interactable device type, without
# further modifications to the code that uses the memory_sequence_item.
ItemInteractedEvent:event(?agent) = event(?agent){}
# Play/activates the device used to "show" this memory_sequence_item.
Verse Library
verse
01 Snippet
Links interaction buttons to cinematic sequences, ensuring correct player activation ordering.
extracted-snippets/community/snippets/YjL/fortnite-memory-sequence-device/01-snippet.verse
Sign in free to read the full source 🌴
This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.