Author Topic: WEIGHT Dialogues  (Read 4789 times)

Offline Dark Raven

  • Bloody Cynical
  • Planewalker
  • *****
  • Posts: 1194
  • Gender: Female
  • Flesh is the law
    • Chosen of Mystra
WEIGHT Dialogues
« on: July 02, 2004, 11:02:22 PM »
I just read JCs little tutorial on weighted dialogues so I thought I would bring up some questions about them. If I recall, I may be wrong, but the romance characters dialogues are done mostly by state weights where you have dialogues for Mazzy, Minsc, etc who mostly do not have weights.

Should I use them? I am working on Alora right now, Ginafae later, and I have been thinking about this. Should I use them in their J file for quests, or their B files for banters? Should I use a mixture of weighted dialogues or use all weighted dialogues? I am puzzled over this, it's a reason for my slow progress when it comes to writing dialogues.  :(
Per me si va nella citta dolente.
Per me si va nell eterno dolore.
Per me si va tra la perduta gente...
Lasciate ogni speranza perduta che'entrate!

Chosen of Mystra home to many mods.

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Re: WEIGHT Dialogues
« Reply #1 on: July 02, 2004, 11:08:25 PM »
When you're making NEW DLGs, do NOT use the WEIGHT command.

The single most common need and use for WEIGHT is when you need to put something at the top of the stack of an existing DLG so that some new Interact()/Dialogue() you introduce will pick up YOUR new dialogue as opposed to something already in-game. So in that case, WEIGHT #-1 will suffice.

Remember that if you don't specify WEIGHT, everything just goes to the bottom of the stack.

Occasions to use WEIGHT in the middle are somewhat rare... basically, you might wish to use them to introduce new banter with existing NPCs so that they are mingled in with the banter for the rest of the NPCs, rather than always occurring at the end.
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Offline Rastor

  • Planewalker
  • *****
  • Posts: 271
  • Author of the book, "Being a Jerk for Dummies"
    • RPG Dungeon
Re: WEIGHT Dialogues
« Reply #2 on: July 09, 2004, 08:22:16 PM »
When you're making NEW DLGs, do NOT use the WEIGHT command.

The single most common need and use for WEIGHT is when you need to put something at the top of the stack of an existing DLG so that some new Interact()/Dialogue() you introduce will pick up YOUR new dialogue as opposed to something already in-game. So in that case, WEIGHT #-1 will suffice.

Remember that if you don't specify WEIGHT, everything just goes to the bottom of the stack.

Occasions to use WEIGHT in the middle are somewhat rare... basically, you might wish to use them to introduce new banter with existing NPCs so that they are mingled in with the banter for the rest of the NPCs, rather than always occurring at the end.


I don't know.  I've intermingled banters with NPCs, starting with the Bioware NPCs, no Weights, and they actually fired before other, higher ones that evaluated to True().  I know that weighting does work in banters (as that's what Lovetalks use), so I'm wondering if it finds multiple dialogues that all evaluate to True and just randomizes...

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Re: WEIGHT Dialogues
« Reply #3 on: July 09, 2004, 09:44:43 PM »
I really assure you that that's not the case. There is probably an extra condition in a state trigger, like an AreaType or something like that, that you're overlooking.
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Offline Bookwyrme

  • Planewalker
  • *****
  • Posts: 183
Re: WEIGHT Dialogues
« Reply #4 on: August 28, 2007, 03:43:13 PM »
To resurrect an old, old topic to make sure I understand this fully:

Is it correct to assume that, if I have a bunch of banters & I don't really care when they fire, I might want to weight a few of the ones initiated by the Bio NPC's to keep them from firing dead last, but it doesn't matter which?  Is it only banters started by Bio NPC's that need the Weighting to push them up or will banters started by the mod NPC with the Bio NPC also go to the end of the line?

Also, I recently had a lot of trouble getting a banter to fire at rest, until I weighted it.  Other NPC banters were firing first, even if they were not originally intended to be at rest.  So--should I make sure to weight all such banters?
Stop by my blog over at Bookwyrme's Lair, my collection of reviews, pictures, and general ramblings. I also review comics and books over at FanboyNation.

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Re: WEIGHT Dialogues
« Reply #5 on: August 28, 2007, 04:18:02 PM »
Is it correct to assume that, if I have a bunch of banters & I don't really care when they fire, I might want to weight a few of the ones initiated by the Bio NPC's to keep them from firing dead last, but it doesn't matter which?

Are we talking about banters between a Bio NPC and your new mod NPC?

Quote
Is it only banters started by Bio NPC's that need the Weighting to push them up or will banters started by the mod NPC with the Bio NPC also go to the end of the line?

Unless you explicitly give a WEIGHT, any new state trigger ("top-level") always goes to the end of the line--or specifically, "whatever the end of the line was at the time the dialogue was compiled."

The upshot is, unless you weight a new Bio-initiated banter somewhat higher in the stack (but always below any lovetalks!), then the Bio NPCs will always exhaust all of their banters with each other before considering yours.

As a flawed example, let's say you're giving Bruce some banter with Jaheira.

Jaheira has, in her B file, talks in the following sequence:

lovetalks
Minsc banter
Anomen banter

If you do not specify a higher weight, the list will be this:

lovetalks
Minsc
Anomen
Bruce

Meaning that if Minsc, Anomen, and Bruce are all in the party with her, Jaheira will always choose to start her banter with Minsc, then with Anomen, and then only
after those have been done
will she get to Bruce.

So one strategy is to pick the weight between Minsc and Anomen. She'll still always talk to Minsc first (if he's in the party) but Bruce won't have to wait until she finishes with Anomen before he gets some attention.

