Modding Help Translation mod with json not xnb?

Discussion in 'Mods' started by tukwila_kamuks, Jul 6, 2019.

Tags:
  1. tukwila_kamuks

    tukwila_kamuks Intergalactic Tourist

    Hi, I'm doing a full translation mod but want to do it Content Patcher style. So far I've got the text to appear in-game if I make the content patcher point to an .xnb but i'm on a Mac and can't easily unpack/repack .xnb files (so far my friend's doing it for me each time — xnbcli only gives me errors) so is there a way to make the game read the text from .json files instead so I don't have to do any packing?

    I have no idea what I'm doing, this is my first mod and I've just copied what I saw in other mods so right now I have entries like this for each .xnb:

    {
    "Action": "load",
    "Target": "Data/Events/Farm”,
    "FromFile": "assets/Farm.xnb
    }

    This code doesn't work with Farm.json (the text doesn't appear in-game) but works for Farm.xnb. Is there any way to make .json work instead?

    For anyone interested in the xnbcli problem (I've tried putting files both in the "packed" and "unpacked" folder, the same error comes each time) the error is:

    xnbcli/unpack.command: line 3: ./xnbcli: No such file or directory


    (EDIT: xnbcli problem is fixed thanks to this thread but it'd still be very helpful if I could use .json instead of .xnb)
     
      Last edited: Jul 6, 2019
    • jahangmar

      jahangmar Sandwich Man

      Regarding the xnbcli problem: You have to change your current directory to the xnbcli folder first. Do "cd xnbcli" and then "./unpack.command"
       
      • tukwila_kamuks

        tukwila_kamuks Intergalactic Tourist

        Doing that gives a different error, which is "Permission denied", but now I see it's common based on a thread here and got it working, thanks!

        However I'd still like to know if it's possible to point the game to read the .json similar to how you can point it to just a .png since that'd save a lot of time and make it faster to preview the translation, I'd be grateful if anyone can help!
         
        • pepoluan

          pepoluan Big Damn Hero

          At the moment, it cannot.

          You have to paste the JSON inside content.json and use the "EditData" action.
           
          • tukwila_kamuks

            tukwila_kamuks Intergalactic Tourist

            Sorry, I don't understand what you mean clearly. You mean that it is possible right now but my code is wrong (like I wrote before, I really don't know what I'm doing at all, I need help like for a baby), or that it's not possible but it will be possible years in the future? I think you mean the first one so I will try to figure out what you said by looking at other mods. I saw some that used "edit data" but it looks like they only edited single lines of dialogue, they didn't make the game read the entire dialogue file at once, but I'll try to figure it out, thanks!
             
            • pepoluan

              pepoluan Big Damn Hero

              Basically, the current version of ContentPatcher does not have the capability of referring to another JSON file to inject into the game.

              Rather, whatever JSON values that will replace the game's data needs to be pasted directly in the content.json file itself, with "Target" pointing to the game data structure to overwrite.

              The overwrite still have to take place "entry by entry"

              Take a look at Female Bachelors Dialogue Overhaul mod, for instance. It basically overwrites a whole lot of the game's JSON data with many things, all contained in the content.json file.
               
              • MouseyPounds

                MouseyPounds Cosmic Narwhal

                The current version of Content Patcher absolutely can "Load" data files from a JSON, but you have to make sure that the header information from xnbcli is stripped out. Basically the json file should look something like this:
                Code:
                {
                  "5/e 3/v Abigail": "continue/64 15/farmer 64 16 2 Abigail 64 18 0/pause 1500/speak Abigail \"Hi. Um... I just wanted to say sorry for acting so weird yesterday.#$b#You probably understand what happened...$l#$b#Uh, okay...bye.\"/pause 500/end",
                  "47/f Sam 2000/t 600 800/e 44": "continue/64 15/farmer 64 16 2 Sam 64 18 0/pause 1500/speak Sam \"Hi @. Guess what? My band is playing a show tonight, in Zuzu City!#$b#Meet me at the bus stop around 4:00 this afternoon to leave for the show. You better be there!\"/pause 300/end dialogue Sam \"I'm excited and a little nervous for the show tonight. I'm sure everything will turn out okay.\"",
                  // other entries removed for brevity
                }
                 

                Share This Page