Jump to content
jastey

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.

Share this post


Link to post
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.

Share this post


Link to post

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!

Share this post


Link to post

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

 

Share this post


Link to post
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...