Quote
Also, I recently had a lot of trouble getting a banter to fire at rest, until I weighted it.  Other NPC banters were firing first, even if they were not originally intended to be at rest.  So--should I make sure to weight all such banters?

I would say "yes, absolutely."

General system for a rest talk:

Dreamscript says "Is it time to do this talk? (We're in the right area, we're in the right chapter, we have the festhall amulet, blah blah) If so, let's set someflag to 1 and call a dialogue command."

Your .d file is
APPEND WHATEVER
IF WEIGHT #-1 ~Global("someflag","GLOBAL",1) BEGIN ourtalk
SAY ~something~
DO ~SetGlobal("someflag","GLOBAL",2)
etc.

That way, your rest-talk is at the top of the stack and no pesky banters or whatever will get in its way, but it's also in no danger of running "accidentally" because it's waiting for your dreamscript to set the flag to 1.
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Re: WEIGHT Dialogues
« Reply #6 on: August 28, 2007, 04:21:11 PM »
That way, your rest-talk is at the top of the stack and no pesky banters or whatever will get in its way

Although there is always the possibility that another dreamscript event will get in the way. Once people learned how to do that stuff it became fairly popular, but the original game was more or less counting on all the dreamscript events safely happening without any competition. So if you and me and Kulyok and Godspawn all put a dreamscript event on Jaheira, it might not run when we really expected it to, but as long as you properly protect the top-level with a unique flag, you won't get "one event starting another event's dialogue."
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Offline Bookwyrme

  • Planewalker
  • *****
  • Posts: 183
Re: WEIGHT Dialogues
« Reply #7 on: August 31, 2007, 04:39:17 PM »
Thanks.

Just to make sure I understand:

A Mod-NPC initiated banter will *not* necessarily fire last, it will be selected the same way Bio NPC banters are, and will be mixed up with all the rest.

A Bioware initiated banter with a mod NPC will fire last in the Bioware NPC's list of banters unless it is weighted.

This bit I'm not sure of:

Quote
If you do not specify a higher weight, the list will be this:

lovetalks
Minsc
Anomen
Bruce

Meaning that if Minsc, Anomen, and Bruce are all in the party with her, Jaheira will always choose to start her banter with Minsc, then with Anomen, and then only
after those have been done will she get to Bruce.

So one strategy is to pick the weight between Minsc and Anomen. She'll still always talk to Minsc first (if he's in the party) but Bruce won't have to wait until she finishes with Anomen before he gets some attention.

Does this mean Bio NPC banters have weights?? How would I set a banter weight somewhere in between? 

Do mods ever use weights below -1, then? In that case how are they chosen?



Stop by my blog over at Bookwyrme's Lair, my collection of reviews, pictures, and general ramblings. I also review comics and books over at FanboyNation.

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Re: WEIGHT Dialogues
« Reply #8 on: August 31, 2007, 05:42:35 PM »
A Mod-NPC initiated banter will *not* necessarily fire last, it will be selected the same way Bio NPC banters are, and will be mixed up with all the rest.

I would word this rule as:

