How to code a translator/interpreter situation?

Started by Kumpel, Tue 23/02/2016 19:41:52

Previous topic - Next topic

Kumpel

For my refugee adventure The Refuge I want to create a situation, where the arabian player character talks with a german official supported by an interpreter/translator sitting in the same room. My idea is now to let the official say some stuff with talk animation (e.g. "Hallo Herr Hamri, .... ..... ..... ..... ...... .....") wait a few cycles and let the translator say it in the language the player understands while after another few cycles the official stops talking (as in a common translation process).

I tried to solve this problem in several ways but never found a solution that a) includes speech animation when the official talks and b) shows the two speeches in parallel with the staggering disappearings.

Anybody got an idea how to code this translator situation? Any ideas are welcome! (nod)

Slasher

you could try the bgspeech module which runs speech in the background (with talk animation) whilst another char is talking..

Kumpel

yeah I know and i tried that but it doesnt work as expected. how would you code an example that does what i want to achieve?

Crimson Wizard

#3
With Overlays (both graphical and textual) you may achieve nearly any combination of image and text on screen, even animated one (although latter would require additional scripting).

Another option is to use GUI with text and animated buttons for that particular case.

Kumpel

So you would suggest to leave the character sprite (the one that talks in the background) empty and replace it with an animated button that has the size of the screen and is using the same sprites and animations at the character sprite's location in an otherwise 100% transparent GUI? When does the Button get animated? when the player clicks on anywhere in the screen?
Or am I misunderstanding something here? 

I am still trying to do it with the BgSpeech module which uses the overlays you suggest. But my problem is the timing. I need the translator speech to be "Say" - so that the game only goes on when the player clicks it away - but the "Say" speech has to appear only when the upstream overlay with speech animation appeared. How do I time that? Does it need to be realized completely in r_e_a and r_e then? If yes, How do I simulate the "click"?

I simplified the officials speech now to a simple "*talks in german*" so that I can always use the same code. I just need to crack my timing problem. ???

Khris

I'd do it like this:
The official's speech is faked by a) a non-blocking character animation, and b) a TextOverlay / bgSpeech.
The translator uses actual speech that can be skipped by the player.

The formula for speech frames is:
Code: ags
int gameloops = ((text.length / Game.TextReadingSpeed) + 1) * GetGameSpeed();

Use a custom speech function that starts the animation, displays the Overlay and starts two timers. Timer #1 is set to something like 2 seconds, timer #2 to the calculated gameloops.

In r_e when timer #1 expires, call cTranslator.Say() and set a bool "translation_speech" to true.
Also, independent of the timer, check said bool for being true (which means the player skipped the translator's speech). If so, reset timer #2 to 1 (ending the official's speech prematurely due to the player skipping).
You need to first check the bool, then the timer, so the translator's .Say() will disable r_e before the bool is tested.

In r_e_a when timer #2 expires, stop the official's animation and remove the overlay.

Not tested though!

SMF spam blocked by CleanTalk