bcholmes / StarTrek2d20

Character creation tool for Star Trek Adventures RPG from Modiphius.
ISC License
18 stars 7 forks source link

JSON file to import into FoundryVTT #119

Closed Puckeye closed 1 year ago

Puckeye commented 1 year ago

As requested on Discord here's the request to add a download button to get a JSON file to import into FoundryVTT. I'd see that button either at the end of character creation where you can export to PDF and/or the permanent URL for characters,

Thanks for the great work.

bcholmes commented 1 year ago

I've implemented a first version of this functionality, accessible from the view pages for main and supporting characters.

Puckeye commented 1 year ago

This looks great! Thanks

Felderburg commented 1 year ago

Is there a possibility of doing this for the Fantasy Grounds module? It would probably be an xml file? I'll poke around the FG version and see what it has.

bcholmes commented 1 year ago

It's almost-certainly possible. I don't have Fantasy Grounds, myself, so I'd need the output of that poking around to help me, and I'd probably need someone to test things out.

Felderburg commented 1 year ago

It's almost-certainly possible. I don't have Fantasy Grounds, myself, so I'd need the output of that poking around to help me, and I'd probably need someone to test things out.

Attached is an exported character (they export as xml which github evidently doesn't support, so I saved it in notepad++ as .txt with no changes). This character was generated through the FG "character creator" which walks people through the lifepath creation process. Characters can also be created from scratch, which I assume would yield different results (especially in the attribute and discipline sections, which it looks like have the calculations from the lifepath steps—while a scratch character can have those options drag-and-dropped, if someone were to type them or change them manually I am currently unsure what it would look like).

I will endeavour to get other examples to you, specifically a drag-and-dropped character and a totally manual one, but not tonight.

The thing about FG is that most talents don't actually have mechanical effects, and must have their effect be manually done in FG. So that probably makes an export easier. You can make "custom" talents as well, so it should be possible to see what an export of a character with talents and lifepath options not covered in the available FG modules looks like, which would make an export of a character with Delta Quadrant stuff, for example, possible from this tool to an FG-readable xml.

Vulcan Test Export.txt

Edit: you will note the presence of curly apostrophes converted into &#8217 ; type stuff; I submitted that issue as a bug on the FG forums. Most of them seem to appear in talent or item descriptions, so they shouldn't affect anything mechanical if you use straight apostrophes.

Edit: I strongly suspect a simplified version would work. Many items have a lot of formatting that is, mechanically, unnecessary. For example, the career events, while looking nice in FG, probably don't need the bolding and extra lines to be readable. I'm not sure how hard it would be to take things like that from the helpers files and turn them into xml—the text is there, but is it worth formatting for FG?

I should also note that I will provide screenshots of the character sheets in FG at some point, because looking at the xml and the sheet in FG, it is immediately obvious what tags are important and how they go in the UI, but won't be if you don't have FG.

bcholmes commented 1 year ago

This bit, here, looks a bit hard to produce:

  <control>
    <careerevent type="number">0</careerevent>
    <edit type="number">7</edit>
    <environment type="number">0</environment>
    <misc type="number">0</misc>
    <species type="number">1</species>
    <total type="number">11</total>
    <training type="number">1</training>
    <upbringing type="number">2</upbringing>
  </control>

It looks like a summary of how the different points were applied (a base of 7, +1 because Vulcan species, +2 because of upbringing, +1 because of Starfleet training). I might be able to derive that at the time a character is first generated; the "view" version of the character doesn't currently save that information.

The links might also be hard. The format for some of them might be doable; I'll need to think about it. How many sources do they currently support?

And am I reading it right that you gave the character focus names like "upbringing focus"?

Felderburg commented 1 year ago

I don't think that the way the points are gained/calculated matters to FG mechanically (I assume that the dev of the ruleset kept things notated this way for transparency/better record keeping). That's why I'll be creating a character manually, to see what that looks like (I will also edit Mr. Vulcan Test manually to see how that goes). I'm away from my FG computer, but as I recall you can just type a new number in, or do a "temporary" change which changes the total but has an indicator number next to the stat of how much it was changed by, which should be interesting to see the xml of.

And am I reading it right that you gave the character focus names like "upbringing focus"?

Correct. For the steps that have a focus or a value, I put [step] [item]. It seemed like that would be easier to see the structure of things that way.

The links might also be hard. The format for some of them might be doable; I'll need to think about it. How many sources do they currently support?

They currently support the Starfleet core book and Alpha Quadrant. Based on how quickly Alpha came out after the core, I assume the other quadrant books will also be out relatively soon. I will not be purchasing anything other than the core from FG (maybe Klingon core if it includes updated milestones and the House system).

The links are interesting, and another reason we need to see a manual/custom character. Not only can things be typed in manually to a character sheet, it is also possible to create custom lifepath options, which link in the same way as the rules-as-written ones on the character sheet, but I assume don't link to "reference.environment.id-00001@Star Trek Adventures Core Rulebook" (e.g.).

I'll muck about this evening (maybe) and do some more exports. I still strongly suspect that this version of an export is more complicated than a custom character will be, or if I just type in stats from a character created using this tool.

Should FG importable stuff be kept in this issue, or moved to an FG-specific issue?

bcholmes commented 1 year ago

Yeah, an FG-specific issue is probably a good thing.

CraftyAF commented 1 year ago

Could you add an extra JSON export formatted for import into FVTT's current STA module? I have attached a sample character export. fvtt-Actor-lir-greln.json.txt

bcholmes commented 1 year ago

So, it's been a few months since this was originally opened, but I think I've got a working version of this export working.

There are some parts of the output that are a little bit opaque, and as a result, I'm not 100% sure how well this works for people who are not me. I'm able to fairly seamlessly export characters (main characters, npcs, etc.) from the character creator and import them into an instance of Foundry running on my machine.

When I try CrafyAF's attached character, I have some issues with images.

CraftyAF commented 1 year ago

Awesome! I'll test right away!

CraftyAF commented 1 year ago

Seems to work perfectly! KStadi Kolel_Stadi-sta-npc

bcholmes commented 1 year ago

Great to hear!