Okay, I don't want to step on anybody's toes here, but since you asked and I'm eager to try the things I'm learning, here comes a possible alternative code.
Currently
x#edint.d has the following code setting that encounter:
(snip from x#edint.d)
INTERJECT ~%tutu_var%DENAK~ 0 X#EdwinAllies
== ~%tutu_var%EDWIN~ IF ~Global("X#EdwinReturn","GLOBAL",1) !InParty("edwin") See("denak")~ THEN
@1
END
IF ~~ THEN DO ~SetGlobal("X#EdwinReturn","GLOBAL",2)
ActionOverride("denak",Enemy())
ActionOverride("brendan",Enemy())
ActionOverride("lasala",Enemy())
ActionOverride("diana",Enemy())
ActionOverride("edwin",Enemy())~ EXIT
APPEND ~%tutu_var%EDWIN~
IF WEIGHT #-2 ~%BGT_VAR% Global("X#EdwinReturn","GLOBAL",1) !InParty("edwin")~ EdwinUnhappy
SAY @2
IF ~~ THEN DO ~
SetGlobal("X#EdwinReturn","GLOBAL",2)
CreateCreature("%tutu_var%FGOLEM",[-1.-1],0)
CreateCreature("%tutu_var%FGOLEM",[-1.-1],0)
ActionOverride("denak",Enemy())
ActionOverride("brendan",Enemy())
ActionOverride("lasala",Enemy())
ActionOverride("diana",Enemy())
Enemy()~ EXIT
END
END
APPEND ~%EDWIN_POST%~
IF WEIGHT #-2 ~%BGT_VAR% Global("X#EdwinReturn","GLOBAL",1) !InParty("edwin")~ EdwinUnhappy
SAY @2
IF ~~ THEN DO ~
SetGlobal("X#EdwinReturn","GLOBAL",2)
CreateCreature("%tutu_var%FGOLEM",[-1.-1],0)
CreateCreature("%tutu_var%FGOLEM",[-1.-1],0)
ActionOverride("denak",Enemy())
ActionOverride("brendan",Enemy())
ActionOverride("lasala",Enemy())
ActionOverride("diana",Enemy())
Enemy()~ EXIT
END
END
APPEND ~%tutu_var%DENAK~
IF WEIGHT #-2 ~GlobalGT("X#EdwinReturn","GLOBAL",0)~ EdwinDeath
SAY @3
IF ~~ THEN DO ~SetGlobal("X#EdwinReturn","GLOBAL",3)
ActionOverride("denak",Enemy())
ActionOverride("brendan",Enemy())
ActionOverride("lasala",Enemy())
ActionOverride("diana",Enemy())
ActionOverride("edwin",Enemy())
Enemy()~ EXIT
END
END
Following my explanations there is a code box with what I thought could be a good replacement (explanations first, code second

):
I have WEIGHTed the starter dialogue with Denak so that it overrides the original bioware one (otherwise it fires first, as its state trigger is 0, the lowest). It should not cause any problem because we are checking for a BG1NPC variable anyway,
X#EdwinReturn.
The starter dialogue checks if "X#EdwinReturn" > 0 to fire up and override the original bio dialogue. If this returns true, then every dialogue has its own "X#EdwinReturn" condition (1,2,3) depending on what has happened before the encounter (controlled by a script). This is what I have sketched:
- If "X#EdwinReturn" = 1, not enough time has passed for him to set up an ambush, and the ~Never double cross... blah~ dialogue fires up. No ogres are summoned.
- If "X#EdwinReturn" = 2, Edwin has had time to prepare the ambush, and two ogres will appear. This assumes we go to %EDWIN_POST% (*)
* Here I believe we can just obliterate the option to go to %tutu_var%EDWIN, since Edwin's dialogue file should be %EDWIN_POST%, I think. Still I don't know if there's a special case in which it might be needed, but if it is, I could add to the _EDWIN.BCS script a line that changes the dialogue appropriately.
- If "Dead("Edwin")", as a safety measure against violent players (like myself), who could kill him while he was escaping, the dialogue is expected to exit. As far as I know, this check is not needed, as in the case he's dead no dialogue will fire anyway.
- If "X#EdwinReturn" = 3, then we already have gone through this.
Lastly, I have appended the necessary states to %EDWIN_POST%.
I'm almost sure more experienced modders will know how to code this better, more efficiently, but I'm a rookie mind you

. Besides, I've tried my best and I had fun doing it. It works, I have tested it

(ok, I made a couple of last minute changes for optimization, but I'm gonna test it now)
APPEND %tutu_var%DENAK
IF WEIGHT #-2 ~%BGT_VAR% GlobalGT("X#EdwinReturn","GLOBAL",0)~ THEN BEGIN X#EdwinAllies1
SAY @3
IF ~%BGT_VAR% Global("X#EdwinReturn","GLOBAL",1) !Dead("Edwin") !InParty("edwin") See("denak")~ // no ogre ambush
THEN DO ~SetGlobal("X#EdwinReturn","GLOBAL",3)
ActionOverride("denak",Enemy())
ActionOverride("brendan",Enemy())
ActionOverride("lasala",Enemy())
ActionOverride("diana",Enemy())
ActionOverride("edwin",Enemy())~
EXTERN ~%EDWIN_POST%~ X#EdwinAllies1.1
IF ~%BGT_VAR% Global("X#EdwinReturn","GLOBAL",2) !Dead("Edwin") !InParty("edwin") See("denak")~ // little ogre surprise
THEN DO ~SetGlobal("X#EdwinReturn","GLOBAL",3)
ActionOverride("denak",Enemy())
ActionOverride("brendan",Enemy())
ActionOverride("lasala",Enemy())
ActionOverride("diana",Enemy())
ActionOverride("edwin",Enemy())~
EXTERN ~%EDWIN_POST%~ X#EdwinAllies1.2
IF ~Dead("Edwin")~ // Edwin is dead
THEN DO ~SetGlobal("X#EdwinReturn","GLOBAL",3)
ActionOverride("denak",Enemy())
ActionOverride("brendan",Enemy())
ActionOverride("lasala",Enemy())
ActionOverride("diana",Enemy())~
EXIT
END
END
APPEND %EDWIN_POST%
IF ~!StateCheck("edwin",CD_STATE_NOTVALID)~ X#EdwinAllies1.1
SAY @1
IF ~~ THEN DO ~~ EXIT
END
IF ~!StateCheck("edwin",CD_STATE_NOTVALID)~ X#EdwinAllies1.2
SAY @2
IF ~~ THEN DO ~CreateCreature("%tutu_var%FGOLEM",[-1.-1],0)
CreateCreature("%tutu_var%FGOLEM",[-1.-1],0)~ EXIT
END
END
Later I'll try to make a script that checks for a certain time before setting "X#EdwinReturn" to 2. It should probably go into %SpiderWood_BCS%. I hope I can do it.
EDITs:
So that the code box doesn't look all messed up.
Btw I used indentation, I find it easier that way.
And I'm using those nice macros that unify BGT and Tutu coding. I'm still a bit lost there, so I hope they are fine.
Typo in code box, now it installs properly within BG1NPC
Edited by -JW-, 23 September 2008 - 12:08 PM.