User:JT
Bag of Tricks
Arbitrary Short Text in Dialogue
This was a little trick I hashed out a couple years back as part of my Interaction mod, although that mod is approaching dead at a rate that I figure I might as well just share the technique rather than letting it die entirely. It hinges on the fact that you can still use the ancient Morrowind/Oblivion-era %PCRace and %PCName text substitutions within the Fallout 3 dialogue system. You'll need a Quest object, two User Defined Functions to set the names, and one User Defined Function to reset everything afterward.
scriptname YourModQuestScript
string_var PCNameSave
string_var PCRaceNameSave
scriptname JTFxnSetPCNametoString
string_var newname
string_var savename
begin Function { newname }
let savename := Player.GetName
let yourModQuest.PCNameSave := savename
Player.SetNameEx "%z" newname
SetFunctionValue savename
return
end
scriptname JTFxnSetPCRaceNametoString
string_var newname
string_var savename
ref PCRace
begin Function { newname }
let PCRace := Player.GetRace
let savename := GetName PCRace
let yourModQuest.PCRaceNameSave := savename
SetNameEx "%z" newname PCRace
SetFunctionValue savename
return
end
scriptname JTFxnResetNameStrings
string_var newname
ref PCRace
begin Function { }
let PCRace := Player.GetRace
let newname := yourModQuest.PCRaceNameSave
SetNameEx "%z" newname PCRace
let newname := yourModQuest.PCNameSave
Player.SetNameEx "%z" newname
return
end
Next, in any dialogue entry where the NPC speaks, you can use the following call in the dialogue info's Begin Script:
Call JTFxnSetPCNameToString "Jennifer" Call JTFxnSetPCRaceNameToString "Garner"
...with a matching reset afterward in the info's End Script:
Call JTFxnResetNameStrings
...and then your info string would simply be something like:
Hi, I'm %PCName %PCRace!
The "End Script" reset happens immediately after the text is displayed, and yet the dialogue is not refreshed, so the strings still display. In this example, the actress will introduce herself properly and yet the player's name and race string will both remain at their defaults. Conceptually it's just storing the strings temporarily and isn't exactly pure brilliance, but it's such a handy little hack.
With this method, you could theoretically display up to 64 (62?) characters of dynamic text containing whatever string you want, consisting of two individual (31?-) 32-character portions. I'm not positive if the engine can handle longer strings than that and haven't tried. I originally wanted to use it just to let NPCs have a first and last name and to share that with the PC in dialogue (e.g., "Hi, I'm [my randomly generated first name] [my randomly generated last name]. Pleasure to meet you.") but it can also be used for other stuff.
Strangely enough, I seem to recall seeing something about NVSE (or JIP NVSE?) including the ability to alter the INFO text directly, obviating this method of mine, but can't for the life of me find it in any documentation anywhere.