Skip to main content
 Warning: Unmaintained Version
Version: 0.4.2

Triggering Entries

There are easy ways to trigger all the next entries in a TriggerEntry. The most important is that you have a player to trigger the entries on.

 info

Typewriter takes care of only triggering the entries that should be triggered. If criteria are not met, the entries are not triggered.

If you have a single TriggerEntry:

val triggerEntry: TriggerEntry = ...
val player: Player = ...
triggerEntry triggerAllFor player

If you have list of TriggerEntry:

val triggerEntries: List<TriggerEntry> = ...
val player: Player = ...
triggerEntries triggerAllFor player

If you have a list of id's of TriggerEntry:

val triggerEntryIds: List<String> = ...
val player: Player = ...
triggerEntryIds triggerEntriesFor player

Sometimes you don't want to trigger the entries when the player is in a dialogue. For example, when the player is in a dialogue with a NPC, you don't want to trigger the first entry of the NPC again. You expect when the player clicks on the NPC again, the next dialogue is triggered. To facilitate this, you can use the startDialogueWithOrNextDialogue function.

val triggerEntries: List<TriggerEntry> = ...
val player: Player = ...
triggerEntries startDialogueWithOrNextDialogue player

Or if you want to trigger something completely different when the player is in a dialogue:

val triggerEntries: List<TriggerEntry> = ...
val player: Player = ...
val customTrigger: EventTrigger = ...
triggerEntries.startDialogueWithOrTrigger(player, customTrigger)

Custom triggers

Typewriter triggers based on the EventTrigger interface. So all the entries that are triggered are wrapped in a EntryTrigger.

There are some triggers that are defined in Typewriter. The two are SystemTrigger and CinematicStartTrigger.

SystemTrigger

SystemTrigger's can be used to indicate to either the DialogueSequence or the CinematicSequence that something needs to happen.

  • SystemTrigger.DIALOGUE_NEXT indicates that the next dialogue should be triggered.
  • SystemTrigger.DIALOGUE_END indicates that the dialogue should end.
  • SystemTrigger.CINEMATIC_END indicates that the cinematic should end.

CinematicStartTrigger

CinematicStartTrigger's can be used to indicate to the CinematicSequence that a cinematic should start.

It has several properties that can be set:

  • pageId: String is the id of the cinematic page that should be shown. This is required.
  • triggers: List<String> is a list of trigger id's that should be triggered when the cinematic is finished. This is optional.
  • override: Boolean indicates if the cinematic should override the current cinematic. This is optional and defaults to false.
  • simulate: Boolean is used to run a cinematic for recording purposes. When this is enable it disables some entries from running. This is optional and defaults to false.
  • ignoreEntries: List<String> is a list of entry id's that should not be triggered. This is optional.
  • minEndTime: Optional<Int> is the minimum amount of frames the cinematic should run. If the cinematic is shorter than this, it will be extended. This is optional.