Jump to content

Fiddling with dialogue triggers


Caedwyr

Recommended Posts

Another theft from Refinements:

 

The Sword Angel kit patches a couple of dialogues to include new triggers.

 

From triggers.d

 

// Falls for a "not good enough" answer in the Drow City
// (Elven mage prisoner chased by tortures) 

REPLACE DADROW6

IF ~Global("AmbientStartRun","AR2200",3)
!See("daelf")~ THEN BEGIN 0 // from:
 SAY #56825 /* ~Ho there! Have you seen the surface bitch? 'Tis fine sport but she's quick on her feet.~ */
 IF ~~ THEN REPLY #56828 /* ~(Lie) - She went that way.~ */ GOTO 1
 IF ~~ THEN REPLY #56829 /* ~(Truth) She went that way.~ */ DO ~SetGlobal("LISwaFal","GLOBAL",3)~ GOTO 2
 IF ~~ THEN REPLY #56831 /* ~Why do you chase her?~ */ GOTO 3
 IF ~~ THEN REPLY #56832 /* ~I have seen no one.~ */ GOTO 4
END

IF ~~ THEN BEGIN 3 // from: 0.2
 SAY #56835 /* ~She was captured on a raid. I enjoy the chase before death. She may even believe that she has a chance. Hah!~ */
 IF ~~ THEN REPLY #56836 /* ~(Lie) Well then, she went that way.~ */ GOTO 1
 IF ~~ THEN REPLY #56837 /* ~(Truth) Well then, she went that way.~ */ DO ~SetGlobal("LISwaFal","GLOBAL",3)~ GOTO 2
 IF ~~ THEN REPLY #56838 /* ~I have not seen her. Sorry.~ */ GOTO 5
END

END

 

I would like to add my own additional triggers to the same replies, for example

 

// Falls for a "not good enough" answer in the Drow City
// (Elven mage prisoner chased by tortures) 

REPLACE DADROW6

IF ~Global("AmbientStartRun","AR2200",3)
!See("daelf")~ THEN BEGIN 0 // from:
 SAY #56825 /* ~Ho there! Have you seen the surface bitch? 'Tis fine sport but she's quick on her feet.~ */
 IF ~~ THEN REPLY #56828 /* ~(Lie) - She went that way.~ */ GOTO 1
 IF ~~ THEN REPLY #56829 /* ~(Truth) She went that way.~ */ DO ~SetGlobal("LISwaFal","GLOBAL",3)~ ~SetGlobal("CACMFal","GLOBAL",3)~ GOTO 2
 IF ~~ THEN REPLY #56831 /* ~Why do you chase her?~ */ GOTO 3
 IF ~~ THEN REPLY #56832 /* ~I have seen no one.~ */ GOTO 4
END

IF ~~ THEN BEGIN 3 // from: 0.2
 SAY #56835 /* ~She was captured on a raid. I enjoy the chase before death. She may even believe that she has a chance. Hah!~ */
 IF ~~ THEN REPLY #56836 /* ~(Lie) Well then, she went that way.~ */ GOTO 1
 IF ~~ THEN REPLY #56837 /* ~(Truth) Well then, she went that way.~ */ DO ~SetGlobal("LISwaFal","GLOBAL",3)~ ~SetGlobal("CACMFal","GLOBAL",3)~ GOTO 2
 IF ~~ THEN REPLY #56838 /* ~I have not seen her. Sorry.~ */ GOTO 5
END

END

 

Where my additional SetGlobals are added to the dialogue triggers without overwriting Refinements (if they exist). I'm guessing that REPLACE is not the coding I want to use. Any hints on how I can do this?

Link to comment

The 5 second flyby answer is

 

ADD_TRANS_TRIGGER DADROW # ~SetGlobal("CACMFal","GLOBAL",3)~

 

