Events
Instruments the guitar events
GuitarPlayed and GuitarCommented are the events on this class. The calls that play a guitar are on the Playing notes and songs page.
public static class Instruments
{
public static event Action<GuitarPlayedArgs> GuitarPlayed;
public static event Action<GuitarCommentArgs> GuitarCommented;
}
| Event | Gives you | When it fires |
|---|---|---|
GuitarPlayed | GuitarPlayedArgs | Each time a strum is played. |
GuitarCommented | GuitarCommentArgs | When the game asks a person nearby to comment on a guitar being played. |
GuitarPlayedArgs a strum that was played
GuitarPlayed gives you this, once for each strum. GuitarId is the guitar that played.
public sealed class GuitarPlayedArgs
{
public string GuitarId { get; }
}
| Property | Type | What it means |
|---|---|---|
GuitarId | string | The guitar that played. |
GuitarCommentArgs a comment on the playing
GuitarCommented gives you this, for a person nearby who comments on the player’s long note. Positive is true for a nice comment.
public sealed class GuitarCommentArgs
{
public string WitnessId { get; }
public int NpcId { get; }
public bool Positive { get; }
}
| Property | Type | What it means |
|---|---|---|
WitnessId | string | The id of the witness, the person who commented. |
NpcId | int | The NPC id of the witness. 0 when it has none. |
Positive | bool | true when the comment is a nice one, false for a nasty one. |
Things to know
GuitarPlayedfires each time a strum is played. That is a Primary Use press on a held guitar that is not resting, and each strum fromPlayNoteor a song. It fires right after the game has started the sound. A strum that is skipped does not fire it.GuitarCommentedfires when the game asks a person nearby to comment on a guitar being played.Positivecomes from the game’s check of the player’s Music skill. The comment is the game’s own, so it can still be skipped by the game’s own timing. (WitnessIdis the id of the component the game asked to comment: the witness’sNPCRandomTalk, or itsCharacterBarkStarterwhen it has noNPCRandomTalk.NpcIdisNPCController.ID, or0when the witness has noNPCController.)- The comment happens only while the player’s own long note is playing. A note from
HoldNotenever brings a comment. The person must be close by and able to see the player, and the game waits a while between comments. (The witness is within 10 units and inWitness.GetWitnesses, and the 10 second timer has run out. The hold is the game’s own hold sound.) - A person with no talk component still gets a plain comment. The game gives them a short bark, and
GuitarCommentedfires for it too with the samePositiveflag. It is reported only when it comes from the guitar, so the same words from anywhere else are not reported. (A witness with anNPCRandomTalkgets the comment throughNPCRandomTalk.OnGuitarPlayed. One with only aCharacterBarkStartergets the game’s bare bark throughCharacterBarkStarter.TryToComment.) - An event handler that throws an error does not stop the others. The framework logs the error and still runs the other handlers. Handlers run right away, from inside the game’s own call.