Page 1 of 1
Skip Typewriter Effect for Player
Posted: Mon Dec 02, 2019 8:33 pm
by ar4wy
Hi Pixel Crushers!
Right now, I have Dialogue Manager set up to show both the NPC and PLAYER dialogue.
When the player chooses a response, it types out the response after being clicked. (Some players find this redundant, and just want their chosen line to instantly appear.) How would I do this?
I know I could prepend/append all my player lines with the typewriter markup />something/< , but I'm sure there is a better way to skip the typewriter effect for player dialogue!
Re: Skip Typewriter Effect for Player
Posted: Mon Dec 02, 2019 9:06 pm
by Tony Li
Hi,
Here are two suggestions:
1. Assuming the player uses a different subtitle panel than NPCs, remove the typewriter effect from the player's subtitle panel. For example, the Basic Standard Dialogue UI has an NPC Subtitle Panel and a PC Subtitle Panel. Inspect the PC Subtitle Panel's Subtitle Text and remove the UnityUITypewriterEffect component.
2. Inspect the Dialogue Manager. Tick Subtitle Settings > Skip PC Subtitle After Response Menu.
Re: Skip Typewriter Effect for Player
Posted: Tue Dec 03, 2019 8:56 pm
by ar4wy
Hi Tony!
The player and the NPC share the same subtitle panel. I believe what I have is based on WRPG template.
If I skip the PC subtitle, there is no record of what the player has said.
Is there a script that modifies only player lines of dialogue? Or the "responses"? (So that I do not have to manually enter \>line\< for each player line of dialogue?
Thanks!
Remy
Re: Skip Typewriter Effect for Player
Posted: Tue Dec 03, 2019 9:31 pm
by Tony Li
Hi Remy,
You can add a script like this to the Dialogue Manager:
SkipTypewriterForPlayer.cs
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class SkipTypewriterForPlayer : MonoBehaviour
{
void OnConversationLine(Subtitle subtitle)
{
if (subtitle.speakerInfo.isPlayer)
{
subtitle.formattedText.text = @"\^" + subtitle.formattedText.text;
}
}
}
Re: Skip Typewriter Effect for Player
Posted: Sat Dec 07, 2019 6:23 pm
by ar4wy
Hi Tony,
This works great!
I have the character names turned on, so the name always appears before the dialogue.
///
Example:
PLAYER: Hello, how are you?
NPC: I am fine.
///
Right now, the dialogue text appears instantly, but the Player name still gets typed out. Is there a way to also include the player name in this instant text script?
Thanks!
Re: Skip Typewriter Effect for Player
Posted: Sat Dec 07, 2019 6:40 pm
by Tony Li
Hi,
The character name gets added to the front of the text after OnConversationLine() runs, as you've seen.
Try changing the script to this instead, which will enable and disable the typewriter effect instead of injecting a code to fast-forward it:
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class SkipTypewriterForPlayer : MonoBehaviour
{
void OnConversationLine(Subtitle subtitle)
{
var dialogueUI = DialogueManager.dialogueUI as StandardDialogueUI;
if (subtitle.speakerInfo.isPlayer)
{
dialogueUI.conversationUIElements.defaultPCSubtitlePanel.GetTypewriter().enabled = false;
}
else
{
dialogueUI.conversationUIElements.defaultNPCSubtitlePanel.GetTypewriter().enabled = true;
}
}
}
Re: Skip Typewriter Effect for Player
Posted: Tue Mar 03, 2020 11:49 pm
by ar4wy
Hi Tony,
I have a bit of a different problem now.
I want to NPC's name to be instant, but I want what the NPC says to be typewriter.
When I do this by using:
Code: Select all
void OnConversationLine(Subtitle subtitle)
{
subtitle.speakerInfo.Name = "\\>" + subtitle.speakerInfo.Name + "\\<";
}
The responsemenu lags quite a bit before showing up. I think it has to do with what you said about this happening AFTER OnConversationLine?
Do you have any advice how to make the NPC's name be instant without this lag?
Thanks!
Re: Skip Typewriter Effect for Player
Posted: Wed Mar 04, 2020 7:33 am
by Tony Li
Hi,
Presumably it's lagging because the node's Sequence -- or the Dialogue Manager's Default Sequence if the node's Sequence is blank -- is set to something like:
The value of {{end}} is based on the length of the text, including the name. It doesn't take RPG Maker codes into account.
Try changing the sequence to:
This will make the node continue the conversation (i.e., to the response menu) as soon as the typewriter has finished typing.
Re: Skip Typewriter Effect for Player
Posted: Wed Feb 01, 2023 10:47 pm
by ProjectN
This makes subtitle not showing. I checked the document of "Continue" and it's designed.
Is there any way to delay smartly according to typewriter, but still shows subtitle as usual?
Re: Skip Typewriter Effect for Player
Posted: Thu Feb 02, 2023 8:22 am
by Tony Li
Hi,
Are there any errors or warnings in the Console window when this happens?