This make this easier for everyone! (Click for video)
For those of you that didn't go "Did that years ago", there's a link at the end to all the files you'll need to set this up in your own campaign, including a test mission!
Here's how it works. The LUA script included just does the complicated stuff. It'll do all the hud gauge appearing and all the mouse stuff. It also has a function that FRED can take the line number that the player has just clicked. If you're fine with the included files, then you don't need to touch the lua script at all.
On the FRED side, you need to call different functions to activate certain parts of the script, set the custom gauge lines to whatever you like, and the mission logic to properly use everything together.
Custom HUD Gauges:You can use set-hud-text or set-hud-message to have these gauges display text. The LUA script will take care of making them visible/invisible.
PromptBox - Use this to pose your choice to the player
PromptBoxOpt1PromptBoxOpt2PromptBoxOpt3 - Use these to let the player choose a response
PromptBoxOpt4PromptBoxOpt5LUA Script Functions to use in FRED:Use these with script-eval:proBoxInit() - Initialize the Prompt Box system. This is called on every gameplay start, so it shouldn't be required unless you need to reset everything for some reason.
proBoxAllowPause() - Will "pause" the game when the PromptBox is active. Actually this just slows the game down to 1% time compression, but it should give you plenty of time still.
proBoxDisallowPause() - Undoes the above
proBoxOn() - Forces the PromptBox to be on. If proBoxAllowPause() was called before, it will "pause" the game. This will also sort of steal your mouse focus. This is a lot more noticable when you do not have the pause option on.
proBoxOff() - Forces the PromptBox to be off. This will restore time compression and any other settings.
proBoxModeFree() - Puts PromptBox into free mode, where the player can call or dismiss the PromptBox with 'Alt-C' (Super note, this is NOT bindable, LUA doesn't care what is or isn't bound)
proBoxModeLock() - Undoes the above. This can be handy to temporarily lock out the player from bringing up the interface while you have a long talk session going.
proBoxSet(integer) - Sets the Prompt Box settings. The integer you put in between the brackets will be number of options that will be available to click. Inputting 1 through 5 will allow clicking on 1-5 lines. The lines are activated from the top going down. So proBoxSet(3) will make the top three lines clickable. An input of 0 will obviously not allow any clicking. An input of -1 is a shortcut, it will clear all the lines of text and reset time compression to normal. This is mostly used internally, though if you want to use it, go ahead.
proBoxLock(integer) - Allows you to lock a specific line (line
integer). Stops it from being clickable, even if it would be allowed.
proBoxClear() - A shortcut that just clears all the text on the lines.
Use these with script-eval-num:(These return values, to be used with arithmetic operators like '=')
proBoxValue() - Returns a value from 0 to 5. 1 through 5 if an allowable line has been clicked, 0 when nothing special has happened.
proBoxInFreeMode() - Returns 1 if you are in Free Mode, 0 if you are not.
Boy! That sounds like a LOT of work...
It's not really. Most of those functions are for the insane FREDders that want to pull off a free environment so they can talk to anyone at all.
If you want to use it in the most simple ways, just look in the included mission. From "CHOICE 1 - Choose Sidekick" to "Continuing On" is all you need to ask the player to make a simple choice.
If you want to use it in the most complicated ways... well... you can look in the mission and try to decipher what I did.
Basically what you want to keep in mind is "how can I make sure there is only one path to every response." You can do this through variables (to check who we are talking to), bit-wise operations (to check what options we've chosen before) and invisible mostly-unused stats like simulated hits (its a great ship-specific variable!). Another thing is to completely avoid using is-event-trues and chains in your repeating events. Beyond that... it's... kind of complicated. If you've got any specific questions on why I did certain things, I can certainly try to explain.
DOWNLOAD: http://lazymodders.fsmods.net/files/promptBox_V103.rar