Problem with a voice-over

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
User avatar
Xardas666
Posts: 35
Joined: March 10th, 2021, 7:12 pm

Problem with a voice-over

Post by Xardas666 »

Hi. I have a problem with a "[message]" tag. When I use "male_voice=" and "female_voice=" with a translatable text to support many languages... it shows me this error:
lua_error.png

Code: Select all

speaker=unit
message= _ "Show me your wares."
male_voice= _ "TRADE_SHOW_ME"
female_voice= _ "TRADE_SHOW_ME_FEMALE"
wait_description= _ "trading"
The voice plays correctly when the message is displayed, but after choosing an option in the message menu - the message disappears, Lua error is displayed and the voice is in infinite loop.

Is using translatable strings in "voice=" allowed by the game engine?

Here is full "[message]" code:
Spoiler:
Brittar
Posts: 9
Joined: January 6th, 2025, 12:24 pm

Re: Problem with a voice-over

Post by Brittar »

From my experience, it’s better to avoid using translatable strings directly in male_voice and female_voice. Instead, try hardcoding the voice file names (like "TRADE_SHOW_ME.ogg") and handle translations separately in your script. This usually prevents the infinite loop and Lua errors.
User avatar
Celtic_Minstrel
Developer
Posts: 2356
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Problem with a voice-over

Post by Celtic_Minstrel »

The mechanism to localize voice tracks is described on the wiki, though that page hasn't been updated in quite awhile. From what I can tell, it works from version 1.16 onwards. In other words, if you set male_voice=voices/trade_show_me.wav, you can then add a file voices/trade_show_me.wav for the English version and (for example) a file voices/l10n/fr/trade_show_me.wav for the French version.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
Post Reply