Ascension64 Posted March 23, 2013 Share Posted March 23, 2013 I recently encountered a race condition in WISH25.DLG. SetupWish() is an action that essentially sets globals. If a player clicks fast enough through the dialogue, then they may reach the state offering wish options before the globals are fully modified, which can result in a NO VALID REPLIES OR LINKS message. This scenario is very similar to having a SetGlobal() within a dialogue and checking that same global a little bit later in the dialogue. However, this is a little more tricky, because players usually aren't fast enough to rapidly advance through 3 states to produce the error. With TobEx, a little extra overhead is generated which exposes this bug more easily. A simple fix (example shown below) eliminates the race condition. My request is for something like this to be put into BG2 Fixpack, because it does fix a bug, despite vanilla BG2:ToB users encountering it at an infinitesimally small chance. The coding needs to better conform to BG2 Fixpack standards, though, and also note that the Limited Wish creature also uses the same wish01.bcs script. Open for discussion. <<<<<<<< wish01_extend.baf IF Global("A6SetupWish","LOCALS",0) CheckStatGT(LastSummonerOf(Myself),17,WIS) THEN RESPONSE #100 SetupWish(4,1) SetGlobal("A6SetupWish","LOCALS",1) END IF Global("A6SetupWish","LOCALS",0) CheckStatGT(LastSummonerOf(Myself),14,WIS) CheckStatLT(LastSummonerOf(Myself),18,WIS) THEN RESPONSE #100 SetupWish(3,1) SetGlobal("A6SetupWish","LOCALS",1) END IF Global("A6SetupWish","LOCALS",0) CheckStatGT(LastSummonerOf(Myself),9,WIS) CheckStatLT(LastSummonerOf(Myself),15,WIS) THEN RESPONSE #100 SetupWish(2,1) SetGlobal("A6SetupWish","LOCALS",1) END >>>>>>>> EXTEND_TOP ~wish01.bcs~ ~wish01_extend.baf~ COPY_EXISTING ~wish01.bcs~ ~override/wish01.bcs~ DECOMPILE_BCS_TO_BAF REPLACE_TEXTUALLY ~Detect(LastSummonerOf(Myself))~ ~Detect(LastSummonerOf(Myself)) Global("A6SetupWish","LOCALS",1)~ COMPILE_BAF_TO_BCS BUT_ONLY <<<<<<<< wish25_mod.d REPLACE_ACTION_TEXT ~wish25~ ~\(SetupWish([0-9],1)\)~ ~//\1~ >>>>>>>> COMPILE ~wish25_mod.d~ Link to comment
Ascension64 Posted April 12, 2013 Author Share Posted April 12, 2013 Bumping for comments? If you guys are reluctant, I'll just throw this in with TobEx. Link to comment
CamDawg Posted April 13, 2013 Share Posted April 13, 2013 Bumping for comments? If you guys are reluctant, I'll just throw this in with TobEx. Nah, just been busy with EE; this looks fine. If you want to put it in TobEx in the meantime go for it--the way it's written it's not going to hurt anything if ends up applied more than once. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.