(you would have to check on how the numbering works, I've forgotten,; and of course if someone installs the kit first you patch the wrong state, unless you only install it if Refinements is detected using either ACTION_IF FILE_EXISTS_IN_GAME or one of the other 'detect this component" tp2 commands...

 

but to tell you the truth, doing that is just a PITA because you have to check to see if the mod in installed, and you force an install order, etc.

 

An easier way out might be to just set up a block in the area script that responds to the SetGlobal("LISwaFal","GLOBAL",3) , or code a banter or interjection based on it (but since this is a kit, I think the area script is better than the baldur.bcs or the player ai. ) The absent global won't matter unless the mod is installed, and it it is installed, it will kick in.

 

Check with berelinde, as she is mistress of this kind of coding. She set up Gavin with BG1 NPC in mind, but kept everything set up so it could run fine if someone didn't install it.

Link to comment

From your example, I think you might be referring to a transition action (TRANS_ACTION) rather than a trigger. In this case, since both places you want to add the action already contain an existing action, and both actions are also the same, you can catch both with (in a .d file)

 

REPLACE_ACTION_TEXT DADROW6 ~SetGlobal("LISwaFal","GLOBAL",3)~ ~SetGlobal("LISwaFal","GLOBAL",3)

SetGlobal("CACMFal","GLOBAL",3)~

Link to comment

Ascension64 is right - it is the action, trather than the trigger, you are adding to - sorry.

 

 

Just to check, though, doesn't REPLACE_ACTION_TEXT usage like that toss that on *all* transitions? So every single one of them would now shut off any possibility, rather than just one?

 

If so, try this usage:

ADD_TRANS_ACTION BYESLI BEGIN 9 END BEGIN END ~SetGlobal("X#BIOYE1","LOCALS",1)~
ADD_TRANS_ACTION BYESLI BEGIN 10 END BEGIN END ~SetGlobal("X#BIOYE2","LOCALS",1)~
ADD_TRANS_ACTION BYESLI BEGIN 12 END BEGIN END ~SetGlobal("X#BIOYE3","LOCALS",1)~
ADD_TRANS_ACTION BYESLI BEGIN 17 END BEGIN END ~SetGlobal("X#BIOYE4","LOCALS",1)~
ADD_TRANS_ACTION BYESLI BEGIN 18 END BEGIN END ~SetGlobal("X#BIOYE5","LOCALS",1)~
ADD_TRANS_ACTION BYESLI BEGIN 19 END BEGIN END ~SetGlobal("X#BIOYE6","LOCALS",1)~
ADD_TRANS_ACTION BYESLI BEGIN 20 END BEGIN END ~SetGlobal("X#BIOYE7","LOCALS",1)~
ADD_TRANS_ACTION BYESLI BEGIN 13 END BEGIN END ~SetGlobal("X#BIOYE8","LOCALS",1)~

and test - it may be some serious WeiDU doc ReadMe time to make sure you are getting exactly the right state reply and only that state reply patched. You might actually be better off patching this onto state 2, instead, so that the reply isn't what causes the thing, but the next state transition.

Link to comment
Just to check, though, doesn't REPLACE_ACTION_TEXT usage like that toss that on *all* transitions? So every single one of them would now shut off any possibility, rather than just one?
The syntax for REPLACE_ACTION_TEXT is:

 

REPLACE_ACTION_TEXT file oldText newText

 

So, only all instances of oldText are replaced with newText. Of course, if oldText appears in places where you don't want to tamper with, it won't work. In Caedwyr's case, it seems to be that every time SetGlobal("LISwaFal","GLOBAL",3) appears, he wants to add SetGlobal("CACMFal","GLOBAL",3), so it should be safe (unless he hasn't shown us something).

Link to comment

Let's get this straight.

 

Do you want to SET a global? Or do you want to CHECK the value of a global? If you like to set a global, then that is an ACTION. If you want to check, then that is a TRIGGER.

 

Assuming you want to set CACMFal so that you can use it later, the code I wrote above doesn't remove Sword Angel's additions, but adds to it.

Link to comment

Archived

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

×
×
  • Create New...