Inserting Lua into DLL Dialogue Lines

Harkodos

Warlord
Joined
Feb 9, 2016
Messages
195
Hi, I wanted to know if it was possible to insert a line defined in Lua into a line defined in the DLL. This question specifically pertains to Dialogue.

So for example, when you come to talk to a Leader, normally they'd say something like:
"Ah, it is you. Welcome."

Instead what I want is to be able to insert the name of the Leader that the Player has chosen into the line so that the leader will accurately address the Player like so:
"Ah Washington, it is you. Welcome."

Is this possible to achieve without using the Unique Diplomacy Utilities to brute-force it, or is this merely a pipe dream? (writing 40+ of the same line just with the name changed is what I mean by "brute-forcing" it).
 
Parameter substitution into text strings is supported via {@1} etc, so your text string would be "Ah {@1_LeaderName}, it is you. Welcome." (The _LeaderName bit is just there so you can remember what's in param 1).
BUT, this assumes that the call in the DLL to display the text string passes the required parameters, and it almost certainly doesn't.
SO, you'd need to find where that string is generated from within the DLL and mod it to pass the required parameter(s).

Suddenly, brute-forcing 40+ of the same line seems less work!
 
40+ of the same line...for every line that involves a greeting/beratement/declaration of war/whatnot...(more like 400~4000+ lines! :cry: Waaaa!).

Well, that's what I thought. I'm not going to be touching the DLL at any point in my modding career, so this idea is as good as dead.

Thanks anyway, though.
 
Can you make a set of text templates with placeholders for leader_name, civ_type, etc and then use search and replace (possibly even scripted) to make 40+ specific copies of it?
 
Yeah, I could do that. There would be some variation between male/female leaders, but definitely doable.

I just wanted to know if it was possible to plug in a name/term Lua to expedite the process. I orginally had the idea because I found lines used in the Civilopedia where they'd plug in a term like "{TXT_KEY_YIELD_TYPE}" into another XML line, rather than type it out again and again for each line. I wanted to try experimenting with that to see if it would work. So I'd define a line as: "TXT_KEY_RECOGNIZE_LEADER_NAME", write an Lua script to determine the name based on the leader the player was playing as and then use the "{}" to plug that in, but it never worked, which is why I came to to see if there was something I missed. I really wanted that method to work, because then I could just define the name the AI would refer to the player as and plug that in, and voila.

The other method does get the job done, but I was hoping to use this method as I'm working on alot of "base" mods right now. Having a function that can serve a universal purpose for many mods down the line would've been fantastic; instead this just means having to define such lines seprataely for each mod, which means a lot more work overall.

A shame, but such is the life of a non-DLL modder.
 
Top Bottom