Jump to content


Photo

Missing something very, very simple here...


  • Please log in to reply
3 replies to this topic

#1 Drathen

Drathen
  • Member
  • 4 posts

Posted 16 November 2002 - 03:29 AM

So after toying around with dialog and NPCs a little, I was curious how BGII pulls off the "commoner" types (NPCs who just say little tidbits if YOU walk up and speak to them).

So I dug into the area files, and found absolutely no dialog references in a ton of NPCs who do in fact say things.

I'm wondering, how do you get an NPC to use its dialog when the PC walks up and speaks to them, rather than them activating dialogue via script?

#2 weimer

weimer
  • Member
  • 1569 posts

Posted 16 November 2002 - 07:46 PM

The DLG resource field in the CRE file tells the game what DLG file to use when you (the PC) initiates a dialogue with that CRE.

Take, for example, MTOWN1.CRE (Peasant) which at offset 0x2cc (the dialogue resource field) has "mtown1".dlg. If you look at mtown1.dlg you'll see things like:

IF WEIGHT #2 /* Triggers after states #: 3 even though they appear after this state */
~RandomNum(6,2)~ THEN BEGIN 1 // from:
 SAY #13756 /* ~Don't be goin' into the slums, now, I warn ye.  If ye look like ye can rub more'n two coppers together, ye'll be jumped in no time!~ */
 IF ~~ THEN EXIT
END


Does that answer your question?

#3 Drathen

Drathen
  • Member
  • 4 posts

Posted 16 November 2002 - 11:12 PM

No, not really.

How do you get an NPC to initiate dialogue only when the PC walks right up them and talks to them, rather than starting dialogue from a distance, or walking up to the PC to start dialogue?

I might be missing some really simple scripting function.

#4 weimer

weimer
  • Member
  • 1569 posts

Posted 17 November 2002 - 08:01 AM

Oh, I see what you are saying. This should work:

IF
Range([PC],10)
Global("Talk","LOCALS",0)
THEN
RESPONSE #100
SetGlobal("Talk","LOCALS",1)
StartDialogueNoSet([PC])
END