Skip to content

Conversation

@SilverDorian46
Copy link
Contributor

@SilverDorian46 SilverDorian46 commented Dec 29, 2025

What is an Interact Trigger?

the Interact Trigger is a generalised trigger of which the function is to play a cutscene upon being interacted with, by pressing [Interact] while the player is within its bounds.

one particular feature of it is that it can have one or multiple events.
when it first appears, its "event index" begins at 0. this is used to get the current event, and is incremented on playing each event.
upon incrementing, a Session flag called it_ plus the name of the current event, is also set. this is used to keep track of which events are done even if the player goes to a different room and comes back.
on the first interaction, the trigger plays event 1. then, given it has multiple events, on subsequent interactions it will play events 2, 3, and so on. when it has no more events to play (i.e. when its event index reaches the number of events it has), it disappears.

one thing to note however is that the event index increments on a local flag in the method, which is true by default.
certain events have that flag set to false, in which case the event index won't increment, the it_ Session flag won't be set, no subsequent events will play, and the trigger won't disappear.

this PR implements an interface which modders can use to write events for the Interact Trigger.

Everest.Events.InteractTrigger.OnInteractTrigger

this Everest Event accepts a method that returns a bool and has the following parameters: InteractTrigger trigger, Player player, string eventID, ref bool progressEvent.
the method should check the eventID if it matches a custom event. if there's a match, it should set up the event in some way (e.g. by adding the appropriate CutsceneEntity to the scene) and then return true. if there are no matches, it should return false.
the parameters are explained as follows:

  • InteractTrigger trigger - the trigger that the player is using.
  • Player player - the player using the trigger.
  • string eventID - the ID for the current event.
  • ref bool progressEvent - whether to progress to the next event (i.e. by incrementing the event index and setting the appropriate Session flag) or not. this is true by default.

[CustomInteract] attribute

this attribute may be placed on a class that extends CutsceneEntity (or any class that extends Entity).
it accepts a string (can accept multiple) that represents the ID of the event. it's recommended that each string be unique to the mod (e.g. myCampaignMod_ch1_theo).
it can also take an optional property argument ProgressEvent = , which is a boolean and true by default. this indicates whether the trigger should progress to the next event and set the appropriate Session flag based on the event ID, or not.

when this attribute is in place, the class requires a public constructor of one of certain signatures for it to be registered. the following is checked in order:

  1. (InteractTrigger trigger, Player player, string eventID, ref bool progressEvent)
  2. (InteractTrigger trigger, Player player, string eventID)
  3. (Player player)
  4. ()

alternatively, the modder may also use a generator method. Everest looks for one called Load by default, but a different generator may be specified with the ID in the attribute (e.g. myCampaignMod_ch1_theo = LoadTheo).
the matching generator method must be public static, return Entity, and have one of the following signatures:

  1. (InteractTrigger trigger, Player player, string eventID, ref bool progressEvent)
  2. (InteractTrigger trigger, Player player, string eventID)

note that if the ref bool progressEvent parameter is included, the ProgressEvent property of the attribute is ignored, and that is left to be handled within the method / constructor.

Other changes

  • Everest now accepts (Player) as a valid signature for entities marked with [CustomEvent].
  • the summary for [CustomEvent] has been edited, clarifying that it is for use with an EventTrigger.

Additional notes

for map making tools such as Lönn, the Interact Trigger (entity name: interactTrigger) has the following features:

  • it supports the attributes event, event_2, event_3 ... up to event_99, whose numbers each correspond to the index of the event, and determines the order in which the events are played out.
  • it can have up to 1 node, which indicates where to draw the input prompt graphic.

here's a simple Lönn plugin to try it out:

return {
    name = "interactTrigger",
    nodeLimits = {0, 1}, -- specifies the location of the input prompt graphic
    placements = {
        name = "interact",
        data = {
            event = "",
            event_2 = "",
            event_3 = ""
            --[[
              supports additional `event_` attributes up to 99.
              to include those, copy the placement into a text editor, and write the additional keys into it.
              then paste the modified data back into the map.
              ]]
        }
    }
}

@maddie480-bot maddie480-bot added the review needed This PR needs 2 approvals to be merged (bot-managed) label Dec 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review needed This PR needs 2 approvals to be merged (bot-managed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants