Jump to content

Is it possible to translate GavinBG2 ? [SOLVED] (for the moment... )


Machiavélique

Recommended Posts

Hi all,

I would like to translate GavinBG2EE. Unfortunaly, I can see the setup-gavin_bg2.exe only allow English language so... I tried to translate the .tra files in the English directory and then launched the setup-gavin to install my translation. It work except specials caracteres as "é" "è" "î" don't display correctly.

I tried to convert my file in ANSI but that don't work either. It seem specials caracteres as  "é" "è" convert my file in UTF-8 and when I install Gavin mod for BG2 I got caracteres as "é" "è"

 

Do you have an idea to solve this problem ?Baldr002.thumb.png.3c0a9bb1a6d61ed7963b232a53cef769.png

I'm really motivate to translate completly this mod 

Edited by Machiavélique
Problem solved
Link to comment

Baldr000.png

 

I almost to get it ! (I can get uppercase characters too as "É" "À" )

In notepad++ if I enable "DirectWrite" option and I encode characters with ISO 8859-1 I can get all french characters except "œ"

Anybody have a better solution where I could get every french characters with this important character "œ" which we are using in words like "cœur", "œil" etc

Edited by Machiavélique
Link to comment

Thanks for trying to help me :)

 


I don't know why but encoded in ANSI don't work at all (I can't get "é" "è" "î" "œ" or any other accented character)

Here is 2 screenshots with my .tra file (where you can see I encoded in ANSI) and what it return in the game :

As you can see, ANSI encoded keep correctly the "cœur" word but in the game I got something else


Gavin mod BG2 don't have multi-languages intallations. I'm not sure but I think this mod use a defaut encodage which not support the "œ" character. Maybe I'm wrong cause it's the first time I try to translate a WeiDU mod but I suppose usually you select the encodage according to your language and the modder had already planned a conversion inside his mod (when you select "french" or "spanish" install, the mod installer know what to do with the .tra files).
Here the only language supported for this mod is "english", so I'm afraid this mod can only use his defaut encodage... 😐

 

Capture.pngBaldr001.png

Link to comment
18 minutes ago, Machiavélique said:

Gavin mod BG2 don't have multi-languages intallations.

Then, maybe the HANDLE_CHARSET function might not be there.

So you can try using UTF-8 for testing purpose, but at the end you will have to use ANSI anyway. Since this mod is designed both for vanilla & EE version.

notepad++ > Encodage > Convertir en ANSI/UTF-8/etc.

Link to comment

Hmm, I think the files "game-gavin_bg2.tra" and "journal-gavin_bg2.tra" should be reloaded after the utf8 conversion or the game will crash. Since it was only English so far this didn't matter.

Try the attached tp2 and put your translated files in ANSI format into a folder in languages/french as @Gwendolyne said.

If the translation is proofread I'll also integrate it into the mod package if you link me to it.

setup-gavin_bg2.tp2

Link to comment

Hi

Thank you both, I tried your setup-gavin_bg2.tp modified and now I can select the french language when I install the mod and it's really a good thing but...

That don't solve the problem with the characteres when I encode in ANSI or I convert in ANSI since UTF-8 format

 

Here is my .tra file (encoded in ANSI and displayed in ANSI) with the setup-gavin_bg2.tp2 from Jastey and what it return in the game :

Capture.pngBaldr000.png

 

 

 

Here is my .tra file (encoded in ISO 8859-1and displayed in ANSI) with the setup-gavin_bg2.tp2 from Gwendolyne and what it return in the game :

Capture.png

Baldr003.png

 

Each time I uninstall completely Gavin mod. Then I modify the .tra file or the encodage of .tra file and I reinstall the mod

So if I encode in ISO 8859-1 it works except for the "œ" character but I don't think I should continue in this way. It looks like everyone is encoding in ANSI or UTF-8 and I'm worry to waste severals months to translate something that no one could use

Edited by Machiavélique
Link to comment

Finally...

I found this topic below and I modifed the setup-gavin_bg2.tp2 :)

Now I can encode in UTF-8 and everything seems OK

Thank you very much ! Without your help, I would never found the files I needed to change :)

 

Spoiler

(By the way... I think Gavin is grateful to you too... 🥰)

 

Capture.png

Baldr001.png

 

 

 

 

Edited by Machiavélique
Link to comment

Sorry but I need your help again 🙄


Sometime, there are sentences in .d file ( eg : IF ~~ THEN DO ~DisplayStringHead(Myself,%sentence%) Wait(5)~ EXIT )
So I add a new sentence @XXX in .tra file and I edit the line in .d file to "IF ~~ THEN DO ~DisplayStringHead(Myself,@XXX) Wait(5)~ EXIT"

But... problem is all .d files are common to all languages, if I don't add the @XXX in the english file it will generate an error, right ? (In the case of an English install)

Btw in the English .tra files, the same sentence can be used when gavin know or don't know the main character. It doesn't matter in English but in French I can't use the same sentence when Gavin need to adress as "vous" instead of "tu" and vice versa. So I'll need to edit more the .d file and I can't systematically add a sentence in the english . tra files (and others futures languages).

 

Is it possible to change the setup-gavin_bg2.tp2 to it compile .d files since ~gavin_bg2/languages/french when anothers languages than English are used ?

 

What should I do ? I need your advices

 

Edited by Machiavélique
Link to comment

I found a way to get around that (for this mod)

Here is my setup-gavin_bg2.tp2

 

Before compiling, I just copy and overwrite all the .D files from the current language folder into Gavin's dialogue folder. (Of course it need to put the modified .d files in gavin_bg2/languages/%LANGUAGE%/dialogues and gavin_bg2/languages/%LANGUAGE%/dialogues/tob )


This way, when the mod installer compiles the files, it uses those corresponding to the user's language.

I don't really like this method. For me, it just looks like bad tinkering but... it works so I'll be able to continue the translation.

 

 

But... I got a new problem ! :D

I would like to add a new global variable, is this possible? Do you have any modding tutorials for beginners?


I can see that SetGlobal("B!GavNoBG1", "GLOBAL",1) allows to set a value.

I can see that Global("B!GavNoBG1", "GLOBAL",1) allows to read the value.

But where do you declare a global variable? I tried to define and read a new variable, I didn't get any errors but of course... it doesn't work !

