Help me edit the mk_pre_crafting.NCS file, how to open it?

I want to combine two modifications, but one uses a fairly old version of the mk_pre_crafting.NCS file, I want to combine it with the new version of this file. Tried to rename the extension to .NSS and edit as a script in the editor, but this did not help, instead of the content in the file there is nothing… What to do? Thanks.

I’m not a programmer! Help me figure out how to work with this Decompiler on Python?!

I downloaded and installed Python 2.7 for Windows 10! I have a file mk_pre_crafting. NCS, what to do next with this program?

The author of the Decompiler wrote

to run (Python 2.7): python 'NCS Decompile.py' -n path/to/nwscript.nss < path/to/input.ncs > path/to/output. nss

How does this work? Should I create some folders? Where to copy my file?

The ncs file is a compiled script. You need the source file, in your case the “mk_pre_crafting.nss”.

If you tell me more about the other mod you want to merge the CCOH with and about the version no of the CCOH you’re talking about perhaps I can give you the nss file you’re looking for.

I want to combine a Musical Harp that allows you to change the music from the ZZ Dialog modification with the CCOH 6.2 and ACP 4.0 files.

https://neverwintervault.org/project/nwn1/script/zz-dialog-166

I tried to merge the files of all modifications, but left mk_pre_crafting.NCS from CCOH 6.2, instead of the ZZ Dialog file, but then the Musical Harp does not work!

Also, please help me calculate only those ZZ Dialog files that are involved in the work of the Musical Harp! Thanks! Need professional help!

Still I do not know what you want to do. The zz dialog is library for writing dynamic dialogs but where is the musical harp?

The 6.2 mk_pre_crafting.nss is the the erf file you should find somewhere in the downloaded CCOH zip file.

Here is the harp in the presentation module of the ZZ Dialog system!

So you want to add the dialog you get when using the harp incorporate into the crafting dialog?

1 Like

Yes, what resources from this modification do I need to use in my modification build?

I don’t know the zz dialog system (I know it’s similar to what I’m doing in the CCOH but that’s all) so can’t help you with that.

But as a first step I would modify the example module so that harp and the tag based script call is replaced by a placeable with an OnUsed script and a dialog. Make this work as it should and then export the dialog and you should get also all the files needed.

As final step you shoud call that dialog from the CCOH dialog. No need to modify the mk_pre_crafting.nss then (unless you want to show the dialog call only when the harp mod is installed - then you have to somehow detect the installation, similar to what I did with the ACP).

In the presentation module ZZ Dialog, the subject of the Musical Harp initialized the selection of the desired dialog file for the token-based dialog, which is the basis of the entire system. Information about how exactly the harp initializes the desired dialog, I assume, is embedded in the mk_pre_crafting.NCS file. How do I find out which local variables or something else trigger exactly the desired dialog with music?

I want this music change function to always be available to the character through the item creation menu, is this possible? I will never write this system myself :disappointed_relieved:

Without at least some basic knowledge of scripting it’s hard to do what you want to do (unless you somehow get the source of that old modified mk_pre_crafting.nss file). However it’s not so difficult to redo what that old mod did:

Just open the demo module in the toolset, take a look at the zzdlg_item.nss script. That’s the script that is called when you use the harp. This script reads some variables from the harp and then calls the zz dialog system. Examine the harp in the toolset to get these variables. Most important variable of course is the dialog script name variable “dialog”:

dialog: dlg_music
makeprivate 1
nohello 1
nozoom 1

So to start the dialog you would have to make a script that calls

_dlgStart(GetPCSpeaker(), GetPCSpeaker(), “dlg_music”, TRUE, TRUE, TRUE);

That script has to include “zzdlg_tools_inc”.

Now take a look the at the CCOH x0_skill_ctrap.dlg file. Add a line after “Choose your fightiing style (ACP 4.0) …”, name it “Musical Harp” of what ever and add your script under “Actions Taken”.

As for the required files: export the dlg_music script and the zzdlg_conv dialog (the latter should add all the required other zz dialog scripts).

That should do more or less what you want. Perhaps some more work required but the rest shouldn’t be too hard to figure out by yourself.

1 Like

Thank you, but I’m still not a complete zero in the NWN scripting, I already guessed everything that you wrote to me above…

I added a line to the item crafting dialog, connected a zzdlg_item script to it, which I changed as follows…

Script zzdlg_item:

#include "zzdlg_tools_inc"

// Note: OBJECT_SELF is neither the item nor the player!
void main()
{
    //object oPlayer = GetItemActivator( );
    //object oItem = GetItemActivated( );

    object oPlayer = GetPCSpeaker( );
    object oItem = GetPCSpeaker( );

    //if ( GetIsPC(oPlayer) == FALSE) return;// || GetIsObjectValid(oItem) == FALSE ) return;

    // Get dialog script name from item.
    string sScript = "dlg_music";
    //if ( sScript == "" ) return;

    // Gets extra parameters from item.
    int iMakeprivate = 1;
    int iNoHello = 1;
    int iNoZoom = 1;

    // Start the dialog between the item and the player
    _dlgStart( oPlayer, oItem, sScript, iMakeprivate, iNoHello, iNoZoom );
}


… but after doing all this, I eventually got an empty dialog… What could be the reason for this? Why does the ZZ system not generate dlg_music?

Unfortunately in screenshot I can’t see the scripts so I have to ask: does the module contain the dlg_music script and all the other zz dialog scripts?

Yes, I imported the entire ZZ modification into it.

I am confused by this mark on the margins of the zzdlg_item script from the author …

// Note: OBJECT_SELF is neither the item nor the player!

I guess that note is related to the context where the script runs in the example. And in that context OBJECT_SELF is neither the player nor the item but (I’m not a builder so I can guess only) the module itself. However in your case OBJECT_SELF is the player as it’s the player talking to himself.

You’ve imported the entire ZZ modification AND also the dlg_music script?

Perhaps it’s easiest if you upload what you have somewhere and then I can take a look?

https://drive.google.com/file/d/15TUbXj0UuM8AJPZIa8DSYaf2USEDm47z/view?usp=sharing

As I’ve said, I don’t know much about zz dialog but the reason why there are no dialog options is that

_dlgGetDlgResponseCount() always returns 0 when it’s called within _SetupDlgResponse() and when ResponseCount is 0 then of course no options are displayed. So the question is why it’s 0 and how to change that. To answer that question however I have no time unfortunately at the moment.

1 Like

I hope for your help, maestro!

Seems to me that zz dialog has a problem with self conversations. When calling

void _dlgStart( object oSpeaker, object oThis = OBJECT_SELF, string sDlgScript = “”, int iMakePrivate = 0, int iNoHello = 0, int iNoZoom = 0 )

oSpeaker and oThis are not meant to be the same because somewhere in the code oSpeaker and oThis being the same is used as a work-around for speaking with items. But also oThis can’t be OBJECT_INVALID.

As a work-around you have to add the following line to the zzdlg_item script somewhere after the two objects are defined and before _dlgStart() is called:

SetLocalObject( oPlayer, DLG_ITEM, oItem );

That should fix the problem. Not sure if that’s the best solution but it seems to work.

1 Like