Skip to content

General mod Questions thread

SystemSystem Administrator Posts: 199
edited January 2018 in General Modding
Hello, ladies and gentlemen.

We have decided to merge several threads about different modding questions into one thread. This way you'll be able to find all the needed information in one place.

- Site staff
Post edited by JuliusBorisov on
«13456770

Comments

  • chimericchimeric Member Posts: 1,163
    edited January 2018
    Appending existing dlg files

    Is there an example or a tutorial on changing NPC's existing dialogues? I can pass them through a D and just rewrite-replace them, but I'd rather extend them with my own states etc.
    Post edited by JuliusBorisov on
  • chimericchimeric Member Posts: 1,163
    Anything special about how it works? Will the characters only stay in the party while it's in effect, and then leave immediately?
  • chimericchimeric Member Posts: 1,163
    In case there's some confusion, this probably takes EXTEND_TOP in Weidu, described as:

    EXTEND_TOP filename stateLabel list [ #positionNumber ] transition list END

    But the description of this function does not make any sense to me.
  • IsayaIsaya Member, Translator (NDA) Posts: 752
    The simplest change is to add new discussions. For instance to add a new talk to a character in order to react to a certain event, you would use APPEND in order to add you new state(s), i.e. new talks.
    APPEND ~dialog file name~ IF ~returning from Underdark~ THEN BEGIN Chap6NewTalk SAY ~It's good the guild war has stopped~ IF ~~ THEN REPLY ~You can thank me~ GOTO thanks IF ~~ THEN REPLY ~I don't care~ EXIT END END // for APPEND

    EXTEND_TOP and EXTEND_BOTTOM allow adding a reply at a given state.

    Other kinds of alterations use ALTER_TRANS for fixing or changing the way a reply is coded.

    If you have a look at a mod like BG2 Fixpack you'll find a lot of examples of how to change a dialog in order to fix bugs in it, for instance.
  • chimericchimeric Member Posts: 1,163
    Your example is just what I need, Isaya. Thanks a lot. I probably won't want to add replies to ready states. So I put this kind of code right in the tp2?
  • ArdanisArdanis Member Posts: 1,736
    edited January 2017
    Dialogue code goes into .d files, which you then COMPILE (same as .baf scripts) in tp2.
  • chimericchimeric Member Posts: 1,163
    edited January 2017
    I know, just never put d content directly in a tp2.

    Currently I'm getting a fatal parse error if I put this in my tp2:
    APPEND ~KAGAIN~
    IF ~~ THEN BEGIN KAZAKNO1
    SAY ~Who cares? You tie that purse back up right now, <GABBER>. It's bad enough we'll never recover the gold you've fed this bum.~
    IF ~~ THEN DO ~SetGlobal("KAZAKER_TEACHES","GLOBAL",0) SetGlobal("KAZAKER_PISSED","GLOBAL",1) AddJournalEntry(@0012,INFO)~ EXTERN ~KAZAK_#~ 11
    END
    END
    
    APPEND ~KAGAIN~
    IF ~~ THEN BEGIN KAZAKNO2
    SAY ~Argh! He couldn't. I'm sick of this tear-jerking. Just try giving that mook any gold *my* axe! Come on, we're out of here.~
    IF ~~ THEN DO ~SetGlobal("KAZAKER_TEACHES","GLOBAL",0) SetGlobal("KAZAKER_PISSED","GLOBAL",1) AddJournalEntry(@0012,INFO)~ EXTERN ~KAZAK_#~ 11
    END
    END
    I'd prefer to add both new states at once, too.
  • ArdanisArdanis Member Posts: 1,736
    If I were to guess, Kazak_# doesn't have a state label 11, and WeiDU doesn't count them and resolve names to numbers.
  • IsayaIsaya Member, Translator (NDA) Posts: 752
    I think dialog stuff is not supposed to be written directly in the tp2 file. At least according to the way the WeiDU readme splits things.
    You probably need to write your dialog code in a file that you have to pass as argument to COMPILE. You could create a temporary file from the tp2 file for that purpose, if you really don't want to make a permanent d file. This way is described in the WeiDU documentation : look for "<<<<<<<< fileName fileBody >>>>>>>>" for details and an example.

    You should be able to add as many states as you want: just write all your states before the END of the APPEND block (second END in you example).
  • chimericchimeric Member Posts: 1,163
    The dialogue has state 11.

    Isaya, you gave me that bit of code yourself. What do you mean one is not supposed to put dialogue stuff in a tp2? But if you say APPEND is enough, I'm willing to give it a try. I'll get back to you on the result.
  • AstroBryGuyAstroBryGuy Member Posts: 3,437
    edited January 2017
    The code Isaya gave you goes in a .d file that you compile.

    COMPILE EVALUATE_BUFFER MyDialogStuff.d
  • chimericchimeric Member Posts: 1,163
    edited January 2017
    I know this one. It's only the appending that's new.

    Okay, so what is the final syntax? After APPEND goes the ~addition~ or the ~original dlg I'm adding to~?

    This is what I've done. I put in my tp2 file this line:

    COMPILE EVALUATE_BUFFER ~Fun_at_the_Fair/KAIG_1_#.d~


    Which stands for addition to Kagain's dialogue number 1. The KAIG_1_#.d file inside looks like this:

    APPEND ~KAGAIN~

    IF ~~ THEN BEGIN KAZAKNO1
    SAY ~Who cares? You tie that purse back up right now, . It's bad enough we'll never recover the gold you've fed this bum.~
    IF ~~ THEN DO ~SetGlobal("KAZAKER_TEACHES","GLOBAL",0) SetGlobal("KAZAKER_PISSED","GLOBAL",1) AddJournalEntry(@0012,INFO)~ EXTERN ~KAZAK_#~ 11
    END
    IF ~~ THEN BEGIN KAZAKNO2
    SAY ~Argh! He couldn't. I'm sick of this tear-jerking. Just try giving that mook any gold *my* axe earned! Come on, we're out of here.~
    IF ~~ THEN DO ~SetGlobal("KAZAKER_TEACHES","GLOBAL",0) SetGlobal("KAZAKER_PISSED","GLOBAL",1) AddJournalEntry(@0012,INFO)~ EXTERN ~KAZAK_#~ 11
    END
    END


    Now, this did compile, after I removed from the tp2 the COMPILE line for KAZAK_#.d, which is the dialogue of the NPC I've been talking about. That dialogue is where Kagain gets to cut in with his thing about money; and the reply lines point to EXTERN ~KAGAIN~ KAZAKNO1 and KAZAKNO2. I renamed this in case, for some magical reason, it was the name of the states that caused the problem. I hope this is not confusing. Anyway, those are the states added to KAGAIN.DLG with the above code; but I still get a failure to resolve label if I dare to reference them in the other dialogue. (And no, it's "O" in the name, not "0." I checked.)

    So at this point I'm just not compiling that NPC file and only want to see if the appending to KAGAIN actually happened. Well, in Near Infinity right-clicking on the file gives me the option to restore the back-up, so I guess something has changed about Kagain's file - but it's nothing that could be seen; long story short, to see an appended state anywhere on a tree, you've got to give it some (any) trigger.

    But the failure to parse bugs me. I see no reason for it. The states do get added to KAGAIN, but somehow compiling the file that quotes those states, KAZAK_#, fails - and the compiling is lower on the list than the update to KAGAIN, so the new bits are already in. (But moving them around doesn't change anything.)

    Any ideas?
  • ArdanisArdanis Member Posts: 1,736
    edited January 2017
    The states do get added to KAGAIN, but somehow compiling the file that quotes those states, KAZAK_#, fails - and the compiling is lower on the list than the update to KAGAIN, so the new bits are already in.

    I think the problem may be due to file-by-file compilation, as opposed to batching it. I.e. you can do
    COMPILE ~Fun_at_the_Fair~
    to compile all the .d and .baf files it can find in that folder, in a single action. The difference is that WeiDU will load all the files and read the states first, and only then will proceed to actual compilation. (Although don't quote me on that.)

    I am, however, a bit puzzled how you could resolve EXTERN ~KAZAK_#~ 11 if the actual kazak_#.d was being compiled after the call to it.
  • chimericchimeric Member Posts: 1,163
    It worked! Thank you! It didn't make any difference which file I listed first for compilation, KAZAK_# or KAIG_1_#. The same "cannot resolve label" error appeared. When I followed your advice and used simultaneous compilation of everything, that error was swallowed up, but something interesting happened. I got this instead:



    The all-together compiler used all of the d files in the folder, including KAGAIN.D, which I had planned to just edit originally and replace, then abandoned. It was just lying around in the folder. I deleted it, and voila, the mod installed.

    Very good!

    Now I have only one outstanding error, that weirdness with adding new music. I've already talked about that, but just in case, here is the protocol of Weidu's complaints:



    As you can see, music is, apparently, copied over and added, and I absolutely can see no difference between what I do there with MUS and ACM files and the tutorial - it's just several tunes in my case. But the songs somehow don't make it to SONGLIST.IDS, which makes me wonder just what the ADD_MUSIC function does.
  • chimericchimeric Member Posts: 1,163
    Someone once told me how to change the color of text in a dialogue. I tried it, I guess I'm doing something wrong. Easier to ask. Never really dealt with hex codes.

    The text in my case is:

    0x^FF0234244 [Use Kazaker's system]^ 20 pieces

    [Use Kazaker's system] is supposed to be colored, with ^ closing the bit. Not working.

  • chimericchimeric Member Posts: 1,163
    edited February 2017
    He's got KAGAIN.DLG, KAGAIJ.DLG, KAGAIP.DLG and KAGAIZ.dlg (with just one state). Now, I thought that everything but the first one are some special-case one-time dialogue files run from StartDialogue instead of Dialogue, or perhaps the NoSet versions. But, it seems, his dialogue does get set, because the Kagain in my current party, when looked at in the editor, has the KAGAIJ.DLG. This may explain why the EXTERN command I've put out to ~KAGAIN~ from another NPC's conversation fails, but what can I do about this? Sure, I can update all of his dialogues with the custom extra states, but I still have to put a specific dialogue file in those tildas for the EXTERN, and I have no way of knowing which one players' current Kagain will have.
  • LavaDelVortelLavaDelVortel Member Posts: 2,859
    Why don't you just Google? The matter of dialogues has been discussed for like 18 years on many different community sites... There are MANY tutorials on those, not just in English. If you have asked Google, you would get redirected to this post, where you can read:

    When the player initiates a dialog with a creature in the game, the game will scan through all dialog states until it encounters a dialog state with a non-empty trigger that evaluates to true. If a dialog state is found, this is the starting point of the dialog. If no dialog state is found, the game will display a “Thea - has nothing to say to you” message.

    An NPC has 3 different dialogs attached to it:
    E)THEA.d - Initial dialog
    E)THEAP.d - Post-party dialog (this runs after kicking our NPC from the party)
    E)THEAJ.d - Join-party dialog (this runs while the NPC is in the party)
    Again, note that the name of our dialogs can be at most 8 characters long. You’re free to use any name you want, but it’s a good idea to use your NPC’s name, suffixed by P and J.


    And "Z" dialogue has something to do with Dorn - the answer is in actions that follow the single line:
    SetGlobal("DORN_ROMANCE_FIGHT","GLOBAL",-1)
    SetDialogue("None")
    LeaveParty()
    EscapeArea()
  • lefreutlefreut Member Posts: 1,462
    edited November 2019
    ***
    Post edited by lefreut on
  • chimericchimeric Member Posts: 1,163
    I want to make some changes to NPC in a small area, and the easiest way is to edit it in Near Infinity, removing and adding them as I need to. I added a few actors and moved others around, saved the area in override and also exported it to my mod folder, then installed it together with the creature files. No errors. But in the game nothing has changed in the area, even the coordinates of old NPC. Am I missing something? Or do I have to start a new game and visit the area for the first time to see changes?
  • AstroBryGuyAstroBryGuy Member Posts: 3,437
    chimeric said:

    do I have to start a new game and visit the area for the first time to see changes?

    Bingo!

    When you visit an area for the first time, a copy of the ARE file is attached to your saved game. So any subsequent edits to the base ARE file won't be reflected in your saved game.
  • chimericchimeric Member Posts: 1,163
    A bug is preventing me from starting a new game. Is it possible to edit a saved game to update the ARE there? Just so I can go in the place and see for myself what it looks like, and test the mod? Or, alternatively, load a save from before my first visit there? I think I have one.
  • chimericchimeric Member Posts: 1,163
    Close, but not quite. The color won't end at the second ^. The whole text block is colored, and the ^ is displayed. Looks like I need a different closing tag.
  • chimericchimeric Member Posts: 1,163
    Okay, thanks. I can't be bothered to type questions into a machine when I can turn to living people. Certainly not for a simple question like this.
  • ArdanisArdanis Member Posts: 1,736
    There's a "Save" item in NI's menu list. You can decompress and edit a save there.
  • LavaDelVortelLavaDelVortel Member Posts: 2,859
    You just said that you'd rather bother other people to answe simple questions than just think/check existing threads... Sorry, but I think it makes no sense. If you really must do so with "simple things" then at least start using EXISTING threads rather than starting your own discussions all the time, to ask one question and leave the thread for good. There are threads with tutorials like the one I already provided in my previous message. I think it's a basic rule for most forums - do not create new topics if there are others that already cover the issue.
  • chimericchimeric Member Posts: 1,163
    I think it's a rule I never subscribed to. I don't believe I clutter the boards, I prefer to talk to people instead of sorting through archived maybe-relevant Google results, and I'm going to do this exactly the way I like. But I will take your opinion under advisement.
  • chimericchimeric Member Posts: 1,163
    edited February 2017
    I didn't know it was possible to replace resources there. But now I see that it is. Thanks!

    By the way, what is the best way to rearrange NPC in an area? Replace the ARE and ship it with the mod or put changes in the area script? The second change seems better compatible with other people's mods, but is it possible to remove NPC without script names by means of a script? For example, countless identical guards or gamesmen. I can't issue a command to them to DestroySelf, because they don't have script names. But I need to remove them from the area.

    The main downside of the ARE method seems to be that a player is going to have to start a new game to see the new NPC or not see the old ones.
    Post edited by chimeric on
  • AstroBryGuyAstroBryGuy Member Posts: 3,437
    If you simply ship a replacement ARE you will overwrite any changes made by previous mods.

    Use the ALTER_AREA_ACTOR macro in WeiDU. You could set the flag_time_0 through flag_time_23 parameters to 0 to make the actor never appear. Or, even change the CRE file for the actor.

    http://www.weidu.org/~thebigg/README-WeiDU.html#sec51
  • chimericchimeric Member Posts: 1,163
    edited February 2017
    I'll certainly have a look at that. Hope it's not complicated.

    The moderators put all my topics in a heap here, to keep the boards down to an absolute minimum of topics... whether that makes sense or not. So I'll have to ask about colored text in this thread. The closing tag of @argent77 - ^- works, but strangely. Here is one of the lines in question:

    THEN REPLY ~^0xFF34E2EA [Use Kazaker's system] ^- 100 gold.~

    The idea is that [Use Kazaker's system] will be in yellow letters, and 100 gold in the usual red ones. Instead all I see is

    100 gold.

    In *white* font.
  • chimericchimeric Member Posts: 1,163
    On another issue that I've raised here. The strangeness with cutscenes, in combination with AdvanceTime(?). Here is what I've got at the end of the concluding remark of a conversation with the NPC Kazaker:

    THEN DO ~StartCutScene() SetGlobal("KAZAKER_TEACHES","GLOBAL",1) FadeToColor([0.0],0) Wait(2) AddexperienceParty(200) AdvanceTime(FOUR_HOURS) ActionOverride(LastTalkedToBy("KAZAKER"),JumpToObject("KAZAKER")) FadeFromColor([50.0],0) ApplySpellRES("SYSTEM_#",LastTalkedToBy("KAZAKER")) Wait(1) ActionOverride("KAZAKER",StartDialogueNoSet(LastTalkedToBy(Myself)))~ EXIT

    What this results in is: the weird teleport-away effect still takes place, for some reason the jump doesn't occur, and the NPC doesn't resume the conversation; and the zoom of the game gets locked at the high, cutscene level, even if you start another conversation later. That's just permanent. By the way, I would dearly like my cutscenes without this bird's eye-rise, is there a method?
Sign In or Register to comment.