Can I have a sequence/lua that modifies the subtitle text?
Re: Can I have a sequence/lua that modifies the subtitle text?
I've added a to-do task to expand the documentation on that. Currently, the Dialogue Editor page mentions that you can add custom fields to something by expanding its All Fields foldout. It also has a Template section that I'll try to make easier to find from other parts of the manual like you suggested.
Re: Can I have a sequence/lua that modifies the subtitle text?
I added a field to the dialogue entry template and it seems to work whenever I create a new dialogue entry, but how do I get all the existing dialogue entries to have this field? I think that would be worth explaining in the template section of the documentation.
Re: Can I have a sequence/lua that modifies the subtitle text?
I found the answer here: viewtopic.php?t=929
Re: Can I have a sequence/lua that modifies the subtitle text?
Oh yeah, one part here was missing: How do I subtract the energy when you select the response? This is how:
Code: Select all
using PixelCrushers.DialogueSystem;
using UnityEngine;
public class ShowEnergyCostInResponseMenu : MonoBehaviour
{
private const string sprite = "<sprite=\"Energy Symbol\" name=\"Energy Symbol\">";
private static UnityEngine.Events.UnityAction subtractEnergyCall = () => TotalEnergy.SubtractEnergy();
public void OnConversationResponseMenu(Response[] responses)
{
foreach (var response in responses)
{
var cost = Field.LookupInt(response.destinationEntry.fields, "energyCost");
if (cost > 0)
{
response.formattedText.text = sprite + response.formattedText.text;
response.destinationEntry.onExecute.RemoveListener(subtractEnergyCall);
response.destinationEntry.onExecute.AddListener(subtractEnergyCall);
}
}
}
}