Mod Page Under Construction
This WIP mod expands fleet dialogue options for npc fleets.
The current options are:
1) Commodity Requests (Fuel, Supplies, Credits)
Examples:
Spoiler
(https://i.imgur.com/38XSjJx.png)]
(https://i.imgur.com/wMP6Muu.png)
(https://i.imgur.com/4l4MQ8I.png)
(https://i.imgur.com/4N5WDqk.png)
(https://i.imgur.com/m0PzHgU.png)
(https://i.imgur.com/1bquqyq.png)
(https://i.imgur.com/l8nAKFO.png)
(https://i.imgur.com/6c1oNOM.png)
(https://i.imgur.com/J6hIcR9.png)
(https://i.imgur.com/3YbkHMU.png)
(https://i.imgur.com/KmkIssH.png)
(https://i.imgur.com/UJTY9cZ.png)
(https://i.imgur.com/utY6Zwo.png)
(https://i.imgur.com/BbGiJ9z.png)
(https://i.imgur.com/j1QC5Es.png)
(https://i.imgur.com/IREPtgE.png)
(https://i.imgur.com/nVbD4dg.png)
(https://i.imgur.com/6FKfFFR.png)
(https://i.imgur.com/W8NdYOp.png)
2) Ceasefire Negations (Can also use bribes to increase the chance of success)
Examples:
Spoiler
(https://i.imgur.com/I0glBgq.png)
(https://i.imgur.com/HGQO5Up.png)
(https://i.imgur.com/mIrd3FE.png)
(https://i.imgur.com/KSAvu0r.png)
(https://i.imgur.com/zBrnFHj.png)
(https://i.imgur.com/5mPOiTR.png)
(https://i.imgur.com/sY5HXKH.png)
(https://i.imgur.com/e7g2awy.png)
(https://i.imgur.com/qhCnsNn.png)
(https://i.imgur.com/xnL162E.png)
(https://i.imgur.com/fwRD6x7.png)
(https://i.imgur.com/MJHBP5P.png)
(https://i.imgur.com/NaqALD6.png)
(https://i.imgur.com/oRa4rTR.png)
(https://i.imgur.com/jtaqs3D.png)
(https://i.imgur.com/qblElqB.png)
(https://i.imgur.com/i5I7mFp.png)
Mod Compatibility Information:
For those mods who implement their own dialogue, that dialogue will not spawn this mod's dialogue options. A couple examples: Coalition, Dassault-Mikoyan Engineering
However, mods that use the standard default fleet dialogue from vanilla for their mod faction will have the options populated. Example: Diable Avionics
Opt In/Out Options: the mod plugin can be set up to crash the game if Fleet Dialogue is active, so that is one way a modder can easily get around this. Another way would be to just implement custom faction dialogue using the unique mod id to prevent the default vanilla dialogue from being used.
There isn't an easy way around this on my side since many vanilla factions rely upon the defaults, but as an olive branch if there are particular modder/modders who really don't want to add custom dialogue for their faction or an exclusion in the mod plugin and also don't want these options available: Post here with a link to the mod page and I will try and add a "not this faction" check to the defaults and I *think* that should allow the original defaults in vanilla to still populate for that faction without the dialogue options. That is very much an educated guess though, and will be done in an "upon request" kind of way.
Similarly, if you have implemented custom dialogue for your mod faction, and would like these options to be included in the interim between release and if/when I can set up some way of doing this in the mod faction's directory, you can post here and I will implement the dialogue with the necessary script in this mod.
With the caveat that I didn't read everything (sorry!) and might thus be missing some critical bit of context:
The entry point for the extended dialog is a PickGreeting rule, right? Why not add a condition to it, like this:
!$faction.c:optOutOfMorrokainExtendedDialog
And then in the .faction file, in the custom section, one could add "optOutOfMorrokainExtendedDialog":true, for any faction that didn't want this dialog to fire.
If the custom values aren't populated into $faction memory the current release (i.e. if this is an in-dev feature), you could do this yourself in the CampaignPlugin.updateFactionFacts() method, like so:
if (JSONObject.getNames(faction.getCustom()) != null) {
for (String key : JSONObject.getNames(faction.getCustom())) {
String val = faction.getCustom().optString(key);
memory.set("$c:" + key, val, 0);
}
}
Update: Success!
I have a working example of the first element of description dialogue loading from the csv and being used as intended in the campaign. I have also successfully parsed the first variable $personRank into the correct data when pulled from the spreadsheet.
Phew! It's a proof of concept at least. There is still a lot of work to do, though. I also need to test the implementation of multiple options in each category (like rules separated by "OR").
Is there any place that documents all of the possible variables in the text portion of rules? Or maybe a class? I can't remember. I also plan on adding a couple of my own most likely. :)
Examples:
Spoiler
(https://i.imgur.com/ogaxWjp.png)
(https://i.imgur.com/rdmCw7N.png)
(https://i.imgur.com/NdWHFHG.png)
Wow it has almost been a year since I last posted on this thread. Time flies fast that's for sure.
Its a long way from being done, but I figured I'd share some pics for some of the features that this mod will have available for other modders to customize content. I've set the dialogue up to be "opt-in" by adding:
"optInMorrokainExtendedDialog":true,
To the custom section of the relevant faction file. Vanilla factions will be enabled by default.
For those who want extra customization (such as enabling the dialogue as a whole but blacklisting certain entities where it doesn't make sense) I plan on accommodating things like that too but haven't gotten to it quite yet. It will likely be a separate spreadsheet containing entity ids.
So far I've managed to convert the entire portion of requesting commodities to the merging spreadsheet. There doesn't appear to be any bugs in the logic so far. Ideally the addition of dialogue using the custom tokens to do things like highlights, multiple responses for each section of the dialogue, etc, will be fairly bullet proof for ease of use. It should already do things like throw an exception and report if a modder started a highlight wrapper and then didn't use an end highlight wrapper.
Unlike rules, a modder also can use any color for highlights to their dialogue. There are set ones for those who don't want to get too technical. Currently the basic options are: story (vanilla story hl), faction (faction color), red, green, blue, purple, yellow, orange, pink, teal, gray, positive (vanilla positive hl), negative (vanilla negative hl), and default (vanilla default hl). However, for those who have something else in mind there is also the option of custom colors. After the wrappers, simply use rgba values just like you would in java.
There will also be additional replacement token options for different faction flavor options. I've included:
$lordOrLady, $LordOrLady, $lordOrLadyPlayer, $LordOrLadyPlayer, $priestOrPriestess, $PriestOrPriestess, $priestOrPriestessPlayer, $PriestOrPriestessPlayer, $SorcererOrSorceress, $sorcererOrSorceress, $SorcererOrSorceressPlayer, $sorcererOrSorceressPlayer
Example:
Syntax:
Spoiler
(https://i.imgur.com/wpiaoAt.png)
In-Game Dialogue showing all three options proccing:
Spoiler
(https://i.imgur.com/ztJIxCX.png)
(https://i.imgur.com/Lsn2uR7.png)
(https://i.imgur.com/v7PW4y4.png)
If the syntax looks a little blocky, keep in mind that using $NEWLINE to create a new paragraph is optional. A modder can use enter in the spreadsheet to make your own paragraphs and that should be preserved in the dialogue string.
However, modders must use -OR- to designate additional responses and the highlight syntax for any highlights, however.
Due to the way that I am assuming spreadsheet merges work, modders likely must also start their dialogue with -OR- to prevent the first additional dialogue option from being merged with the last dialogue option if the modder is adding dialogue to an existing faction such as independents or the hegemony.
If a modder is just adding dialogue for their own custom faction, beginning with -OR- will cause a runtime exception. I don't think there is any way around that unless I can think up something clever.
I also wanted to mention that if anyone has additional token requests they can place them in this thread.