Character speech interrupts movement...

Started by harmonicapress, Wed 11/12/2013 03:24:19

Previous topic - Next topic

harmonicapress

Hey guys.  Still having an issue. Now that I've put in the SayBackround command, the text he's supposed to be shouting comes up with the timers, but he won't animate, he just stands there ventriliquizing (shouting without moving his lips or arms). How can I get him to run the speech view with the SayBackground command, or is there another workaround? here is my code...

function room_Load()
{
  SetTimer(1, 120);
  SetTimer(2, 200);
  SetTimer(3, 280);
}

function room_RepExec()
{
  if (IsTimerExpired(1)){
    cArchie2.SayBackground("Come One! Come All!");
    SetTimer(1, 120);
}
  if (IsTimerExpired(2)){
    cArchie2.SayBackground("See my fabulous assortment of goods available for astonishingly low prices!");
    SetTimer(2, 200);
}
  if (IsTimerExpired(3)){
    cArchie2.SayBackground("There's none so fair as 'Ferris Wares'!");
    SetTimer(3, 280);
  }}

monkey0506

I believe you're just looking for the Character.SayBackground function:

Quote from: The ManualOverlay* Character.SayBackground(string message)

Similar to Say, except that this function returns immediately and the game continues while the character is talking. This allows you to have characters talking in the background while the player does other things. Note that the character's talking animation is not played if this function is used.
This command works by creating a text overlay with an automatic removal time delay. The overlay is returned by this command, so you can save it for use later with Overlay.IsValid and Overlay.Remove, if you want to remove the text prematurely.

If background speech is already on-screen for the character, it will be removed and replaced with the new MESSAGE.

All background speech is automatically removed when a normal Say command is used (unless you set the global variable game.bgspeech_stay_on_display to 1).

Example:

Code: ags
cMan.SayBackground("Hey, why won't you talk to me?");


will display the message above character MAN's head without pausing the game.

For what it's worth, the description for Character.Say isn't very informative on when you'd want to use SayBackground instead. This entry clarifies, but it would be worth updating the Say entry as well.

selmiak

#2
what monkey said, and also your timer logic looks flawed. here is what I would do:
Code: AGS

function room_Load()
{
  SetTimer(1, 120);
}

function room_RepExec()
{
  if (IsTimerExpired(1)){
    cArchie2.SayBackground("Come One! Come All!");
    SetTimer(2, 60);
  }
  if (IsTimerExpired(2)){
    cArchie2.SayBackground("See my fabulous assortment of goods available for astonishingly low prices!");
    SetTimer(3, 80);
  }
  if (IsTimerExpired(3)){
    cArchie2.SayBackground("There's none so fair as 'Ferris Wares'!");
    SetTimer(1, 120);
  }
}


This starts one time with the end of the other timer and so no timers will expire on the same gameframe.

Khris

The timers are all started in the same frame, so the original method is fine, except that it doesn't loop.
Also, it's SayBackground, not Say :)

selmiak

added the SayBackground, but the original code has for example the line 1 and line 2 said at the same time after 5x timer 1 or am I missing something?

Khris

Like I said it doesn't loop, so no 5x, just 1x.
He'd simply have to add
SetTimer(1, 120);
SetTimer(2, 200);
SetTimer(3, 280);
after the third SayBackground() though.

harmonicapress

Hey guys.  Still having an issue. Now that I've put in the SayBackround command, the text he's supposed to be shouting comes up with the timers, but he won't animate, he just stands there ventriliquizing (shouting without moving his lips or arms). How can I get him to run the speech view with the SayBackground command, or is there another workaround? here is my code...

function room_Load()
{
  SetTimer(1, 120);
  SetTimer(2, 200);
  SetTimer(3, 280);
}

function room_RepExec()
{
  if (IsTimerExpired(1)){
    cArchie2.SayBackground("Come One! Come All!");
    SetTimer(1, 120);
}
  if (IsTimerExpired(2)){
    cArchie2.SayBackground("See my fabulous assortment of goods available for astonishingly low prices!");
    SetTimer(2, 200);
}
  if (IsTimerExpired(3)){
    cArchie2.SayBackground("There's none so fair as 'Ferris Wares'!");
    SetTimer(3, 280);
  }}

SMF spam blocked by CleanTalk