Jump to content

BG1 coding tutorial


Recommended Posts

My newest experience:

 

CHAIN, followed by reply options, does only work properly if the last speaker (dlg) is the same as the first one. Otherwise, the reply options will show after the first line in combination with a "continue" button. If the CONTINUE is clicked on, the interjections show, but the reply options are shown in every line, too.

Link to comment
I used DestroyItem() in the dplayer3.bcs and it was not processed. Everything else in that script block was (creation of a cre and journal entry). I changed the code now so a dialogue pops up (which is better for my purpose) so I would have to recode to check but I did it because the item destruction didn't work in several tries. (Item was in the inventory etc. pp)
Hmm, guess I will have to retest in BG1, but plainab did that pretty extensively for Xvart Caverns and I'm pretty sure he'd've reported it if it wasn't working. Gads know I fixed umpzehn other bugs on account of his reports.
Link to comment

The tutorial needs to be updated concerning variable handling / storage:

 

LOCALS do not get stored in the save game, i.e. will be gone upon reload.

GLOBAL are limited to 1024 for BG(TotSC) and 512 for plain BG. This leads to serious difficulties to finish a modded game. For this, the BG1 engine FIX - extending limit of maximum GLOBAL variables alters the exe to increase the amount of GLOBAL variables to 4096.

 

Thank you again, Zed for your work and Lava for pointing this out to me!

Link to comment

More CHAIN woes in BG1: a CHAIN followed by reply options will skip all NPC interjections inbetween completely. To avoid this, the reply options have to be moved into an own dialogue state following the CHAIN. Example:

 

This:

 

CHAIN
IF ~~ THEN ~%MINSC_JOINED%~ girdleminscslumber
@144
== ~%MINSC_JOINED%~ IF ~InParty("Dynaheir") !StateCheck("Dynaheir",CD_STATE_NOTVALID)~ THEN @145
== ~%DYNAHEIR_JOINED%~ IF ~InParty("Dynaheir") !StateCheck("Dynaheir",CD_STATE_NOTVALID)~ THEN @146
== ~%ALORA_JOINED%~ IF ~InParty("Alora") !StateCheck("Alora",CD_STATE_NOTVALID)~ THEN @147
= @148
== ~%IMOEN_JOINED%~ IF ~InParty("%IMOEN_DV%") !StateCheck("%IMOEN_DV%",CD_STATE_NOTVALID)~ THEN @177
== ~%MINSC_JOINED%~ IF ~InParty("%IMOEN_DV%") !StateCheck("%IMOEN_DV%",CD_STATE_NOTVALID)~ THEN @178
== ~%MINSC_JOINED%~ IF ~~ THEN @180
END
++ @181 EXTERN ~%MINSC_JOINED%~ girdleminscslumberyes
+ ~Gender(Player1,FEMALE)~ + @182 EXTERN ~%MINSC_JOINED%~ girdleminscslumberyes
++ @183 EXTERN ~%MINSC_JOINED%~ girdleminscslumberyes
+ ~Gender(Player1,MALE)~ + @184 EXTERN ~%MINSC_JOINED%~ girdleminscslumberyes
++ @185 EXTERN ~%MINSC_JOINED%~ girdleminscslumberboo
++ @186 EXTERN ~%MINSC_JOINED%~ girdleminscslumberno

 

will play ingame as:

 

CHAIN
IF ~~ THEN ~%MINSC_JOINED%~ girdleminscslumber
@144
END
++ @181 EXTERN ~%MINSC_JOINED%~ girdleminscslumberyes
+ ~Gender(Player1,FEMALE)~ + @182 EXTERN ~%MINSC_JOINED%~ girdleminscslumberyes
++ @183 EXTERN ~%MINSC_JOINED%~ girdleminscslumberyes
+ ~Gender(Player1,MALE)~ + @184 EXTERN ~%MINSC_JOINED%~ girdleminscslumberyes
++ @185 EXTERN ~%MINSC_JOINED%~ girdleminscslumberboo
++ @186 EXTERN ~%MINSC_JOINED%~ girdleminscslumberno

 

For the NPC interjections to show, it has to be scripted the following (adding the need of anothe dialogue line):

 

CHAIN
IF ~~ THEN ~%MINSC_JOINED%~ girdleminscslumber
@144
== ~%MINSC_JOINED%~ IF ~InParty("Dynaheir") !StateCheck("Dynaheir",CD_STATE_NOTVALID)~ THEN @145
== ~%DYNAHEIR_JOINED%~ IF ~InParty("Dynaheir") !StateCheck("Dynaheir",CD_STATE_NOTVALID)~ THEN @146
== ~%ALORA_JOINED%~ IF ~InParty("Alora") !StateCheck("Alora",CD_STATE_NOTVALID)~ THEN @147
= @148
== ~%IMOEN_JOINED%~ IF ~InParty("%IMOEN_DV%") !StateCheck("%IMOEN_DV%",CD_STATE_NOTVALID)~ THEN @177
== ~%MINSC_JOINED%~ IF ~InParty("%IMOEN_DV%") !StateCheck("%IMOEN_DV%",CD_STATE_NOTVALID)~ THEN @178
== ~%MINSC_JOINED%~ IF ~~ THEN @180
END
IF ~~ THEN + interim_test

CHAIN
IF ~~ THEN ~%MINSC_JOINED%~ interim_test
@360

END
++ @181 EXTERN ~%MINSC_JOINED%~ girdleminscslumberyes
+ ~Gender(Player1,FEMALE)~ + @182 EXTERN ~%MINSC_JOINED%~ girdleminscslumberyes
++ @183 EXTERN ~%MINSC_JOINED%~ girdleminscslumberyes
+ ~Gender(Player1,MALE)~ + @184 EXTERN ~%MINSC_JOINED%~ girdleminscslumberyes
++ @185 EXTERN ~%MINSC_JOINED%~ girdleminscslumberboo
++ @186 EXTERN ~%MINSC_JOINED%~ girdleminscslumberno

 

Link to comment
On 3/30/2008 at 12:52 AM, jastey said:

There is no overall script like "Baldur.BCS" in BG1. A replacement could be the dplayer3.bcs, which is the script of Player1. Some "monologues" are triggered via this script in the game.

There is one in my version of BGEE from Beamdog.  I assume you're talking about BGEE and not vanilla.  So, does it just not behave like Baldur.bcs in other games?  Seems to handle things like adding journals, keeping the familiar with you, monkeying about with your reputation if you bring in lewd fellows of the baser sort, that kind of thing.

Or is that because I have the version that comes with TotSC?  That must be it.  I had no idea that BGEE even came without TotSC any more.

Edited by Lauriel
Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...