Can you help me again? (I think I could find a way around that but... again it will be a very dirty work and I'd rather avoid it  😒)

setup-gavin_bg2.tp2

Edited by Machiavélique
Link to comment

Ok... after reading some tutorials I understood we don't need to declare the variables beforehand.
So I went back to the code and found that it works for some replicas and doesn't work for others replicas and... I don't understand why? 😕

 

Here is the code, I just add a variable B!GavAffinity (0=No affinity and Gavin says "vous" to the PC, 1=Affinity and Gavin says "tu" to the PC). I put the relevants lines in bold. If I select @1 I should go to b01 and my B!GavAffinity should be set to "1" 😕

(Btw don't worry there are no comments in my .d file. I just put comments to help you to read the code)

Spoiler

BEGIN ~BB!Gav~

BEGIN ~B!GAV~

IF ~Global("B!GavMet","GLOBAL",0)~ THEN BEGIN b00
SAY @0 // Excusez-moi, n'auriez-vous pas vu...
/* PC recognized ring */
+ ~Global("B!GavinEngaged","GLOBAL",1)~ + @1 DO ~SetGlobal("B!GavMet","GLOBAL",1)
      SetGlobal("B!GavRA","GLOBAL",1)
      SetGlobal("B!GavBG1Rom","GLOBAL",2)
      SetGlobal("B!GavBhaal","GLOBAL",1)
      SetGlobal("B!GavAffinity","GLOBAL",1)~ + b01

/* PC recognized ring */
+ ~Global("B!GavinEngaged","GLOBAL",1)~ + @2 DO ~SetGlobal("B!GavMet","GLOBAL",1)
      SetGlobal("B!GavRA","GLOBAL",1)
      SetGlobal("B!GavBG1Rom","GLOBAL",2)
      SetGlobal("B!GavBhaal","GLOBAL",1)
      SetGlobal("B!GavAffinity","GLOBAL",1)~ + b02

/* PC never saw ring, but would have been eligible for BG1 romance */
+ ~Global("B!GavinEngaged","GLOBAL",0)
      Alignment(Player1,MASK_GOOD)
      CheckStatGT(Player1,11,CHR)
      CheckStatGT(Player1,9,WIS)
      Gender(Player1,FEMALE)
      !Kit(Player1,ASSASIN)
      !Kit(Player1,BOUNTYHUNTER)
      !Kit(Player1,MAGESCHOOL_NECROMANCER)~ + @1 DO ~SetGlobal("B!GavMet","GLOBAL",1)
            SetGlobal("B!GavinEngaged","GLOBAL",1)
            SetGlobal("B!GavRA","GLOBAL",1)
            SetGlobal("B!GavBG1Rom","GLOBAL",2)
            SetGlobal("B!GavBhaal","GLOBAL",1)
            SetGlobal("B!GavAffinity","GLOBAL",1)~ + b01

/* PC is not actively engaged to Gavin but would have been eligible for BG1 romance */
+ ~!Global("B!GavinEngaged","GLOBAL",1)
      Alignment(Player1,MASK_GOOD)
      CheckStatGT(Player1,11,CHR)
      CheckStatGT(Player1,9,WIS)
      Gender(Player1,FEMALE)
      !Kit(Player1,ASSASIN)
      !Kit(Player1,BOUNTYHUNTER)
      !Kit(Player1,MAGESCHOOL_NECROMANCER)~ + @3 DO ~SetGlobal("B!GavMet","GLOBAL",1)
            SetGlobal("B!GavRA","GLOBAL",1)
            SetGlobal("B!GavBG1Rom","GLOBAL",2)
            SetGlobal("B!GavBhaal","GLOBAL",1)
            SetGlobal("B!GavAffinity","GLOBAL",1)~ + b01

/* PC is not actively engaged to Gavin but would have been eligible for BG1 romance */
+ ~!Global("B!GavinEngaged","GLOBAL",1)
      Alignment(Player1,MASK_GOOD)
      CheckStatGT(Player1,11,CHR)
      CheckStatGT(Player1,9,WIS)
      Gender(Player1,FEMALE)
      !Kit(Player1,ASSASIN)
      !Kit(Player1,BOUNTYHUNTER)
      !Kit(Player1,MAGESCHOOL_NECROMANCER)~ + @4 DO ~SetGlobal("B!GavMet","GLOBAL",1)
            SetGlobal("B!GavRA","GLOBAL",1)
            SetGlobal("B!GavBG1Rom","GLOBAL",2)
            SetGlobal("B!GavBhaal","GLOBAL",1)
            SetGlobal("B!GavAffinity","GLOBAL",1)~ + b02

/* PC would have been inelgible for BG1 romance but is eligible for BG2 romance */
+ ~CheckStatGT(Player1,7,CHR)
      CheckStatGT(Player1,7,WIS)
      Gender(Player1,FEMALE)
      !Kit(Player1,ASSASIN)
      OR(5)
          CheckStatLT(Player1,12,CHR)
          CheckStatLT(Player1,10,WIS)
          !Alignment(Player1,MASK_GOOD)
          Kit(Player1,BOUNTYHUNTER)
          Kit(Player1,MAGESCHOOL_NECROMANCER)~ + @3 DO ~SetGlobal("B!GavMet","GLOBAL",1)
            SetGlobal("B!GavRA","GLOBAL",1)
            SetGlobal("B!GavBG1Rom","GLOBAL",1)
            SetGlobal("B!GavAffinity","GLOBAL",1)~ + b01

/* PC would have been ineligible for BG1 romance but is eligible for BG2 romance */
+ ~CheckStatGT(Player1,7,CHR)
      CheckStatGT(Player1,7,WIS)
      Gender(Player1,FEMALE)
      !Kit(Player1,ASSASIN)
      OR(5)
          CheckStatLT(Player1,12,CHR)
          CheckStatLT(Player1,10,WIS)
          !Alignment(Player1,MASK_GOOD)
          Kit(Player1,BOUNTYHUNTER)
          Kit(Player1,MAGESCHOOL_NECROMANCER)~ + @4 DO ~SetGlobal("B!GavMet","GLOBAL",1)
            SetGlobal("B!GavRA","GLOBAL",1)
            SetGlobal("B!GavBG1Rom","GLOBAL",1)
            SetGlobal("B!GavAffinity","GLOBAL",1)~ + b02

/* PC is ineligible for romance in BG2 */
+ ~OR(4)
      !CheckStatGT(Player1,7,CHR)
      !CheckStatGT(Player1,7,WIS)
      !Gender(Player1,FEMALE)
      Kit(Player1,ASSASIN)~ + @3 DO ~SetGlobal("B!GavMet","GLOBAL",1)
      SetGlobal("B!GavBG1Rom","GLOBAL",1)
      SetGlobal("B!GavAffinity","GLOBAL",1)~ + b03

/* PC is ineligible for romance in BG2 */
+ ~OR(4)
      !CheckStatGT(Player1,7,CHR)
      !CheckStatGT(Player1,7,WIS)
      !Gender(Player1,FEMALE)
      Kit(Player1,ASSASIN)~ + @4 DO ~SetGlobal("B!GavMet","GLOBAL",1)
      SetGlobal("B!GavBG1Rom","GLOBAL",1)
      SetGlobal("B!GavAffinity","GLOBAL",1)~ + b04

/* PC recognized ring */
+ ~Global("B!GavinEngaged","GLOBAL",1)~ + @5 DO ~SetGlobal("B!GavMet","GLOBAL",1)
      SetGlobal("B!GavRA","GLOBAL",1)
      SetGlobal("B!GavBG1Rom","GLOBAL",2)
      SetGlobal("B!GavBhaal","GLOBAL",1)
      SetGlobal("B!GavAffinity","GLOBAL",1)~ + b05

/* PC did not recognize ring, is eligible for BG2 romance */
+ ~!Global("B!GavinEngaged","GLOBAL",1)
      CheckStatGT(Player1,7,CHR)
      CheckStatGT(Player1,7,WIS)
      Gender(Player1,FEMALE)
      !Kit(Player1,ASSASIN)~ + @5 DO ~SetGlobal("B!GavMet","GLOBAL",1)
            SetGlobal("B!GavNoBG1","GLOBAL",1)
            SetGlobal("B!GavRA","GLOBAL",1)
            SetGlobal("B!GavAffinity","GLOBAL",0)~ + b06

/* PC did not recognize ring, is ineligible for BG2 romance */
+ ~!Global("B!GavinEngaged","GLOBAL",1)
      OR(4)
      !CheckStatGT(Player1,7,CHR)
      !CheckStatGT(Player1,7,WIS)
      !Gender(Player1,FEMALE)
      Kit(Player1,ASSASIN)~ + @5 DO ~SetGlobal("B!GavMet","GLOBAL",1)
            SetGlobal("B!GavNoBG1","GLOBAL",1)
            SetGlobal("B!GavAffinity","GLOBAL",0)~ + b06
END

IF ~~ b01
SAY @6 // Lanie est partie. Lorsque je suis retourné à Bérégost, la maison était vide. Alors évidemment, je suis parti à sa recherche. J'étais sur le point de troquer mon armure contre un autre sort de scrutation.
++ @7 + b07
++ @8 + b08
+ ~Global("B!GavAffinity","GLOBAL",1)~ + @127 + b219 // Affinite ?
+ ~Global("B!GavAffinity","GLOBAL",0)~ + @128 + b220 // Pas affinite ?
++ @9 + b09
++ @10 + b10
++ @11 + b11
+ ~GlobalLT("Chapter","GLOBAL",%bg2_chapter_4%) !Global("B!GavNoBG1","GLOBAL",1)~ + @12 + b19
++ @13 + b1a
END

IF ~~ b1a
SAY @14 // <CHARNAME>, I...
= @15 // Je t'en prie. Si je veux réussir à la retrouver, j'ai besoin de ton aide.
++ @16 + b07
++ @17 + b08
++ @9 + b09
++ @10 + b10
++ @11 + b11
+ ~GlobalLT("Chapter","GLOBAL",%bg2_chapter_4%) !Global("B!GavNoBG1","GLOBAL",1)~ + @12 + b19
END

IF ~~ b02
SAY @18 // Je comprends ce que tu ressens. Je suis parti beaucoup plus longtemps que prévu mais c'est juste que... quelque chose de terrible et d'inattendu est arrivé.
IF ~~ THEN + b01
END

IF ~~ b03
SAY @19 // Je suis à la recherche de Lanie, et ce depuis des mois. Quand je suis retourné la voir à Bérégost, elle n'était plus là. J'étais sur le point d'échanger mon armure contre un autre sort de divination.
++ @7 + b07
++ @8 + b08
++ @9 + b09
++ @10 + b10
+ ~GlobalLT("Chapter","GLOBAL",%bg2_chapter_4%) !Global("B!GavNoBG1","GLOBAL",1)~ + @12 + b19
++ @11 + b11
END

IF ~~ b04
SAY @20 // Oui, ça fait si longtemps. J'aurais dû revenir depuis tout ce temps, mais quelque chose de terrible s'est produit.
IF ~~ THEN + b03
END

IF ~~ b05
SAY @21 // Est-ce que j'ai changé à ce point ?
++ @22 + b12
++ @23 + b02
++ @24 + b13
++ @25 + b14
END

IF ~~ b06
SAY @26 // Non, je ne crois pas. Je suis Gavin Mor, Semeur d'Aube. Je reviens juste de Bérégost.
++ @27 + b15
+ ~Global("B!GavAffinity","GLOBAL",1)~ + @127 + b219 // Affinite ?
+ ~Global("B!GavAffinity","GLOBAL",0)~ + @128 + b220 // Pas Affinite ?
++ @28 + b15
++ @29 + b17
++ @30 + b18
END

 

 

 

 And here is what I got if I select "1.Gavin !? Mais que fais-tu ici, mon amour ?"

Spoiler

Baldr002.png

Baldr003.png

I expect to get the choice "3. Affinité ?" whereas I get the choice "3. Pas affinité ?", which means my B!GavAffinity is set to "0" instead of "1" and I don't understand why... ?

 

At the first dialogue, If I select :

"1. Gavin !? Mais que fais-tu ici, mon amour ?" B!GavAffinity takes the wrong value

"2. Gavin ! Qu'est-ce que tu fais ici ?" B!GavAffinity takes the wrong value

"3. Hmf. Je ne pensais pas te revoir un jour." B!GavAffinity takes the good value

"4. Est-ce... que je vous connais ?" B!GavAffinity takes the good value

 

EDIT :

I tried uninstalling the mode completely, reinstalling it and creating a new game and I get the same problem 😐

Edited by Machiavélique
Link to comment

Ah ah I GOT IT !! :D

 

Good to know : It seems there are a delay after an "ACTION", you can't Set a variable and immediatly check its value. When I check my variable with CLUA console, I always got the good value but the code doesn't work.

 

IF ~~ LABEL

SAY %Gavin sentence%

++ %PC sentence% DO ~SetGlobal("B!GavAffinity","GLOBAL",1)~ + NextLabel

END

 

IF ~~ NextLabel

SAY %Another Gavin sentence%

+ ~Global("B!GavAffinity","GLOBAL",1)~ + %Another PC sentence% + AnotherLabel

END

 

This code is simplified version of the problem and may not work properly. B!GavAffinity will be Set to "1" anyway but... B!GavAffinity can still be Set on "0" when read from NextLabel (it seem "0" is the default value, I have tested if I use the values "1" and "2" instead of "0" and "1" and these choices don't display at all)

 

To confirm this default, I just added a kind of timer :

Spoiler

Sans-titre.jpg

 

Baldr000.png

Baldr001.png

Baldr002.png

Baldr003.png

 

 

I just set the value of the variable, put an intermediate label, and read the value of this variable.

Strangely... everything works fine now 😃

 

PROBLEM SOLVED

I don't need to put an intermediate label because for now I don't need to check the value right after I changed it. But I will be careful about this in the future...

Edited by Machiavélique
Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...