(DO USE): On Selection Events

The event engine for Sacred Stones is incredibly well-documented and there are myriad tutorials about how to write and assign events for your specific use cases, but I’ve found that one facet of it is still mystified when it really shouldn’t be.

I speak of course about selection events, which are events that run whenever a unit is selected. Vanilla uses them primarily for tutorials - click the female rapier lord, and a text box will pop up explaining how you move them adjacent to a brigand to attack them. But tutorials aside, you can use selection quotes to run any arbitrary event when a unit is selected.

How you create a selection event differs slightly depending on your engine of choice. For FEBuilder users, go to the Event Condition editor and click on the (DoNotUse)When player unit is selected dropdown menu option. For Buildfile users, go to the Dunno1 label or if it’s not named that, the first label pointed to after MiscBasedEvents. I don’t know why after so many years the categories are still labeled (DoNotUse) and Dunno1, but they’re entirely safe to use and we know exactly what they do.

image

Selection events are identical to Always events in form, the only difference is at when point in the game they’re run. As such, selection events can be either AFEV (Flag Condition in FEBuilder) or AREA (Range Condition in FEBuilder). If the event is AFEV it will be run every time any player unit is selected, while if the event is AREA if will only be run if units inside the designated area are selected. I don’t see any use case for area-based selection events, so the remainder of this guide will assume selection events are exclusively AFEV.

So at this point you’re likely what the use case of selection events is other than tutorials. And I’ll be honest, the only reason I’m making this guide is so that people know how to make selection quotes. And I don’t mean the hack that plays a sound effect when a specific unit is selected, I mean an FE15 endgame-esque system where units will speak to themselves or the player upon selection. Any practical use selection events have is narrative, not mechanical. But I love narrative stuff and want people to know this option is available in case they want to use it.

The makeup of a selection quote is going to look mostly like this:

ALIGN 4
DarinaSelect:
CHECK_ACTIVE
SVAL s1 Darina
BEQ 1 s1 sC
ENUF SeenDarinaSelectionQuote // unset completion flag if unit selected isn't Darina
GOTO 2
LABEL 1
Text(DarinaSelectionQuote)
LABEL 2
NoFade
ENDA

ALIGN 4
EugeniaSelect:
CHECK_ACTIVE
SVAL s1 Eugenia
BEQ 1 s1 sC
ENUF SeenEugeniaSelectionQuote // unset completion flag if unit selected isn't Eugenia
GOTO 2
LABEL 1
Text(EugeniaSelectionQuote)
LABEL 2
NoFade
ENDA

Since selection events are run when any player unit is selected, you begin by checking whether the active unit matches a specific unit id. If not, you unset the event’s completion flag and jump to the end. And if yes, play a normal text id. Rinse and repeat for as many selection quotes as you like… except for one small hiccup.

There is one reason why the (DoNotUse) warning is warranted. Every selection event you have in the category takes a frame to run, which means every time you select a unit before seeing a selection quote, you will experience frames of lag = to the number of selection events you have. One or two frames isn’t very noticeable, but it quickly becomes unplayable with 10+ frames of lag. The lag will vanish when every selection event’s completion flag is set, but that’s still one turn of gameplay (and usually the first turn) where it takes a long time for units to become controllable after selecting them.

But don’t fret! All you have to do to bypass the lag is put all of your selection quotes in one massive event.

ALIGN 4
Dunno1:
AFEV DummyFlag DecadencesSelectionQuotes 0
END_MAIN

ALIGN 4
DecadencesSelectionQuotes:
ENUF DummyFlag // unset the completion flag every time the event is run
CHECK_ACTIVE
SVAL s1 Darina
SVAL s2 Eugenia
SVAL s3 Calvin
SVAL s4 Aleyna
SVAL s5 Duncan
SVAL s6 Ekaitz
SVAL s7 Nirav
SVAL s8 Clovis
SVAL s9 Emerson
SVAL sA Soline
BEQ 1 s1 sC
BEQ 2 s2 sC
BEQ 3 s3 sC
BEQ 4 s4 sC
BEQ 5 s5 sC
BEQ 6 s6 sC
BEQ 7 s7 sC
BEQ 8 s8 sC
BEQ 9 s9 sC
BEQ 10 sA sC
LABEL 1
CHECK_EVENTID SeenDarinaSelectionQuote
BEQ 11 s0 sC
Text(DarinaSelectionQuote)
ENUT SeenDarinaSelectionQuote
GOTO 11
LABEL 2
CHECK_EVENTID SeenEugeniaSelectionQuote
BEQ 11 s0 sC
Text(EugeniaSelectionQuote)
ENUT SeenEugeniaSelectionQuote
GOTO 11
...
LABEL 11
NoFade
ENDA

Whenever a player unit is selected, this event will cost one frame of lag and check if the active unit matches one of the playable ids and their selection quote hasn’t been played yet. It might look daunting, but it’s just a series of checks and text conversations.

I hope this guide served as a brief introduction to and clarification of what exactly selection events are. They’re a tool I like a lot and think has a very specific and powerful use case in selection quotes. I don’t expect people to go back and add selection quotes to every chapter now, but if you walk away from this guide knowing that this is an option, I’m satisfied with that.

Thank you for reading, and have a fantastic day!

19 Likes

Personally I use OnSelect (1) events and OnReached (3), but not OnDecided (2). I’ve encountered bugs with the middle one so just a heads up. They’re labelled (DoNotUse) because they’re unused in vanilla and they’re presumably leftovers from a prototype tutorial system. I like OnReached because it’s essentially an event trap: the player selects somewhere to go to and when they get there, your event takes over their action. I think these are safe to use, but I understand why 7743 wants them labelled as (DoNotUse).

2 Likes

This is because there is not much good in using them.
There is already a dedicated patch for an event that plays audio when a unit is selected.
There is no need to go to the trouble of implementing this in a more costly event.

Although some research has been done on what to use this feature for, it is not that difficult to do without it.
For example, if you want to describe a scene where the boss gets scared and backs away when you select an angry protagonist, you have to use this function.
But that would be enough when the protagonist waits in a certain area, not when he selects it.

By the way, we can say that MiscBasedEvents is OnWait.

OnWait, OnSelect, OnDecided, OnReached

Using only OnWait is sufficient for the FE game specifications.
There is no need to bother with OnSelect, OnDecided, and OnReached, which vanilla developers could not master.

Besides, using these functions by beginners will only confuse them even more.
We have seen people get confused by using these functions incorrectly in the past, which is why we put a “DO NOT USE” warning on these functions.

4 Likes

I can see these selection events being used as a quicker, but less immersive alternative to Free Movement. Could even use the Area type to keep a set of selection options to a certain area of the map. I’ve been messing with Warcraft III lately, so that was the first thing that came to my mind.
Something else l thought of is a puzzle-based hack, where a question asks you to select units in a certain order or a specific unit. Maybe even have an invisible unit to simulate selecting tiles.

Do the Area types also have the lag? I imagine they do, but maybe only if they overlap?