Author Topic: MODULE: BACKGROUND SPEECH (with animation&sound!) v1.1.0 (for AGS 3.2+)  (Read 4582 times)  Share 

While the more experienced scripters amongst you probably have this all figured out, I reckon the rest of you would have major difficulties getting a character to say something in the background, while animating a speech view and playing a voice clip.

If so, this module is just for you, then!

You'll never want to use the old Character.SayBackground again!  ;D

Module:  Background Speech
Version: 1.1.0 (updated by And-Or)

Download it here!
Mediafire link

Works with AGS 3.2!

What it does

- Plays background speech with text, sound & animation.
- Supports multiple characters

What it doesn't

Lip sync. No can do.

----------------------------

character.SayInBackground(String message, AudioClip* clip, int view, AudioPriority priority=eAudioPriorityNormal);
Similarly as in the previous version, prints the message in "talking style", plays clip and animates the view. The difference is that you can do it for several characters at the same time (as many, as many overlays and channels there are). Also, if you don't want to play the voice, you can pass null as clip. And if you don't want to change the animation, you can pass 0 as view.
The displayed text disappears after a time that depends on the game speed and the length of the text. You can also make the character stop speaking earlier, using StopSayInBackground.

character.StopSayInBackground();
Stops speaking in background (audio and animation).

character.BackgroundTalkActive();
This will tell you if the character is currently speaking in background.
« Last Edit: 13 Oct 2012, 15:00 by Electroshokker »

Makeout Patrol

  • Don't believe everything you hear on the radio.
    • I can help with AGS tutoring
    •  
    • I can help with backgrounds
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
    • I can help with web design
    •  
  • Makeout Patrol worked on a game that was nominated for an AGS Award!
I will be using this. Thanks for the great work!

Dualnames

  • Local Moderator
  • Dualnames worked on a game that was nominated for an AGS Award!
I'd say this would have been darm good, if it wasn't already done. Don't know if its improved though ;D. If you check SSH's and Scorpiorus background speech module it offers the same thing.

monkey_05_06

  • AGS Project Admins
  • Has left the building.
Actually SSH's (coughandminecough) background speech modules allow for queued background speech with animation. So it's actually a bit different. Don't know if it's forward-compatible with AGS, I don't know how he scripted it (coughminesnotcough).
Let's be honest. Most people suck at coding. I suck at coding, but at least my code is readable. To Hell with anyone too lazy to maintain consistent formatting in their code. I could deal with bad interfaces and structure if I could even read your horrible code. And that's putting it nicely. -monkey

abstauber

  • Order of the Maggot
  • Mittens Vassal
  • quite remarkable
  • abstauber worked on a game that was nominated for an AGS Award!abstauber worked on a game that won an AGS Award!
I'm currently using SSHs and apparently your version :) - though I had to change 3 or 5 lines, but not a big deal.  The only real drawback is that it uses global INTs to trigger stuff out of a conversation.
And because it still works, I've been to lazy to implement a replacement.

But still thanks for sharing. If yours can trigger events out of a converstion, I might try.

Eggie

  • Golly!
I....
could have so used this recently...
Balls.

Hi!

I'm using your script, but there is one problem. Sometimes the animation keeps on repeating without a break. So you see the chararcters speaking animation without speaking.

Sorry for bothering you again , but since I use your Character.SayInBackground-command, there are new bugs.
1) Sometimes the animation does not stop.
2) Far worse: there are moments in the game, in which you change the charakter. Sometimes, when you change the character, the new character can't move. I hoped to solve the problem by unlocking the view of the char before changing, but it doesnt seem to work.
 
I would be very happy for some advice
 
Cheers
Helme

As I'm working on the ags linux port atm, I unfortunately don't have the time to check this. I am aware that there are certain bugs in this module. I'll try to fix these at a later point in time, but if any of you feel the need to improve the module already, be my guest.

KrisMuc solved my problem.

If you add the following to the module-code, the bug is gone.

// in rep_ex

  if (player.ID == charid) {    // oder if (player == character[charid])
    speaking = false;
    character[charid].UnlockView();
    charid = -1;
  }
« Last Edit: 27 Jul 2009, 10:48 by Helme »

Updated to v1.0.1, new version works only for AGS 3.2 (uses new-style audio scripting)

If you want the old version for use in older AGS versions, you can get it here

Enjoy!

Hi,
Long-time reader, first time writer. I am just starting my adventure with AGS and wrote my first simple game to learn how to do it.
And one of the first obstacles I stopped at was this background talk problem (no audio, no animation). I found the Electroshokker's module, but I I could not use it since I needed more than one character to be speaking at the same time. So, I rewrote it to match my requirements. If anyone's interested, here it is:

http://www.megaupload.com/?d=54P764QV

Note that the above version was only tested with AGS 3.2.1.111

The functions are as follows:

character.SayInBackground(String message, AudioClip* clip, int view, AudioPriority priority=eAudioPriorityNormal);
Similarly as in the previous version, prints the message in "talking style", plays clip and animates the view. The difference is that you can do it for several characters at the same time (as many, as many overlays and channels there are). Also, if you don't want to play the voice, you can pass null as clip. And if you don't want to change the animation, you can pass 0 as view.
The displayed text disappears after a time that depends on the game speed and the length of the text. You can also make the character stop speaking earlier, using StopSayInBackground.

character.StopSayInBackground();
Stops speaking in background (audio and animation).
 

character.BackgroundTalkActive();
This will tell you if the character is currently speaking in background.


Hope someone will find this useful :)

And-or

And-or was kind enough to mail me his version (as MegaUpload is gone), and gave me permission to upload it and link to it here, in case anyone needs it:

http://www.mediafire.com/?sf3el98nssz734e

Note: He mentions, "although it might not be exactly the same version as I might have made some improvements".

Sorry to drag this topic up after such a long time but I'm finding a problem - the text display is off the right of the screen! Any ideas about that?

I have a problem importing this, it might be a noob thing (sorry if it is) but it seems when importing scripts in AGS it looks for a .scm file, it cant actually see the .ash or .acs files.

monkey_05_06

  • AGS Project Admins
  • Has left the building.
That's because Electroshokker is a lazy jerk. :P

ASH and ASC files are just plain-text files. You can open them in Notepad. Then create a new script in your game, and copy the ASH file into your script's ASH, and the ASC file into your script's ASC. For your own convenience you could then right-click on that script and export it for easier importing into other projects.
Let's be honest. Most people suck at coding. I suck at coding, but at least my code is readable. To Hell with anyone too lazy to maintain consistent formatting in their code. I could deal with bad interfaces and structure if I could even read your horrible code. And that's putting it nicely. -monkey