Signals
A scheme lives in the database, and your scene lives in Unity. A signal is how the first tells the second that something happened. A scheme sends a signal and an object in your scene reacts, with no code from you.
The three parts
Section titled “The three parts”- A Signal asset. A named token. It holds only a note for your team: when it is sent, and what should react to it. Make one with Create > MrW > Intrigues > Signal.
- The Send Signal node. It sends the asset from a scheme, and the flow goes on.
- A Signal Receiver. A component on a scene object (Add Component > Intrigues > Signal Receiver). It holds a list of reactions. Each reaction names a signal and holds a Unity event, Do This, with the actions to run.
- Show Dialogue, output Swear to {conspirator.Name}, sword and life., goes to Send Signal.
- Show Dialogue, output Swear, but name the lord of your own house first., goes to Send Signal.
What a reaction can do
Section titled “What a reaction can do”A reaction is a Unity event. Whatever you can wire in the inspector’s event list can be a reaction, for example switching a game object on or off. A signal carries no value of its own, but inside a reaction, code can read which scheme sent it, and who its conspirator and target were.
When a signal arrives, the receiver runs every reaction to it, from top to bottom. It listens while its object is active and the component is enabled. A reaction that fails is logged, and the others still run.
Receivers show what they do
Section titled “Receivers show what they do”The Signal asset’s inspector lists SENT BY, the Send Signal nodes that send it, and LISTENERS IN OPEN SCENES, the receivers that react to it. It says when there is none. In Play mode, Send Now sends the signal by hand.
In Play mode, a reaction card has a Run Now button, to run that reaction as if its signal had been sent. A card also tells you how often the reaction has run, or “not run yet”.
Signals are not saved
Section titled “Signals are not saved”The reactions of a Signal Receiver are not saved with the game, so after a load the objects are as the scene made them.
When a signal’s effect must last, send the signal again from an On Game Loaded node, so the scene is put right each time.
A Send Signal node with no signal chosen shows “Sends nothing” and an error.
Other senders
Section titled “Other senders”Code can send a signal too, with IM.Signal, and listen to it with IM.onSignalReceive. A decision of a character can also
send one: a decision’s does can be sendSignal, and a decision can think again when a signal names the character
(alsoWhenSignal). The demo’s optional decision file “The Hollow Throne” sends a signal called Realm In Crisis, and its decisions think again when it
arrives. Its own note says to apply the file only after the signal asset exists.
Signals are handled on the main thread. At most 16 signals can be handled inside each other. A deeper one is refused, and the log says so.