Jump to content

BG2 general modding questions


Recommended Posts

So! I decided that I had the greatest idea for a BG2 character mod, and that I absolutely had to go about creating it even though I have absolutely no idea how to mod. Oh well, they say you never learn if you don't try.

With that in mind (yes I'm still doing it, I'm working on the dialogue bits now) I need to few choice pieces of advice while I'm still in the beginning stages:


Is there any specific way to write out the dialogue before I code it, or is the goal really just to make sure that I know what's going on?

Is there any place that I can get some really specific, pretend-I-don't-know- anything-about-coding suggestions, so I can kinda get familiar with process before it looms over me?

....anyone wanna just, you know, go ahead and do the coding for me? (No, no, I'm kidding. No I'm not.)


And any other basic suggestions anyone can give me. I will be forever in everyone's debt.

Link to comment

I'm pretty much in the same boat. My advice is don't think about everything at once (or you'll never start :) ) take it a step at a time. Ask lots of questions and read the articles in the 'How-To' forum.


I'm keeping notes as I play though BG1 again, jotting down ideas. Then I can go back and write the dialogues.

Link to comment

Actually, you can't possibly know how much you've helped me just now. I didn't even realize that there was a modding 'how-to' forum (how sad is that!) which has the lovely, spiffy, how to code for code-dummies section I was looking for. Of course, if anyone else has any general advice, I absolutely *love* general advice (like barbeque potato chips, but more) and if anyone can let me know if there is a 'best' way to write out the dialogue when it's still being fleshed out, or if my goal should really just be to make sure that I understand what's being said when.

(also, my apologies if I posted this question in the wrong forum, as I didn't even notice the 'modding how-to' forum before).

Link to comment

my advice on how to write out dialogues would be the following.


There are 2 basic structures (CHAIN and SAY-APPEND) and one substructure (ICT), so you might want to adjust your writing to the cases when each of them is most commonly used.


1) when the dialogue only involves npcs (ie no player character) use this form:


Dialogue between Anomen and Aerie, with optional participation from Cernd:


AM: what anomen saying.~

AE: what Aerie is saying.~

CE: IF ~InParty("Cernd") !Dead("Cernd")~ THEN ~What Cernd is saing.~



when written that way, and if you keep naming for each character consistent, simple replace action in ConTEXT + addition of the "header" + a quick search for all the optionals will convert all your dialogues in D format.


2) When it is an interjection in the existing game dialogue.


You know, for the effort involved you might as well see I_C_T or I_C_T2 syntaxis right away.


If NOT, I suggest that you do the following:

-extract the parent file (where you interject), for example BAERI.DLG to D form.

-Find the line after which you interject

-write you text accompanied by the following information: name of the file. State # after which interjection will go (State number is the line number, basically), like this:


//In file BAERIE 0 PrefixMyCHaracterNameAerie0

YC: Something that your character says.~



3) If the dialogue is an NPC-PC dialogue, ie with the Player 1 participation, I suggest that you check out tutorials on D-structure and write dialogues directly into D tree format (APPEND/SAY structure), it will not only save you loads of time but also you will have less repeats and loops in your dialogues.


I think that Road to Banter and How to Make a Simple NPCs touch upon basic tree format, and if you don't mond poorely formatted tutorials, I have the "Tips and Tricks on Creating D files" somewhere in Tutorials section here.



Link to comment

Success! Okay, so it's a minor success, but I'm amused by little things. Using the steps in coding for beginners, I managed to create a little introductory version of Atryn (my NPC) and got him in the game with 2 or 3 WHOLE dialogs. Again, small, but it's more coding than I've ever done.

Now that I've practiced with the programs and such I'm beginning to see how the language works and what I need to do to code this all out--perhaps not completely, but enough that I at least know where to go if I run into problems. However, I still have a problem I can't puzzle out, and so I'm going to ask it here and hope that someone can help. Please be forewarned, this is going to be an incredibly long post, so all appropriate apologies ahead of time.


I want to create a NPC, Atryn, that is first introduced during the small conversation the PC has with Cohrvale. I want for Atryn to only show up if the PC is female or if the party contains a female character. Cohrvale's line is "Out of my way, you there!" at which point I want to have Atryn arrive and say this:


Atryn: Cowering dog! How dare you address the lady in such a manner! I should challenge you merely for that slight against her!


The PC or any other female in the party would get a chance to respond:


PC (female): Oh! My hero! (a)


I… I thank you for your worry good sir, but I’m sure I can handle the insult myself (b)


Sod off, ye git! ©


Aerie: Th-thank you! (a)

Nalia: It’s so strange to find such gentlemanly behaviour from such a stranger. I’m sure that I can handle myself, but I know Auntie would approve. (b)

Viconia: I should challenge you, for the unpardonable insult of thinking that anyone would need your help. No, no, please challenge him. If I’m lucky, you’ll manage to kill each other. ©

Jaheira: Hmph. (b)

Mazzy: I do thank you for the kind words, but I think it would be better if we attacked him together. (b)


Obviously, if the PC is female I don't want any of the other women to respond. From there I have a list of responses that Atryn can give, (which correspond to the letters at the end of each response) where he will either be automatically attacked by Cohrvale (a) or allow the conversation to continue as it would have normally(b and c). After this battle/conversation is over, then Atryn will talk to the PC in the normal "Please let me join you" manner. While I have been given advice on how to do interjections, I don't know exactly how I'm going to employ it in this case, since it is the first time Atryn is introduced, and I feel a bit stuck since I have a hard time moving on if I can't get the first dialogue done. I know the code for Cohrvale's line (COHRVALE phrase 0) and I have my code for Atryn (A#Atryn) but I don't know how to proceed from there. I'd like to point out that I have some idea of how to go about my other dialogues with him (mainly romance based) but this has thrown me.

So what should I do, how do I start it off? Or, should I scrap this bit and just do a generic introduction, since it's so beyond my abilities. (I'd hate to, I'm really attached to it.) I kinda hate to be that pestering person, but...

Link to comment

What you want is to direct the dialogue into the conditional chain.


One way to handle is is the code below.




You have to account for a case when a girl in the party is NOT Aerie, Nalia, Mazzy etc, for example one of the modded NPCs or a custom NPC player created. Hence the lines of code when PC is MALE, but not a single girl who has a remark is present. It will require another responce(s).


The D file is read by the game from BOTTOM up (scripts are read from TOP down), so if you want the girls to "steal" the conversation away in the order of priority that you have listed, you have to a) make sure that your PC replies carry 'negating' conditions (ie only show up when none of the girls are in the party or the girls are dead, and that b) you add girls' EXTERNs to move the conversation over to girl's banter files from Atrin's in the reversed priority order (ie if you want Aerie to be the one who continues conversation even if other girls are in the party, Aerie's EXTERN will be the last).


Also note that I move from you a-b-c scheme to a conversation specific naming of the tags (ie A#AtrinInfo.a etc) because each tag within the same D file has to be unique. I generally use numbers instead of letters though, in case your # of states goes over 28.




IF ~NumOfTimesTalkedTo(0)~ THEN BEGIN A#AtrinIntro0

SAY ~Cowering dog! How dare you address the lady in such a manner! I should challenge you merely for that slight against her!~

+ ~Gender(Player1,FEMALE)~ + ~Oh! My hero!~ GOTO A#Intro.a

+ ~Gender(Player1,FEMALE)~ + ~I… I thank you for your worry good sir, but I’m sure I can handle the insult myself!~ GOTO A#Intro.b

+ ~Gender(Player1,FEMALE)~ + ~Sod off, ye git!~ GOTO A#Intro.c

+ ~Gender(Player1,MALE)

OR(2) !InParty("Aerie") Dead("Aerie")

OR(2) !InParty("Nalia") Dead ("Nalia")


etc for all 5 girls

~ + ~Sod off, ye git!~ GOTO A#Intro.d


Same code for other 3 girls, in the reverse order of priority


IF ~Gender(Player1,MALE) InParty("Nalia") !Dead("Nalia")~ THEN EXTERN A#Intro.ChainNalia

IF ~Gender(Player1,MALE) InParty("Aerie") !Dead("Aerie")~ THEN EXTERN A#Intro.ChainAerie



CHAIN BAERIE A#Intro.ChainAerie

~Th-thank you!~



It's actually much easier than creating the translation file afterwards.


Not with a batch file - 1 line of code converts all your D files into tra. Purrfect. Unless you mean something other than working with two files, where you manually number the lines. Plus, while CHAIN is no biggie in TRA, I am not sure I can keep the whole 20+ state NPC-PC dialogue in my head, when I want to reffer to what answer goes to what question.

Link to comment

Domi, you are an angel.

A couple of questions--using the script you've given me, will I then make his next conversation (the one where he asks if he can join the party) in the IF ~NumOfTimesTalkedToGT(0)~ THEN BEGIN... format?


You pointed out that each tag has to be different within a D file, so that means that after one dialog's finished, I need to continue to change the tags in the next one, right? (A#Intro.a, A#Intro.b, A#Intro.c, regardless of whether they're in the same dialog or not, as long as they're in the same D file).


And finally, I don't have to start a new D file for every conversation, right?

Link to comment

From the bottom up:


1) No, you don't need a new D file for every conversation, what you will however need to do is:


