Posted by: jcompton
« on: July 02, 2004, 10:38:26 PM »
I've been trying to think of an easier way to explain weighting and the mechanics of the BG2 DLG engine. This is the result.
Okay. Imagine that you had a shopping list, and you sent your husband to the store to fulfill it.
But imagine that your husband was absent-minded/an idiot, and would simply read the list from top to bottom, buy the first thing he found, and come home.
That is how the BG2 dialogue engine works. When you say "Game, run me a dialogue from this file" the game evaluates the state triggers (which look like IF ~InParty("Jaheira")~ or IF ~Dead("Imoen2")~ or IF ~Global("HadThisDialogueAlready","GLOBAL",0)~) and the first one it sees that is true, it selects.
Normally, it looks at a DLG from top to bottom: that is, as you would see the state triggers from the top of the list to the bottom of the list if you were to open the DLG in Infinity Explorer or open the .d from WeiDU or so forth.
What WEIGHT lets you do, however, is say "No, wait. See the fifth item on the list, honey? That's the MOST IMPORTANT item, so look for that one FIRST. Yes, I KNOW it's not at the top of the list, but look at the weight numbers next to it instead of top-to-bottom, okay?"
So a low WEIGHT number (0) gets higher priority than a high weight number (100).
So if you're making a new conversation for an existing DLG (adding an item to an old shopping list) and you wanted to make sure it got PRIORITY, you would WEIGHT it with -1. That says "Honey, yes, I know this item is at the bottom of the list, but it's -1, see, it's the MOST IMPORTANT, so if you buy just ONE THING at the store--and I know you will--make it THAT, if they have it."