Example: Signpost
Last updated
Last updated
This blueprint is not a definitive or ideal implementation and needs some cleanup, but it demonstrates the usage of basic interaction features
The signpost is an example object that presents the player with a list of predefined locations in the world, which the player can the select and automatically travel to. It can also display additional, hidden options if the player has a Director capability.
The signpost has a base class, BPM_SignpostBase, with most notably the following logic:
We provide LocationMarkerBase objects to this function, which stores them in our array of Locations, and add a corresponding interaction using the AddOption function on an attached M2_Interactable component. We use the location marker's name as the interaction ID so we can later identify it the other way around.
Interacting
Upon interacting (via the OnButtonOptionRequested event), we pass the Option Id to the next function.
In MoveToLocation, we fetch the Location whose name corresponds to the passed in ID, then navigate the player to it.
Here we provide location markers from a BP variable and add them using the base class function
By using the InitializeInteract event, which fires whenever we are about to show the player an object's interaction options, we can do a regular check for the player's Capabilities, and add/remove options and locations dynamically