FANDOM


This is a script that allows Adventure Creator and Super Text Mesh to work together. With some simple modifications, it could be used for other text-drawing assets!

Essentially, it uses AC for audio, user input, etc., but lets STM handle all text-specific items, like scrolling speed, animated letters, and colors.  It does this by running AC's normal text system offscreen, while STM directly samples the dialogue being written from the Dialog manager.


This script should be saved as SuperTextFromACSpeech.cs.  As mentioned in the comments, put it on a super text object in your subtitles UI adventure creator menu.

using UnityEngine;
using System.Collections;

public class SuperTextFromACSpeech : MonoBehaviour {
    /*
    This script is to make Super Text Mesh work with Adventure Creator.
    Essentially, it lets AC handle all non-text elements (sound effects, user input),
    while letting STM handle all text-related issues (scrolling speed, animations, colors, etc.)

    Simply put this script on a Super Text ui item in your subtitlesUI adventure creator menu,
    then hide the text item that AC thinks it's referencing (put it offscreen, make it invisible, whatever!).

    AC will play dialogue sounds and handle input as normal,
    but the player will only see the Super Text.

    Script by @johndaguerra.  No credit needed, but I'm cool and it'd make me happy if you followed me on twitter!
    */
    SuperTextMesh supertext;
    AC.Speech speech;
    AC.Dialog dialog;

    void Start () {
        supertext = GetComponent<SuperTextMesh>();
        dialog = FindObjectOfType<AC.Dialog>();
    }
	
	void Update () {
        //If there is dialogue currently being spoken...
        if (dialog.GetLatestSpeech() != null)
        {
            //And you haven't already sampled it...
            if (speech != dialog.GetLatestSpeech())
            {
                //Then set the supertext text to print the dialogue
                speech = dialog.GetLatestSpeech();
                supertext.Text = speech.log.fullText;
                //This tells the text to read at regular speeds, in case it was told to speed read
                supertext.RegularRead();
            }
        }

        if (supertext.reading == true)
        {
            if (Input.GetMouseButtonDown(0) || Input.GetKeyDown("space"))
            {
                //If the player clicks or presses space while reading, then speed read
                supertext.SpeedRead();
            }
        }

    }
}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.