Jump to content

Dialogue and script triggers evaluate differently?


CamDawg

Recommended Posts

I've been working on fixing a bug for a Delainy LT, and discovered that the engine was evaluating the same trigger as true in a script and false in a dialogue. Delainy's override script initiates LT=6 with this block:

 

IF
      InParty(Myself)
      RealGlobalTimerExpired("C!DelainyRomance","GLOBAL")
      Global("C!DelainyRomanceActive","GLOBAL",1)
      Global("C!DelainyMatch","GLOBAL",1)
      !StateCheck(PLAYER1,CD_STATE_NOTVALID)
      !StateCheck(Myself,CD_STATE_NOTVALID)
      !AreaType(DUNGEON)
      See(Player1)
      !See([ENEMY])
      !Range([NEUTRAL],10)
      CombatCounter(0)
      Global("C!PolyWW","GLOBAL",0)
      Global("LoveTalk","LOCALS",5)
      TimeOfDay(MORNING)
THEN
      RESPONSE #100
               IncrementGlobal("LoveTalk","LOCALS",1)
               PlaySong(34)
               Interact(Player1)
END

 

I added a stringhead to confirm his block was evaluating to true. The LoveTalk variable gets incremented as well. However, the following dialogue block from BCDDELAI was being bypassed for a banter further down the stack:

 

IF ~InParty(Myself)
    RealGlobalTimerExpired("C!DelainyRomance","GLOBAL")
    Global("C!DelainyRomanceActive","GLOBAL",1)
    Global("C!DelainyMatch","GLOBAL",1)
    !StateCheck(PLAYER1,CD_STATE_NOTVALID)
    !StateCheck(Myself,CD_STATE_NOTVALID)
    !AreaType(DUNGEON)
    See(Player1)
    !See([ENEMY])
    !Range([NEUTRAL],10)
    CombatCounter(0)
    Global("C!PolyWW","GLOBAL",0)
    Global("LoveTalk","LOCALS",6)
    TimeOfDay(MORNING)~ THEN BEGIN DelLT6_0 SAY @1277 = @1278 = @1279
 IF ~~ THEN REPLY @1280 GOTO DelLT6_a
 IF ~~ THEN REPLY @1281 GOTO DelLT6_b
 IF ~~ THEN REPLY @1282 GOTO DelLT6_c
 IF ~~ THEN REPLY @1283 GOTO DelLT6_d
 IF ~~ THEN REPLY @1284 GOTO DelLT6_e
END

 

The dialogue triggers are the same as the script that calls it, except for the LoveTalk LOCALS variable (which gets incremented by the script). This evaluates to false. However, if TimeOfDay(MORNING) gets commented out from this dialogue trigger, the LT fires as expected.

 

The only conclusion I can draw from this disparity is that TimeOfDay is somehow evaluated differently for dialogues and scripts. Can anyone think of something I haven't considered?

Link to comment

I don't think so--all the other LoveTalk scripting is the same block minus the TimeOfDay and we've had no issues with them. At one point during testing the LoveTalk variable check in the dialogue trigger was removed, and the LT was still bypassed.

Link to comment

I could imagine that not the same *.ids files are available for the game as the script compiler (WeiDU).

This could create weird things, since dialogs are compiled by the engine, while scripts are pre-compiled by your script compiler.

I don't say this the problem, but it could create exactly the same symptoms.

 

Btw, why are you using RealGlobalTimer?

AFAIK realglobaltimer isn't affected by pauses and use 'machine time', while globaltimer use gametime.

Link to comment

The compiler is a possibility--I think WeiDU reads the ingame IDS files at install, though. The dialogues are uncompiled until run in the game, so if the IDS changed in the meantime I guess it could be the problem. However, both of these are being compiled at the same time with no IDS changes prior to testing ingame. :D

 

For the tmier, BG2 romance timers are traditionally dictated by real time (i.e. pausing counts) so I'd like Del to match.

Link to comment

I don't trust TimeOfDay so I use ranged checking with the Time trigger instead. For morning you'd use something like:

...
TimeGT(5) // at least dawn
TimeLT(12) // not yet noon
...

 

That's with the trigger defined to use the TIME.IDS file, by using the form Time(I:Time*TIME) and the same for TimeGT and TimeLT.

 

It's an extra trigger, but it's reliable and more flexible.

Link to comment

Archived

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

×
×
  • Create New...