2) Change the tag identifier for each dialogue, so no two tags were the same on D (otherwise when WeiDU compiles you will get a compilation error). So for example, if I do a sequence of Friendship talks for a character named Jaemal, I use the P#JaFT1 to identify for myself that I work on: P# (my personal preffix), Ja - first two letters of character's name; FT - identify that talk is from a regular friendship sequence; 1 - the talk number and then I'll number the options, so the final tags will be: P#JaFT1.1, P#JaFT1.2 etc. and for the second talk P#JaFT2.1. P#JaFT2.2 etc


Divide the D files any way you want, but try to put all your dialogues in such way that the dialogues with 'open' conditions - ie UNSCRIPTED banters between NPCs after SCRIPTED banters or talks with the PC. Where SCRIPTED means that the dialogue is specifically triggered from script, not from the banter engine. That's if all your dialogue go on B-file. Another way to avoid it is to put all UNSCRIPTED stuff on B file, and all SCRIPTED stuff on J file.


Failure to maintain the proper order between SCRIPTED and UNSCRIPTED banters will result in UNSCRIPTED banters showing up instead of scripted, ie your character will banter with Aerie instead of sweet-talking the PC, but the game will think that he had talked to PC, because variables did get changed.



A couple of questions--using the script you've given me, will I then make his next conversation (the one where he asks if he can join the party) in the IF ~NumOfTimesTalkedToGT(0)~ THEN BEGIN... format?


Again, I recommend "Road to Banter", "How to Create a Simple NPC", "How to Create an NPC if you're a Noob" or my good old "Tips and Tricks on Creating D-files", it has a bunch of examples (



), etc, but generally speaking


There are 2 formats.


APPEND-SAY (what you called NumOfTimesTalkedToGT())






BOTH of this formats can be used with a condition, they will just have a different header to handle the condition.


The way you make a decision whether to use APPEND-SAY or CHAIN depends on who participates in the conversation, and what's easier to you to handle (for example I routinelly use CHAINs simply because I am too lasy to use APPENDs for one liners after PC dialogue). CHAIN is simply the easy way of coding what APPEND/SAY will handle via EXTERN command (and was created by Wes Weimer on JC's request specifically to handle NPC-NPC banter more easily), ie





~Global("SomeGlobal","GLOBAL",1)~ THEN BEGIN AerieBanter

SAY ~I am Aerie.~

IF ~~ THEN DO ~SetGlobal("SomeGlobal","GLOBAL",2)~ EXTERN BANOMEN AerieBanter1







IF ~~ AerieBanter1

SAY ~I am Anomen.~





is equivalent to:



IF WEIGHT #900 ~Global("SomeGlobal","GLOBAL",1)~ THEN BAERIE AerieBanter

~I am Aerie.~

DO ~SetGlobal("SomeGlobal","GLOBAL",2)~

== BANOMEN ~I am Anomen.~



CHAIN can also take on PC's replies (I have a fond flash-back to the time when JC taught me that trick). Again, please see the Tips and Tricks on Creating D-files.

Link to comment


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

  • Create New...