Jump to content
Sign in to follow this  

Copying multiple files from mod folder to game folder

Recommended Posts

I've crafted a mod to add the twelve additional soundset from IWD2 into IWD1, including the subtitles. Testing seems to work, with one important exception. The sound folders are created, the Charstr.2da updates with the new soundset names and strings, but the .wav files aren't copying to the new folders. Since each soundset has 40 files, I want to copy them all with a single .tp2 command line from the mod subdirectory to the game Sound directory.


Each soundset installs separately, so the mod has twelve components.


What I've found so far is that COPY and COPY_EXISTING_REGEXP aren't working as I've coded them, and to use a basic DOS command line I'd have to call an external batch file like Kulyok did with her IWDNPC mod (which is the template for my coding). My coding skills aren't very good, and the WeiDU readme is a little difficult to work through in this case for me.


This was my last attempt at coding:

COPY_EXISTING_REGEXP ~IWD2_Sounds_for_IWD1\Sounds\Female_Barbarian_1\2BFF.*.wav~ ~override~
MOVE (~override~ ~^[2BFF].*\.wav$~) ~Sounds\FEMALE_BARBARIAN_1~

Seems COPY_EXISTING_REGEXP looks at the CHITIN.KEY file, doesn't find it, and faults out.


Anyone willing to get me going the the right direction?

Share this post

Link to post

I use a modified manual version -



BEGIN @30014   // installing oneunique forced subcomponent of several
    FORCED_SUBCOMPONENT @30011 // the master set of options
    REQUIRE_COMPONENT ~setup-aranw.tp2~ ~0~ @30017 // only if the mod is installed
    COPY ~aranw/media/g3blank.mus~         ~music~   // you have other ways of doing this
    COPY_EXISTING ~songlist.2da~         ~override~ // you have other ways of doing this
        SET_2DA_ENTRY 0 2 3 ~g3blank.mus~ // you have other ways of doing this

    LAUNCH_ACTION_MACRO ~chooseasoundtrack~ // just changes what these files are based on user choice, renaming unique files to a generic
    ACTION_CLEAR_ARRAY    ~sounds~
    ACTION_DEFINE_ARRAY ~sounds~ BEGIN // list of all the sounds to be dealt with
    /* look for the resulting .wavc files and copy them into the game */
    ACTION_PHP_EACH ~sounds~ AS ~index~ => ~sound~ BEGIN
            COPY ~aranw/media/wavc/%sound%.wav~ ~override~
    PRINT @30009 // yep, we installed 'em

Share this post

Link to post

cmorgan's way should work, but there are a couple of other options.


If you arrange your mod so that each soundset is placed in a separate folder, you can perform a COPY on the folder, which will copy each item in the folder to the specified destination.

MAKE_DIR ~sounds~ // ensure directory exists

COPY ~IWD2_Sounds_for_IWD1\Sounds\Female_Barbarian_1~ ~sounds~

If you don't want to copy all of the files from a folder and you don't want to hardcode a list of specific files, you can use ACTION_BASH_FOR to filter the list of files in a directory via regular expression.

MAKE_DIR ~sounds~ // ensure directory exists

ACTION_BASH_FOR ~IWD2_Sounds_for_IWD1\Sounds\Female_Barbarian_1~ ~^2BFF.*\.wav$~ BEGIN

Share this post

Link to post

@cmorgan - Too complicated for me. And I'm also dealing with character soundsets, not music.


@Mike1082 - So simple with the COPY command, and it works. When I first tried it I had to screw it up with trying to copy the files too much like DOS. Thanks bunches.


Now I found another problem, this time with the CHARSTR.2DA file. FEMALE_BARBARIAN_1 and MALE_BARBARIAN_1 are two soundsets for example. If I install the female soundsets first, the male soundsets won't appear, but if I install the male soundsets first both show up.


I'd like to keep it with each soundset installed individually, but this may require a complete single install instead. Any ideas what causes this problem, and how to fix it. My mod appears fully functional but for this one issue.

Share this post

Link to post

Jarno, I suspect it's because they start with MALE_ and FEMALE_, and if the female is installed first WeiDU sees (fe)male and fails to update the .2DA. More than that I can't say. Here's the section that deals with the problem.

APPEND ~charstr.2da~ ~Male_Barbarian_1 2BFM001 2BFM002 2BFM003 2BFM004 2BFM005 2BFM006 2BFM007 2BFM008 2BFM009 2BFM010 2BFM011 2BFM012 2BFM013 2BFM014 2BFM015 2BFM016 2BFM017 2BFM018 2BFM019 2BFM020 2BFM021 2BFM022 2BFM023 2BFM024 2BFM025 2BFM026 2BFM027 2BFM028 2BFM029 2BFM030 2BFM031 2BFM032 2BFM033 2BFM034 2BFM035 2BFM036 2BFM037 2BFM038 2BFM039 2BFM040~
UNLESS ~Male_Barbarian_1~
COPY_EXISTING ~charstr.2da~ ~override~
/* Male_Barbarian_1 */
REPLACE 2BFM001 @280

I have thought about it, though, and have a workable solution - installing the male and female sets for the barbarian, bard, drow, half-orc, monk and sorcerer in pairs. This way I can keep the naming conventions of the two games without worry that someone will install the female soundset first and not have the male soundset subtitles.


I'll finish the mod up, then ask to have it hosted here, either in the Miscellaneous Mods or Icewind Dale Mods forum.

Share this post

Link to post

Your suspicions are correct. Having UNLESS ~Male_Barbarian_1~ prevents the APPEND from occurring if the file contains Male_Barbarian_1 anywhere, including cases like Male_Barbarian_10 or Female_Barbarian_1.


You can fix this by changing the UNLESS to be more strict. I suggest UNLESS ~^Male_Barbarian_1[ %TAB%]~. That will only prevent the APPEND when the file contains a line that starts with Male_Barbarian_1 and is followed by a space or tab.

Share this post

Link to post

@Mike1072 - Thank you very much. That did the trick. That makes two lessons learned in WeiDU coding. Now all I need to do is do a quick check that they read properly in game, then make my submission and request.

Share this post

Link to post
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...