Salk Posted May 5, 2022 Share Posted May 5, 2022 (edited) Hello! Being rustier than ever and having forgotten what little I used to know, I am wondering if someone could help me with some basic WeiDU coding. Let's say I want to copy state 5 (highlighted in the attached image) so that it will also exist on the same level as states 0 and 6. Do I need to use APPEND even if I just want a perfect duplicate of it or is it there a better way? Thanks! Edited May 5, 2022 by Salk Uploaded less blurry image Quote Link to comment
jastey Posted May 5, 2022 Share Posted May 5, 2022 I have no idea what you mean with "on the same level". I'd suggest decompiling the dialogue using the "EXPORT -> as weidu dialogue file" functionality and have a look how the dialogue is supposed to flow. Quote Link to comment
argent77 Posted May 5, 2022 Share Posted May 5, 2022 (edited) "Same level" is misleading, since states can be triggered multiple times in a dialog. To allow a specific state to be evaluated when a conversation starts you have to add a state trigger, and possibly a weight definition as well. This .d code example would turn state 5 of AMARCH02.DLG into an initial state. ADD_STATE_TRIGGER AMARCH02 5 ~True()~ SET_WEIGHT AMARCH02 5 #-1 // ensures that state 5 is evaluated first (be careful not to block plot-related dialog branches) Edited May 5, 2022 by argent77 Quote Link to comment
Salk Posted May 5, 2022 Author Share Posted May 5, 2022 Hello again. Apologies about using a misleading terminology. What I did mean was that l wanted the line at state 5 to be one of the initial ones in the dialogue just like lines at state 0 and 6 are. Quote Link to comment
jastey Posted May 5, 2022 Share Posted May 5, 2022 in that case, it would be important to know under which conditions you want state 5 to trigger, then add the trigger with the syntax @argent77 posted, replacing the "True()" in his example to whatever trigger you want. When would you like this state to trigger, can you specify? Quote Link to comment
Salk Posted May 5, 2022 Author Share Posted May 5, 2022 (edited) Hi again! Yes, of course. I will be more specific with what I intend to do. The dialogue I need to edit is BG2's amarch02.dlg. My intention is to introduce two local variables (#GDONTCOMEBACK and #GIAMCURIOUS) in order to keep track of the dialogue's different moments. This is the original .d file: Spoiler BEGIN ~AMARCH02~ 1 // non-zero flags may indicate non-pausing dialogue IF ~NumTimesTalkedTo(0)~ THEN BEGIN 0 // from: SAY #66723 /* ~Can't you see I'm busy? My archers need to stay in top form!~ [AMARCH08] */ IF ~~ THEN REPLY #66724 /* ~So this is some type of training exercise?~ */ GOTO 2 IF ~~ THEN REPLY #66725 /* ~I was just wondering what you were doing.~ */ GOTO 8 IF ~~ THEN REPLY #66726 /* ~I don't like your tone!~ */ GOTO 1 END IF ~~ THEN BEGIN 1 // from: 0.2 SAY #66727 /* ~My tone wasn't meant to please you. So just button your lip and try and stay out of the way or my archers might turn you into a pin cushion.~ [AMARCH09] */ IF ~~ THEN REPLY #66728 /* ~Sorry... I was just wondering what you were doing.~ */ GOTO 3 IF ~~ THEN REPLY #66729 /* ~Fine. I'll just be going then.~ */ GOTO 7 IF ~~ THEN REPLY #66730 /* ~Now you're threatening me? Do you know who I am?~ */ GOTO 2 END IF ~~ THEN BEGIN 2 // from: 0.0 1.2 SAY #66731 /* ~I can't be wasting my time yapping with some slack jawed yokel.~ [AMARCH10] */ IF ~~ THEN GOTO 3 END IF ~~ THEN BEGIN 3 // from: 1.0 2.0 9.0 SAY #66732 /* ~My archers need to practice, and I need to keep summoning monsters so they have a target to aim at.~ */ IF ~~ THEN REPLY #66733 /* ~That's barbaric - what kind of sadistic monster are you?~ */ GOTO 4 IF ~~ THEN REPLY #66734 /* ~Isn't that kind of dangerous? What if the monsters break free?~ */ GOTO 4 IF ~~ THEN REPLY #66735 /* ~Mind if I join in?~ */ GOTO 4 IF ~~ THEN REPLY #66736 /* ~Oh, I see. Well, I guess I'll be going then.~ */ GOTO 7 END IF ~~ THEN BEGIN 4 // from: 3.0 3.1 3.2 SAY #66737 /* ~This is a private session... no one asked you to stick your nose in. Now quit bothering me!~ */ IF ~~ THEN REPLY #66738 /* ~I'm not done with my questions yet!~ */ GOTO 5 IF ~~ THEN REPLY #66739 /* ~Fine. I'll be going.~ */ GOTO 7 END IF ~~ THEN BEGIN 5 // from: 4.0 6.1 SAY #66740 /* ~That's it! I'm sick of your annoying interruptions... we've got a new target, men! Fire!~ */ IF ~~ THEN DO ~Enemy() ActionOverride("AMARCH02",Enemy()) ActionOverride("AMARCH03",Enemy()) ActionOverride("AMARCH04",Enemy()) ActionOverride("AMARCH05",Enemy()) ActionOverride("AMARCH06",Enemy())~ EXIT END IF ~NumTimesTalkedToGT(0)~ THEN BEGIN 6 // from: SAY #66741 /* ~You again? I warned you not to bother us any more!~ */ IF ~~ THEN REPLY #66742 /* ~Sorry. I'll be going.~ */ GOTO 7 IF ~~ THEN REPLY #66743 /* ~But I just want to ask you a few questions.~ */ GOTO 5 IF ~~ THEN REPLY #73052 /* ~I just wanted to know what you were doing.~ */ GOTO 8 END IF ~~ THEN BEGIN 7 // from: 1.1 3.3 4.1 6.0 8.1 SAY #66744 /* ~Good. Don't come back - my archers aren't above using a <RACE> for target practice!~ */ IF ~~ THEN EXIT END IF ~~ THEN BEGIN 8 // from: 0.1 6.2 SAY #73051 /* ~What does it look like we're doing? Preparing for war! Now leave us to it and begone!~ */ IF ~~ THEN REPLY #73053 /* ~War? War against whom?~ */ GOTO 9 IF ~~ THEN REPLY #73054 /* ~Alright, I'll leave you alone, then.~ */ GOTO 7 END IF ~~ THEN BEGIN 9 // from: 8.0 SAY #73055 /* ~What do I look like, a recruiting officer? An information clerk? We're set to face off against the most dangerous of foes... drow, mind flayers, dragons, you name it!~ */ IF ~~ THEN GOTO 3 END After some consideration, what I would like to do is: Add a new initial state to the dialogue, introducing the first local variable (I don't think I need to modify the weight) Replace NumTimesTalkedToGT(0) in state 6 with a different one Introduce the second local variable so that the Player will be presented with a specific reply only once Increase the value of the first local variable at specific junctions Replace a specific reply in the dialogue with a new one (@329) and another specific reply with an existing one And this is my current (untested) code: <<<<<<<< .../inlined/#gamarch02.d ADD_STATE_TRIGGER ~amarch02~ 5 ~Global("#GDONTCOMEBACK","LOCALS",2)~ REPLACE_STATE_TRIGGER ~amarch02~ 6 ~Global("#GDONTCOMEBACK","LOCALS",1)~ ADD_TRANS_ACTION ~amarch02~ BEGIN 8 END BEGIN END ~SetGlobal("#GIAMCURIOUS","LOCALS",1)~ ADD_TRANS_TRIGGER ~amarch02~ 6 ~Global("#GIAMCURIOUS","LOCALS",0)~ DO 2 ADD_TRANS_ACTION ~amarch02~ BEGIN 0 END BEGIN END ~SetGlobal("#GDONTCOMEBACK","LOCALS",1)~ ADD_TRANS_ACTION ~amarch02~ BEGIN 4 END BEGIN 0 END ~SetGlobal("#GDONTCOMEBACK","LOCALS",2)~ ADD_TRANS_ACTION ~amarch02~ BEGIN 6 END BEGIN 1 END ~SetGlobal("#GDONTCOMEBACK","LOCALS",2)~ ADD_TRANS_ACTION ~amarch02~ BEGIN 5 END BEGIN END ~SetGlobal("#GDONTCOMEBACK","LOCALS",0) SetGlobal("#GIAMCURIOUS","LOCALS",0)~ APPEND ~amarch02~ IF ~~ THEN BEGIN ~#glastwarning~ SAY @329 /* ~Make sure you won't bother me again! This is your last warning.~ */ IF ~~ THEN THEN DO ~SetGlobal("#GDONTCOMEBACK","LOCALS",2)~ EXIT END ALTER_TRANS ~amarch02~ BEGIN 6 END BEGIN 0 END BEGIN "EPILOGUE" ~GOTO #glastwarning~ END ALTER_TRANS ~amarch02~ BEGIN 1 END BEGIN 2 END BEGIN "EPILOGUE" ~GOTO 4~ END >>>>>>>> COMPILE ~.../inlined/#gamarch02.d~ Please tell me if you see something wrong or if you have any other recommendations. Thanks! PS - I think I could save myself some trouble if I could SET_WEIGHT for the new initial state so that it is evaluated last, as opposed to first (SET_WEIGHT AMARCH02 5 #-1). Is there a way to do that? Edited May 9, 2022 by Salk Code change and additional question Quote Link to comment
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.