Jump to content

WEIGHT bit


jcompton

Recommended Posts

As requested some time ago...

 

 

Initiating DLGs and the state trigger list (aka "state weighting")

 

There is often misunderstanding about how the Infinity Engine initiates dialogue, particularly when multiple states in a dialogue could evaluate as true. The process is in fact quite simple. The engine begins evaluating triggers in the state trigger list and selects the first trigger which evaluates true, and plays the associated state.

 

A more thorough explanation follows:

 

When the Infinity Engine calls a DLG, whether via scripting command such as Dialogue() or Interact() or through an internal action (such as BG2's banter system, which is essentially an Interact() call), the engine scans the specified DLG for a valid state trigger (one which evaluates true) and then plays the dialogue state tied to that state trigger.

 

Crucial to understanding how DLG works is understanding that the order of dialogue states and the order of dialogue state triggers do NOT have to be identical. The DLG format allows state triggers to be sorted independently of the states themselves.

 

Let three states of dialogue in a DLG file be labeled 0, 1, and 2. Let their respective state triggers be labeled A, B, and C, respectively.

 

State State Trigger

0 A

1 B

2 C

 

 

By default, most DLG creation tools, including Bioware's own internal development tools, will sort state triggers in the same order as the states they belong to. However, state triggers may be sorted in any custom order. Therefore, our DLG could have a state trigger list of the following:

 

State Trigger List

B

C

A

 

In a DLG with this state trigger list, when Dialogue() is called, the engine will first evaluate trigger B. If B is true, then state 1 will be played. If it is false, the engine moves on to trigger C. If C is true, then state 2 will be played. If it is false, the engine moves on to evaluate trigger A. If trigger A is true, then state 0 is played. If neither B nor C nor A are true, the engine will return a "nothing to say to you" or similar result.

 

In IE development parlance, the first state trigger to be evaluated is often called "top-weighted," "highest-weighted", or "zero-weighted." In the example, state 1 has the highest weight because trigger B is at the top of the state trigger list.

 

Further Reading: WeiDU Readme http://www.weidu.org/WeiDU/README-WeiDU.html#htoc13

WEIGHT tutorial: http://forums.pocketplane.net/index.php?topic=98.0

Link to comment

I'd like to add that the State Trigger list is scanned from the top down. This was inferred (in IESDP too) but not explicitly stated, and goes a long way towards understanding how the whole thing works. Furthermore, if I remember correctly, the Transition Trigger list is scanned from the bottom up.

 

For the tech types, weights are nothing but skewed offsets; Bioware's method of tweaking existing files. (Probably to avoid having to update all the inter-DLG links they'd created, as they wouldn't have had to do this otherwise.)

Link to comment

I lost my local save, and I couldn't find it in the archive forum.

I was meaning to PM you about it sometime, but I guess I never got around to it.

 

EDIT: The links section could do with more than a retouch. I'll consider doing something awesomic with it.

Link to comment
Confirmed, yes.

 

State triggers: Top to bottom

 

Transition triggers: Bottom to top

There is even more clarification in addition to the bottom to top scanning of transition triggers:

 

Triggers that result in 'continue' button displayed hold precedence over anything.

In other words, the lowest 'continue' transition has the largest precedence.

It even supresses any other transitions.

'End dialog' transitions are not so special, they could be mixed with normal transitions,

but only the lowest (last) will be connected to the 'end dialog' button.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...