Forum rules - please read before posting.

Add phrases to Play Speech sequence on the fly?

Hi there!

Was trying to solve this for some time...

When my character reacts on "Look at" he says a few lines (one line for each "Look at" interaction). To make it look more natural, I'm using Variable: RunSequence first to say all the lines in "logical" order and after that I'm switching to Variable: Check Random Number to repeat them in random. But after that, if player continue to click on that hotspot, I'd like to add something like "I don't have too much time" or "I have to work now" (just an example) to the Play Speech sequence. However, If player do not click on this hotspot anymore, this phrase should diaspear from Play Speech sequence after some time (like 1-2 minutes).

Shortly, is it possible to add lines to Variable: RunSequence or Variable: Check Random Number dynamically?

Thanks!

Comments

  • To do it entirely through AC, you'd need to rely on a Local Boolean variable to keep track of whether or not the "I have to work now" message plays.

    You could then precede your Actions with Variable: Check Action to have the player say "I have to work now" if it's True.

    To have it become True, wait 2 minutes, and then become False again, you'd create a new ActionList with two Variable: Set Actions and an Engine: Wait. By being in a new ActionList, you can then set its When running Action to Run In Background so that it does not interfere with gameplay.

    That'd work for one Hotspot. For multiple Hotspots, you could conceivably rely on ActionList parameters to recycle the second ActionList. Scripting would likely be the most efficient way of handling it, however.

  • Thank you very much for the solution, Chris!

    By the way, I've created "Look At" ActionList with the Parameters for most of my "Look At"s, but can't find out how to reset Run Sequencer's counter. For example, when I click on Hotspot-1 three times I will see lines 1, 2 and 3, but if then I click on Hotspot-2, sequence for Hotspot-2 will start from line 4, not 1. I've tried to create global variable and reset it when hotspot changes, but so far no luck.

    Could you advise, please?
    Thanks!

  • If you're running the same ActionList, then the sequence won't reset automatically - the Action itself has no awareness of what was used to trigger it.

    You should be able to reset a global variable, but this would mean the old value gets lost when going back to a previous Hotspot.

    Better to rely on a custom Action that's similar to Variable: Run sequence, but instead reads from a variable in a component attached to the Hotspot.

    First, add the following script (RememeberHotspotSequence.cs) as a component to your Hotspots:

    http://pasteall.org/1402586/csharp

    This is a custom Remember script so that the sequence order will get stored in save game files - see this tutorial for more on this topic.

    Next, this custom Action (ActionHotspotSequence.cs) should serve as a replacement for your current Action:

    http://pasteall.org/1402604/csharp

    See the first link above for a tutorial on installing custom Actions - as well as the Manual's "Custom Actions" chapter.

  • Thank you very much for your help, Chris!

  • No problem - reviews are welcome!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.