
I'm looking for a guide/howto/tutorial regarding the basic concept behind NPC conversation topic/options/lines. What's the best practice to add new options and which parts need to be tied together? I know the language files for example - they use IDs to address lines of text, but when I write new text: what ID should I use? Is there something like a namespace for text IDs or will I just have to dream some up and hope they don't interfere with another mod?
Background/idea
I'd like to write a little mod that would let me expand my empire in a non-destructive/non-aggressive way by adding a conversation option to station managers where the player can ask to buy a station for credits.
When the manager gets asked for a price of his/her station the mod should go through the station modules, subordinates and stored wares and sum up/estimate the net worth of the station, then finalize by adding the current station budget (if applicable for NPC stations?). Maybe it's even possible to take local competition into account - a station that "struggles" with competing offers (determined by full storages and number of offers in the same sector) could be cheaper, while a well running business monopoly could be more expensive.
The next conversation options would be to either close or cancel the deal. "Buy" needs a condition "player.money gt station.price" and would trigger a cue that deducts the price and then changes ownership of all assets to the player.
Question
I usually look into existing mods and scripts to figure out how stuff is done. I should be able to find some do_for_each elements to learn and do the calculation and asset transitions this way - but when I look at mods that add conversation options, they come with so much other stuff that I'm having a hard time to isolate the things relevant to conversations. Further I've seen different approaches... like delays or other triggers or even mod dependencies that get lua scripts involved..?
In order to learn and understand the basics I'd like to keep it as simple as possible. Just the few routines:
1. Add conversation "X -> Y/Z" options to station managers only (need help)
2. Add "calculate price" cue (will figure out, but if by chance there's a standard method available already, please let me know)
3. Add "transfer ownership" cue (will figure out too).
Then offer conv opt X to ask for price -> trigger "calculate price" cue -> if (affordable) { add/enable option Y to buy -> trigger "transfer ownership" cue } -> add Z to cancel -> return to previous conversation node.
Feels pretty straight forward, but I'm not sure about the basic building blocks just for adding conversation options. Didn't find a tutorial dedicated to conversations... is there one? Or could someone give me a short overview on best practice and how it should be tied together?
That would be awesome
