Jump to content


Photo

Game crashes when I use 'EXTERN' !?


  • Please log in to reply
8 replies to this topic

#1 aVENGER

aVENGER
  • Modder
  • 1680 posts

Posted 16 October 2003 - 09:39 PM

Hi there. I'm doing some dialogue scripting and so far, I've successfully written, compiled and successfully tested about 400 lines of reasonably complex dialogue code (VENDURIS.D > 25kb and working flawlessly) so I'm not really a newbie at these things, yet somehow, I just can't get this function (EXTERN) to work properly.

To clarify, I have two NPC's here Venduris and Zaeron who are standing beside one other. Now, I just want Zaeron to make a small comment during Vend's dialogue with the Protagonist and then the focus should return to Vend. Now, since I couldn't get it to work in the main VENDURIS.D (and as mentioned above, that file is getting quite big) I have created two new sample dialogue files VEND.DLG and ZAERON.DLG and assigned them to theirs respective CRE's for testing. here's what they look like:

//VEND.D
BEGIN ~VEND~

IF ~NumTimesTalkedTo(0)~ THEN BEGIN 1
SAY ~This is a small example for testing EXTERN.~
IF ~~ THEN REPLY ~Let's do it!~ GOTO 2
IF ~~ THEN REPLY ~No, exit please.~ EXIT
END

IF ~~ THEN BEGIN 2
SAY ~Ok, now let's see if EXTERN works.~
IF ~~ THEN EXTERN ~ZAERON~ 1
END


IF ~~ THEN BEGIN 3
SAY ~Well it should be working now.~
IF ~~ THEN REPLY ~I hope so.~ EXIT
END

// ZAERON.D
BEGIN ~ZAERON~

IF ~True()~ THEN BEGIN 1
SAY ~Come on you dammed thing...work already!~
IF ~~ THEN EXTERN ~VEND~ 3
END

Then, I compile both files wish the standard:
weidu vend.d --tlkout dialog.tlk
weidu zaeron.d --tlkout dialog.tlk
and then I copy the newly created VEND.DLG and ZAERON.DLG to my BG2\override folder. Then I summon both creatures, first Zaeron then Vend. Then Vend initiates dialogue and after I chose option 1 and the 'Ok, now let's see if EXTERN works' dialogue shows up the game crashes with this message:

BGMAIN caused an invalid page fault in
module BGMAIN.EXE at 015f:004e77f3...etc.


*Sigh* I'm guessing that I'm doing something very basic very wrong here :blink: but according to the WeiDU documentation and some examples which I've seen that code should work ok!? Can someone explain this for me...

#2 Grim Squeaker

Grim Squeaker

    Fallen

  • Member
  • 1018 posts

Posted 17 October 2003 - 12:05 AM

I'm not convinced you need the bit that reads: IF ~True~ THEN BEGIN. You should just need IF ~~ THEN BEGIN as it isn't the start of a conversation.

If you are having problems with EXTERN then CHAINing can sometimes get you out of it (although not always).
"You alone can make my song take flight..."

#3 Rastor

Rastor

    Yes, I really am a dragon. Yes, I am a jerk. Live with it.

  • Member
  • 2001 posts

Posted 17 October 2003 - 03:45 AM

Agreed, a CHAIN is probably the best way to do this.

Remove that ~True()~ from the Zaeron dialogue. That's what's causing the problems.
Home of Kitanya, Improved Asylum, more...

Posted Image

#4 aVENGER

aVENGER
  • Modder
  • 1680 posts

Posted 17 October 2003 - 04:37 AM

Hmm, it's definitively not the True() trigger, as I've tried a few times without it as well. In fact, I've only included that to make SURE that the dialogue gets executed :lol: although it may be completely unnecessary. I'll try with CHAIN though.

#5 Kismet

Kismet

    Mild Thang

  • Member
  • 348 posts

Posted 17 October 2003 - 04:50 AM

You might want to check Zaeron's .cre file to see if there are any errors there (although what errors there would be that would cause a crash I couldn't tell you :) ). I would think that if there was anything wrong with your dialog file that WeiDU would catch it when it compiled rather than in game.

#6 aVENGER

aVENGER
  • Modder
  • 1680 posts

Posted 17 October 2003 - 06:08 AM

Damn, I really don't get this. :( Everything in the CRE and in the DLG's seams to be ok, but BG2 still crashes. I'd like to try CHAIN now but unfortunately, I can't seam to get its syntax right. WeiDU is definitely the best BG2 dialogue tool, but i's documentation can be really confusing at times. :blink:

Can someone please convert the simple dialogue which I presented above into CHAIN format and post the code for me? It would help me a lot if I cold just get to see a functional example of its use.

#7 Kismet

Kismet

    Mild Thang

  • Member
  • 348 posts

Posted 17 October 2003 - 06:51 AM

IF ~NumTimesTalkedTo(0)~ THEN VEND 1
SAY ~This is a small example for testing EXTERN.~
IF ~~ THEN REPLY ~Let's do it!~ GOTO 2
IF ~~ THEN REPLY ~No, exit please.~ EXIT
END

CHAIN
IF ~~ THEN VEND 2
~Ok, now let's see if EXTERN works.~
== Zaeron ~Come on you dammed thing...work already!~
== Vend ~Well it should be working now.~
END
IF ~~ THEN REPLY ~I hope so.~ EXIT

As an aside, you may not want to use just numbers as statelables. I hear things can get confusing if you do that. WeiDU will convert whatever string you use for a statelable into an integer when it compiles the dialog.

#8 -jcompton-

-jcompton-
  • Guest

Posted 17 October 2003 - 07:49 AM

I'll bet that the DLG is not properly assigned to Mr. Z. Check his CRE again.

#9 aVENGER

aVENGER
  • Modder
  • 1680 posts

Posted 17 October 2003 - 01:03 PM

@Kismet:

Thanks, that code (with a few modifications) worked, although I noticed that the DLG's compiled just like when I was using EXTERN !? Anyway, I got it to work...but only in one particular instance, but I think I'm slowly getting the hang of it. Still, I'll skip the multi-character interactions for now, until I understand this better.

@JC

Nope, I double checked that and both the DLGs and the Death Variables were in place. I think that the AI of the CREs might have interfered though, so I disabled it temporarily. Also, does it matter that they are marked as hostile (Allegiance = 255 - ENEMY) ? Anyway, as already said above, I've decided to drop the multi-interactions for now, and get back to them once I'm fully finished with the core dialogue.