aVENGER_(RR) Posted December 16, 2007 Share Posted December 16, 2007 When I add now content to an existing dialogue file (say ARLED.DLG) I usually use alphanumeric state labels such as RR#01 or similar. Naturally, once the .D file is compiled by WeiDU the lables get converted into purely numeric form i.e. 18, 50, 172...etc. I can use INTERJECT_COPY_TRANS and similar commands without problems on these purely numeric states, but it doesn't seem to work with alphanumeric labels even when it's compiled from the same .D file. What I want is to have a NPC (i.e. Aerie) interject at a new dialogue branch (introduced by me) of an existing dialogue. If I use the complied numeric values for I_C_T any mods which also modify the existing dialogue will misplace my interjections. The only alternative I found was to use a combination of APPEND and EXTERN but that's very time consuming, especially when there are several NPC interjections lines up after each other (which would be a very easy to do via I_C_T3). Here's an example of my faulty code using I_C_T3 and decompiled numeric values which causes the dialogue to mess up if other mods even come near it. Note that state 97 of ARLED.DLG doesn't exist in the original game, it is introduced by my mod. INTERJECT_COPY_TRANS3 ARLED 97 RR#PlayerIncineratesArled == KELDORJ IF ~InParty("Keldorn") !Dead("Keldorn") !StateCheck("Keldorn",STATE_SLEEPING)~ THEN @1537 == JAHEIRAJ IF ~InParty("Jaheira") !Dead("Jaheira") !StateCheck("Jaheira",STATE_SLEEPING)~ THEN @1538 == AERIEJ IF ~InParty("Aerie") !Dead("Aerie") !StateCheck("Aerie",STATE_SLEEPING)~ THEN @1539 == VICONIJ IF ~InParty("Viconia") !Dead("Viconia") !StateCheck("Viconia",STATE_SLEEPING)~ THEN @1540 == KORGANJ IF ~InParty("Korgan") !Dead("Korgan") !StateCheck("Korgan",STATE_SLEEPING)~ THEN @1541 END And here's an example of the APPEND + EXTERN combo which I'm using now. It works, but it's very time consuming to do this with multiple NPC interjections: // Aerie heals Arledrian APPEND AERIEJ IF ~~ THEN BEGIN RR#AerieHealsArled SAY @1524 = @1525 = @1526 = @1527 = @1528 IF ~~ THEN EXTERN ARLED RR#32d END END // Jaheira heals Arledrian APPEND JAHEIRAJ IF ~~ THEN BEGIN RR#JaheiraHealsArled SAY @1529 = @1530 = @1531 = @1527 = @1532 IF ~~ THEN EXTERN ARLED RR#32d END END // Anomen heals Arledrian APPEND ANOMENJ IF ~~ THEN BEGIN RR#AnomenHealsArled SAY @1533 = @1534 = @1535 = @1527 = @1536 IF ~~ THEN EXTERN ARLED RR#32d END END APPEND ARLED IF ~~ THEN BEGIN RR#32b SAY @1168 IF ~~ THEN GOTO RR#32c IF ~InParty("Aerie") !Dead("Aerie") !StateCheck("Aerie",STATE_SLEEPING)~ THEN EXTERN AERIEJ RR#AerieHealsArled IF ~InParty("Jaheira") !Dead("Jaheira") !StateCheck("Jaheira",STATE_SLEEPING)~ THEN EXTERN JAHEIRAJ RR#JaheiraHealsArled IF ~InParty("Anomen") !Dead("Anomen") !StateCheck("Anomen",STATE_SLEEPING)~ THEN EXTERN ANOMENJ RR#AnomenHealsArled END END So, how am I supposed to go about this? There must be an easier way to accomplish the desired result without fearing that the interjections will be messed up if another mod merely touches the original dialogue. Link to comment
jastey Posted December 16, 2007 Share Posted December 16, 2007 I don't understand: If the new states of the Dialogue is introduced by your mod, why don't you just use CHAIN to get your interjections into it? Link to comment
Kulyok Posted December 16, 2007 Share Posted December 16, 2007 I don't understand: If the new states of the Dialogue is introduced by your mod, why don't you just use CHAIN to get your interjections into it? This was my first thought, as well. (I do this in Dungeon Crawl, and it works fine, in case you need sample code.) Link to comment
aVENGER_(RR) Posted December 16, 2007 Author Share Posted December 16, 2007 Probably because I wasn't even aware that CHAIN could do this. <- Is not as very well versed at .D file coding Sample code would be welcome. Link to comment
CamDawg Posted December 16, 2007 Share Posted December 16, 2007 For those wondering about the underlying failure, it's that WeiDU evaluates some .d code early--i.e. anything that copies transition lists (COPY_TRANS and I_C_T) runs first so that WeiDU can get a snapshot of the transitions before you start adding more to those states (otherwise you'd get duplicate transitions when running an EXTEND on the same state as a COPY_TRANS). This can be exploited beneficially. Take a look at Cromwell's stuff in Tweaks for an example of cascading compiles of interjections. (OK, technically it's an EXTEND_BOTTOM/COPY_TRANS combo, but it's the same thing.) Difference (and problem for you) is that the state number is known. You can probably still do this with some of the new WeiDU .d code by getting the state number with STATE_WHICH_SAYS (or whatever it is). Link to comment
jastey Posted December 16, 2007 Share Posted December 16, 2007 I can't think right now, but if you need syntax help for the CHAIN let me know. (While typing this three posts were posted) I think it would be like this: CHAIN IF ~~ THEN BEGIN ARLED RR#32b @1168 == AERIEJ IF ~InParty("Aerie") !Dead("Aerie") !StateCheck("Aerie",STATE_SLEEPING)~ THEN @1524 = @1525 = @1526 = @1527 = @1528 == JAHEIRAJ IF ~InParty("Jaheira") !Dead("Jaheira") !StateCheck("Jaheira",STATE_SLEEPING)~ THEN @1529 = @1530 = @1531 = @1527 = @1532 == ANOMENJ IF ~InParty("Anomen") !Dead("Anomen") !StateCheck("Anomen",STATE_SLEEPING)~ THEN @1533 = @1534 = @1535 = @1527 = @1536 == ARLED IF ~one of the aboce NPCs said a line~ THEN ~dialogue line of state "RR#32d"~ == ARLED IF ~none of the above conditions are valid~ THEN ~dialogue line of state "RR#32c"~ EXIT (or END and action) Link to comment
aVENGER_(RR) Posted December 16, 2007 Author Share Posted December 16, 2007 Wow, CHAIN rocks! When I first read its description I figured it was some sort of a glorified MULTISAY but it is indeed much more. Here's my aforementioned I_C_T3 passage redone using CHAIN: CHAIN ARLED RR#ArledIncinerated1 @1160 == KELDORJ IF ~InParty("Keldorn") !Dead("Keldorn") !StateCheck("Keldorn",STATE_SLEEPING)~ THEN @1537 == JAHEIRAJ IF ~InParty("Jaheira") !Dead("Jaheira") !StateCheck("Jaheira",STATE_SLEEPING)~ THEN @1538 == AERIEJ IF ~InParty("Aerie") !Dead("Aerie") !StateCheck("Aerie",STATE_SLEEPING)~ THEN @1539 == VICONIJ IF ~InParty("Viconia") !Dead("Viconia") !StateCheck("Viconia",STATE_SLEEPING)~ THEN @1540 == KORGANJ IF ~InParty("Korgan") !Dead("Korgan") !StateCheck("Korgan",STATE_SLEEPING)~ THEN @1541 END IF ~~ THEN GOTO RR#31d Thanks for the help guys (and girls)! Link to comment
cmorgan Posted December 16, 2007 Share Posted December 16, 2007 My favorite thing about CHAIN... the quickly adjusting to who is in party, and creating understandable related side dialogues == KELDORJ IF ~InParty("Keldorn") !Dead("Keldorn") !StateCheck("Keldorn",STATE_SLEEPING)~ THEN @1537 == MAZZYJ IF ~InParty("Keldorn") !Dead("Keldorn") !StateCheck("Keldorn",STATE_SLEEPING) InParty("mazzy") !Dead("mazzy") !StateCheck("mazzy",STATE_SLEEPING)~ THEN ~herResponse~ == JAHEIRAJ IF ~InParty("Jaheira") !Dead("Jaheira") !StateCheck("Jaheira",STATE_SLEEPING)~ THEN @1538 == MAZZYJ IF ~!InParty("jaheira") !Dead("jaheira") !StateCheck("jaheira",STATE_SLEEPING) InParty("mazzy") !Dead("mazzy") !StateCheck("mazzy",STATE_SLEEPING) Global("myFirstvar","GLOBAL",1)~ THEN ~oneResponse~ == MAZZYJ IF ~!InParty("jaheira") !Dead("jaheira") !StateCheck("jaheira",STATE_SLEEPING) InParty("mazzy") !Dead("mazzy") !StateCheck("mazzy",STATE_SLEEPING) Global("myFirstvar","GLOBAL",2)~ THEN ~twoResponse~ == MAZZYJ IF ~!InParty("jaheira") !Dead("jaheira") !StateCheck("jaheira",STATE_SLEEPING) InParty("mazzy") !Dead("mazzy") !StateCheck("mazzy",STATE_SLEEPING) Global("myFirstvar","GLOBAL",3)~ THEN ~threeResponse~ etc., etc., etc in as many adaptive sequences as you want, all with no muss or fuss. Link to comment
jastey Posted December 16, 2007 Share Posted December 16, 2007 Yes, you just have to understand whether this will be I_C_T, I_C_T2, I_C_T3, or I_C_T4. (I really wished I would have the time to write that tutorial I have in mind for a long time now.) Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.