Skip to content

INTERJECT, COPY_TRANS, I_C_T, CHAIN ..... Huh?

karnagekarnage Member Posts: 92
I am still working on Hugh. I have put aside Vondo for now, as a Paladin must be much more vocal and opinionated about matters, leading to more dialoge, interjections, maybe even banter. He's on the back burner while I gain more experience.

I have Hugh joining, being kicked out, rejoining, behaving as I wish him to behave; now, to move on to the Tree of Life.

I have looked at several scripts and have questions. From one script to another, these methods are used for the dialogs:

* INTERJECT
* COPY_TRANS
* INTERJECT_COPY_TRANS
* CHAIN

Which method is best to ensure that the NPC will say their piece, and to make sure that the added dialog does not interfere with or remove/overwrite existing dialog from others?

Comments

  • TwaniTwani Member Posts: 640
    Okay, here's the deal. Keep in mind I'm new at this too, and I might not be 100% right, but I think I know what to do for Tree of Life dialogs.

    You definitely don't want to use INTERJECT. The problem with INTERJECT is that it can basically prevent any other interjections from happening. Say someone was running your mod at the same time as they were running... I don't know, choose your favorite mod. Kelsey to Keto to who the heck ever, depending on someone's install order, INTERJECT could make their own Tree of Life dialog not trigger. This would be bad. Only use INTERJECT when you want your NPC to completely take over the conversation and not allow interjections from other mods or even the canon NPCs. The only common place in NPC mods where INTERJECT is used is when the player gets a bit of dizziness after their soul is taken out at the spellhold, because no one wants a case of every NPC in the party suddenly commenting on 's dizziness (though some people do I_C_T that one). I only am using it once in my mod, when my NPC completely loses it and attacks the party if they make a deal with a demon.

    INTERJECT_COPY_TRANS can just be written as I_C_T to save you time, and it *could* work in this case. In practice, almost all your interjections will be coded by I_C_T. Use this for having your NPC put in a one or two liner about any situation in the game.

    For Tree of Life, though, using CHAIN is probably the best as you'll be having player responses: generally, you don't want I_C_T's to have player responses in them. You'll then want to use COPY_TRANS to get back to the main dialog so everyone else can make their interjections.

    So you'll want something like...

    EXTEND_BOTTOM PLAYER1 33
    If ~Inparty("MYNPC") and all that checks, remember to put a global check 0 here~ EXTERN PLAYER1 toldialog

    CHAIN PLAYER1 toldialog
    ~MYNPC, the generic description. He glowers at you dubiously or does something of that sort.~
    DO ~SetGlobal("theglobalyouchecked","GLOBAL",1)~
    END
    ++ ~You don't need to fight with me.~ EXTERN MYNPCJ toldialog1
    ++ ~I need you to fight with me!~ EXTERN MYNPCJ toldialog1
    (there is no END here in chains, which always gets me)

    CHAIN MYNPCJ toldialog1
    ~I am totes going to fite with you because you are my BFF!~
    END

    COPY_TRANS PLAYER1 33 <-- don't forget that part. That gets you back to the ToL dialog, so <CHARNAME> can continue having interjections with everyone in their party.


    Remember if he's romancable, you need two ToL dialogs.
  • TwaniTwani Member Posts: 640
    Also, be aware that after you've used CHAIN, if you want to go back to the normal
    IF ~~ t1
    SAY ~Talk~
    ++ ~Option~ + talk1.1
    END

    type coding, you need to APPEND MYNPCJ. Likewise, if you already had an append before the chain, you need to put an extra END in to end the 'APPEND' before the chain will work. Some people get frustrated by that and just CHAIN all their dialogs, but I'm led to understand that's not the wisest idea.
  • prophet1prophet1 Member Posts: 172
    Weidu documentation has tutorials on all of these instructions you listed, make sure to read them carefully. They're are not perfect, but helpful if you're lost.

    The tutorial on COPY_TRANS in particular uses the "arrival in hell" dialogue as example, which is very similar to the Tree of Life dialog in that the interjections are triggered from the PLAYER1 dialog, and all party members have the opportunity to speak.
  • karnagekarnage Member Posts: 92
    Thanks, guys!

    Homework, homework, homework, LoL.

    I hope my future mods go (much) faster, LoL.
  • karnagekarnage Member Posts: 92
    edited January 2014
    * INTERJECT
    * COPY_TRANS
    * INTERJECT_COPY_TRANS
    * CHAIN

    Okay, so I want Hugh to have his say here:
    --------------------------------------------------
    // Confronting Irenicus in /Spellhold

    IF ~~ THEN BEGIN 35 // from:
    SAY #45187 /* ~You tortured those here long before I arrived. I merely had more purpose to do it. Bah, I speak with madmen when I should be at my revenge!~ */
    IF ~!IsValidForPartyDialog("Minsc")
    !IsValidForPartyDialog("Jaheira")
    !IsValidForPartyDialog("Imoen2")~ THEN GOTO 36
    IF ~IsValidForPartyDialog("Minsc")~ THEN EXTERN ~MINSCJ~ 163
    IF ~!IsValidForPartyDialog("Minsc")
    IsValidForPartyDialog("Jaheira")~ THEN EXTERN ~JAHEIRAJ~ 460
    IF ~!IsValidForPartyDialog("Minsc")
    !IsValidForPartyDialog("Jaheira")
    IsValidForPartyDialog("Imoen2")~ THEN EXTERN ~IMOEN2J~ 19
    IF ~Global("ValySunaIrenicus","GLOBAL",0)
    InParty("Valygar")
    ~ THEN DO ~SetGlobal("ValySunaIrenicus","GLOBAL",1)~ EXTERN ~VALYGARJ~ 144
    END

    --------------------------------------------------
    (The file name is ppireni2.dlg)
    (The state is 35)
    (I want Hugh to say: So, we finally caught you with your pants down! Time to end this. Do you want my wrath before you give back what you took, or after?
    --------------------------------------------------
    Here is similar text from another .d file where a mod NPC gets their say:

    I_C_T PPIRENI1 4 O#BranPPIRENI14
    == O#BRANJ IF ~InParty("O#Bran") InMyArea("O#Bran") !StateCheck("O#Bran",CD_STATE_NOTVALID)~ THEN ~Explain it or not, 'tis a prison for mages, healthy and sane both. 'Tis simple enough for those that can see.~
    END

    --------------------------------------------------

    So:

    --------------------------------------------------
    I_C_T PPIRENI2 35 zkwhughIrenAssylum
    == zkwhughj IF ~InParty("zkwhugh") InMyArea("zkwhugh") !StateCheck("zkwhugh",CD_STATE_NOTVALID)~ THEN ~So, we finally caught you with your pants down! Time to end this. Do you want my wrath before you give back what you took, or after?~
    END

    --------------------------------------------------

    Am I correct?

    --------------------------------------------------

    I tried it, and it didn't work. Hugh didn't speak up. Now, I pulled up a "saved game" and ran this through. Is that the problem? Would the dialog not happen because the game was already in process? If that is the case, though, why would I be able to test my other dialog by uninstalling/reinstalling the mod then pulling up a saved game and going?

    --------------------------------------------------

    Here is the edited block, decompiled after the mod install, ppireni2:

    IF ~~ THEN BEGIN 35 // from:
    SAY #45187 /* ~You tortured those here long before I arrived. I merely had more purpose to do it. Bah, I speak with madmen when I should be at my revenge!~ */
    IF ~!IsValidForPartyDialog("Minsc")
    !IsValidForPartyDialog("Jaheira")
    !IsValidForPartyDialog("Imoen2")~ THEN GOTO 36
    IF ~IsValidForPartyDialog("Minsc")~ THEN EXTERN ~MINSCJ~ 163
    IF ~!IsValidForPartyDialog("Minsc")
    IsValidForPartyDialog("Jaheira")~ THEN EXTERN ~JAHEIRAJ~ 460
    IF ~!IsValidForPartyDialog("Minsc")
    !IsValidForPartyDialog("Jaheira")
    IsValidForPartyDialog("Imoen2")~ THEN EXTERN ~IMOEN2J~ 19
    IF ~Global("ValySunaIrenicus","GLOBAL",0)
    InParty("Valygar")
    ~ THEN DO ~SetGlobal("ValySunaIrenicus","GLOBAL",1)~ EXTERN ~VALYGARJ~ 144
    IF ~Global("zkwhughppireni235","GLOBAL",0)
    InParty("zkwhugh")
    InMyArea("zkwhugh")
    !StateCheck("zkwhugh",CD_STATE_NOTVALID)
    ~ THEN DO ~SetGlobal("zkwhughppireni235","GLOBAL",1)~ EXTERN ~ZKWHUGHJ~ 1
    END

    --------------------------------------------------
    Here is zkwhughj: State 1 (after installing mod):

    IF ~~ THEN BEGIN 1 // from:
    SAY #75874 /* ~So, we finally caught you with your pants down! Time to end this. Do you want my wrath before you give back what you took, or after?~ */
    IF ~!IsValidForPartyDialog("Minsc")
    !IsValidForPartyDialog("Jaheira")
    !IsValidForPartyDialog("Imoen2")~ THEN EXTERN ~PPIRENI2~ 36
    IF ~IsValidForPartyDialog("Minsc")~ THEN EXTERN ~MINSCJ~ 163
    IF ~!IsValidForPartyDialog("Minsc")
    IsValidForPartyDialog("Jaheira")~ THEN EXTERN ~JAHEIRAJ~ 460
    IF ~!IsValidForPartyDialog("Minsc")
    !IsValidForPartyDialog("Jaheira")
    IsValidForPartyDialog("Imoen2")~ THEN EXTERN ~IMOEN2J~ 19
    IF ~Global("ValySunaIrenicus","GLOBAL",0)
    InParty("Valygar")
    ~ THEN DO ~SetGlobal("ValySunaIrenicus","GLOBAL",1)~ EXTERN ~VALYGARJ~ 144
    END

    -------------------------------------------------

    NearInfinity also showed these triggers, each which would prevent Hugh from speaking in this case. Now, are these the triggers for him to speak, or the triggers to complete an action (extern, et) after speaking?

    !IsValidForPartyDialog("Minsc")
    !IsValidForPartyDialog("Jaheira")
    !IsValidForPartyDialog("Imoen2")



    Now, I pulled up a "saved game" and ran this through. Is that the problem? Would the dialog not happen because the game was already in process? If that is the case, though, why would I be able to test my other dialog by uninstalling/reinstalling the mod then pulling up a saved game and going?

    Post edited by karnage on
  • karnagekarnage Member Posts: 92
    edited January 2014
    ...
  • prophet1prophet1 Member Posts: 172
    All looks good, the dialog should be firing as long as the trigger conditions are met. If you open your saved game (baldur.gam from the save folder) in NI, does your NPC have the correct dialog (zkwhughj) assigned in party?

    Check that nothing is interfering with the listed trigger conditions:
    IF ~Global("zkwhughppireni235","GLOBAL",0) InParty("zkwhugh") InMyArea("zkwhugh") !StateCheck("zkwhugh",CD_STATE_NOTVALID)~
    karnage said:

    NearInfinity also showed these triggers, each which would prevent Hugh from speaking in this case. Now, are these the triggers for him to speak, or the triggers to complete an action (extern, et) after speaking?

    If you mean everything under SAY in your in zkwhughj State 1, those are simply the original transitions COPY_TRANSed from the Irenicus dialog file. They can't interfere with your NPC speaking their lines, since they control what happens after that.
  • karnagekarnage Member Posts: 92
    The dialog file was correct. I will check the triggers as you suggest, and look again to make sure that there is not more than one "path" that leads to the party's dialogs. Possibly, there is more than one "state" from Irenicus that leads to the party's posturing? I'll keep working at it!
  • LiamEslerLiamEsler Member Posts: 1,859
    I wrote a tutorial on this ages ago which might be helpful -- you can check it out here. Formatting looks a bit odd now, though.
  • karnagekarnage Member Posts: 92
    edited January 2014
    .... nevermind this post ...

    Thanks, Liam, I'll check it out.
  • TwaniTwani Member Posts: 640
    If the mod is already been installed in your saved game, even if you uninstall and reinstall it, some changes don't always go through. I had this problem with my NPC going through morale failure everytime the party entered his joining area (long, stupid story) and despite changing everything a dozen times, I couldn't get him to stop doing that no matter how many times I uninstalled, changed stuff, reinstalled, tested it. Finally I realized the problem was that I was using an already saved game, even though I had never been to that area. Once I created a new save and got to that area, he was working perfectly fine, and probably would have been working perfectly fine ten tries ago if I had just started a new save.

    Dialog files usually aren't as picky, but just to be certain it's not a true bug of it not showing rather then saved games being stupid, try using a completely new save to test out your conditions. Yes, that's a pain in the butt for testing things like the spellhold (or even worse, the tree of life), but you can CLUA Console the right variables and checks to move yourself to the right area if necessary. Or, if you're like me, just CTRL+J plus CTRL+Y everything in sight.

    Your code looks perfectly fine, and has everything in it to work properly, as prophet1 said. All of Irenicus dialog options eventually lead to phrase 35 (likely to give focus to the Imoen interaction). Other mods modify it no problem- in my game, it looks like Arath and Adrian are set to comment, as well as Unfinished Business Valygar having a remark about Suna. So everything should be fine. If it's not triggering for you in your game, do an uninstall, a reinstall, then restart from the beginning and get there and everything should be fine.
  • karnagekarnage Member Posts: 92
    What is this condition? I don't recall putting anything in my script referring to this variable, other than I thought it was a label:

    Global("zkwhughppireni235","GLOBAL",0)
  • karnagekarnage Member Posts: 92
    Here, it is set to 1 in Hugh's script:

    ~SetGlobal("zkwhughppireni235","GLOBAL",1)

    Then, tests to see if it is 0:

    Global("zkwhughppireni235","GLOBAL",0)

    .... but the test for 0 comes, I think, before externing to Hugh, who then changes the variable to 1 ... that is to prevent looping, isn't it? So that the game doesn't get stuck with Hugh saying the same thing over and over again, hanging up the game?
  • karnagekarnage Member Posts: 92
    edited January 2014
    Wait, the name of the character is "Hugh Smeed".

    The name of the file is "zkwHugh.cre".

    Is that my problem? There is no character named zkwHugh, so the dialogs are bypassed?

    Should it be:

    IF ~Global("zkwhughppireni235","GLOBAL",0)
    InParty("Hugh Smeed")
    InMyArea("Hugh Smeed")
    !StateCheck("Hugh Smeed",CD_STATE_NOTVALID)~
  • karnagekarnage Member Posts: 92
    karnage said:

    Wait, the name of the character is "Hugh Smeed".

    The name of the file is "zkwHugh.cre".

    Is that my problem? There is no character named zkwHugh, so the dialogs are bypassed?

    Should it be:

    IF ~Global("zkwhughppireni235","GLOBAL",0)
    InParty("Hugh Smeed")
    InMyArea("Hugh Smeed")
    !StateCheck("Hugh Smeed",CD_STATE_NOTVALID)~

    Didn't work. But all the same, am I supposed to be using the file name or the character name?
  • IsayaIsaya Member, Translator (NDA) Posts: 752
    Neither of those. You have to use the "script name" sometimes also called "death variable" specified in your CRE file. The title "script name" explicitely tells this will be used for referencing the creature in scripts, as well as in similar constructs in dialogs.
  • karnagekarnage Member Posts: 92
    edited January 2014
    LoL, I would have never considered .... Thank you, @Isaya. I imagine I'll get my ICT's working tomorrow then ....
  • prophet1prophet1 Member Posts: 172
    edited January 2014
    @karnage those triggers expect NPC's script name (aka death var), not the CRE file name or actual name. The value at offset 0x0280 in CRE file. The same value must have been used in the first column in PDIALOG.2DA and INTERDIA.2DA appends in your TP2 code.
  • karnagekarnage Member Posts: 92
    It fired .... :-)
Sign In or Register to comment.