Mod-NPC initiated banter (or mod-introduced BioNPC banter) is selected the same way all banter is--according to weight.

Quote
A Bioware initiated banter with a mod NPC will fire last in the Bioware NPC's list of banters unless it is weighted.

Yes, that's correct.

Quote
Does this mean Bio NPC banters have weights??

Yes, absolutely. Weight wasn't truly understood until we noticed back in the day that early WeiDU NPC mods (Solaufein and Kelsey) were causing Anomen's romance to work incorrectly, because the early versions of WeiDU were ignoring Bioware's custom weighting. That's why you see WEIGHT notation when you decompile a stock BANOMEN.DLG, or why the states appear to be in different order if you look at the list of State Triggers in NI but look at the raw top-levels in InfExp.

Quote
Do mods ever use weights below -1, then? In that case how are they chosen?

You'll never see a weight less than 0 in a finished DLG because the entire list gets shoved down any time a new state with a specific weight is introduced. This is easier to see for yourself than to explain. Look at the State Trigger list in the Edit tab of Near Infinity's DLG browser (it'll be way down at the bottom), and then look at it again after compiling in a mod that uses a negative weight. It just bumps the whole list down and makes the negative weighted item the new zero.
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Offline Bookwyrme

  • Planewalker
  • *****
  • Posts: 183
Re: WEIGHT Dialogues
« Reply #9 on: August 31, 2007, 07:22:11 PM »
A Mod-NPC initiated banter will *not* necessarily fire last, it will be selected the same way Bio NPC banters are, and will be mixed up with all the rest.

I would word this rule as:

Mod-NPC initiated banter (or mod-introduced BioNPC banter) is selected the same way all banter is--according to weight.
[/quote]

Does the game assign them weights according to order, then, if the modder has not assigned them?
Stop by my blog over at Bookwyrme's Lair, my collection of reviews, pictures, and general ramblings. I also review comics and books over at FanboyNation.

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Re: WEIGHT Dialogues
« Reply #10 on: August 31, 2007, 08:41:30 PM »
Does the game assign them weights according to order, then, if the modder has not assigned them?

Yes.

Specifically, they will just occur in the order they appear in your .d file. Anything new you APPEND in later will just go to the bottom.
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Re: WEIGHT Dialogues
« Reply #11 on: September 16, 2007, 10:48:13 AM »
To follow up on this, in some of the oldest community code I receive this errer in the .DEBUG:

Code: [Select]
[_BMONTA.DLG] loaded
WARNING: REPLACE specifies no WEIGHT for state 8 and DLG uses non-trivial weights.  Using weight from DLG (1). [3]
WARNING: REPLACE specifies no WEIGHT for state 9 and DLG uses non-trivial weights.  Using weight from DLG (2). [2]
WARNING: REPLACE specifies no WEIGHT for state 10 and DLG uses non-trivial weights.  Using weight from DLG (3). [1]


The code which causes the problems is
Code: [Select]
REPLACE ~%VICONIA_BANTER%~
IF ~~ THEN BEGIN %BGTViconiaState575% // from:
SAY @0
IF ~~ THEN EXIT
END
END

REPLACE ~%VICONIA_BANTER%~
IF ~~ THEN BEGIN %BGTViconiaState583% // from:
SAY @1
IF ~~ THEN EXIT
END
END

REPLACE ~%VICONIA_BANTER%~
IF ~~ THEN BEGIN %BGTViconiaState584% // from:
SAY @2
IF ~~ THEN EXIT
END
END

REPLACE ~%VICONIA_BANTER%~
IF ~~ THEN BEGIN %BGTViconiaState585% // from:
SAY @3
IF ~~ THEN EXIT
END
END

REPLACE ~%KIVAN_BANTER%~
IF ~~ THEN BEGIN 4 // from:
SAY @4
IF ~~ THEN EXIT
END
END

I understand that the error is generated because a coder has put in a REPLACE command without specifying a weight (SET_WEIGHT or more modern constructions where the IF WEIGHT #-1 is used).

Most of all, when I find it, the current dialogue weighting is exactly what we want; from this message, does that mean when I find the darned thing I need to crosscheck what *has become* state 8 in _BMONTA and use SET_WEIGHT #3, what *has become* state 9 in _BMONTA  and use SET_WEIGHT #2, etc?
« Last Edit: September 16, 2007, 10:51:31 AM by cmorgan »

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: