Speech animation

Started by .M.M., Sun 30/09/2007 13:14:31

Previous topic - Next topic

.M.M.

I'm using top bars instead normal dialogs. How can I simply add speech animation for characters?

Ashen

Just to be clear, are you using DisplayTopBar (which seems likely based on this earlier post)?

If so, what have you tried, and what's wrong with the results?
Character.Animate seems to work just fine, e.g.:
Code: ags

player.Animate(player.Loop,3, eRepeat, eNoBlock);
DisplayTopBar(50,14,1986,"Roger", "Hello there!");
player.ChangeView(player.View); // This stops the aniamtion from running.


Obviously, that doesn't take into account the character's Speech view, butthat should be easy enought to account for. You could even turn it into a function, to make it easier to use repeatedly:
Code: ags

function Speak(Character *theChar, int y, int text_color, int back_color, String titleText, String message) {
  int TempI = theChar.View;
  theChar.ChangeView(theChar.SpeechView);
  theChar.Animate(theChar.Loop, 3, eRepeat, eNoBlock);
  DisplayTopBar(y, text_color, back_color, titleText, message);
  theChar.ChangeView(TempI);
}

// And then:
Speak(player, 50, 14, 1986, "Roger", "Hello there!");


Also, do you mean 'Dialogs', as in Dialog.Start(), Dialog.SetOption, etc, or 'dialogue', like you're using it in place of Character.Say? That might've caused the confusion in the other thread.
I know what you're thinking ... Don't think that.

monkey0506

#2
Ashen, why would you store the character's view, change the view, animate the character, then set it back to what it was in the first place instead of using Character.LockView/Character.UnlockView? If there is then by all means please do tell me...I'm just failing to see why you couldn't do this instead:

Code: ags
function Speak(Character *theChar, int y, int text_color, int back_color, String titleText, String message) {
  if (theChar.SpeechView != 0) {
    theChar.LockView(theChar.SpeechView);
    theChar.Animate(theChar.Loop, 3, eRepeat, eNoBlock);
    DisplayTopBar(y, text_color, back_color, titleText, message);
    theChar.UnlockView();
  }
}

// And then:
Speak(player, 50, 14, 1986, "Roger", "Hello there!");


It's virtually the same, but it doesn't change the character's normal view. Also I've added a check to make sure the character has a valid speech view set.

Edit: Valid point Ashen. ;) Way to keep each other in check eh?

Ashen

Quote
Ashen, why would you store the character's view, change the view, animate the character, then set it back to what it was in the first place instead of using Character.LockView/Character.UnlockView?

Because I was confusing it with something else I was working, on, obviously :)
You're right, in this case Lock/UnlockView makes more sense, although the effect is the same. The theChar.SpeechView != 0 check is a good idea as well - maybe make the theChar.Animate command conditional too, so it doesn't play a 'walking on the spot' animation when they speak.
I know what you're thinking ... Don't think that.

.M.M.

Thanks,I was using eBlock...
:o :o :o

SMF spam blocked by CleanTalk