Jump to content

BG2 Kit Creation: Additional WeiDU Functions


Recommended Posts

OK, so far we've covered what's generally possible in kit creation, the files involved, and creating a basic WeiDU installer and the ADD_KIT command. However, there's still a lot more that needs to be done to install your kit. What about adding spells and items? Interacting with other mods? Assigning a kit to a creature? That's what we're going to cover in this fourth and final installment. I'm going to cover some basic commands and flags/options; I refer the reader to the WeiDU readme for additional WeiDU tricks, commands, and options.

Basic file transfers: the COPY command

COPY is one of the most basic commands to transfer files. Syntax, and likely options you will need, is:

COPY ~MyMod/MySpell.spl~ ~override~
  SAY NAME1 ~General Name~ // unidentified name for items OR spell name
  SAY NAME2 ~Identified Name~ // identified name for items; not used for spells
  SAY UNIDENTIFIED_DESC ~Unidentified Description~ // unidentified description for items, spell description for spells
  SAY DESC ~Identified Description~ // identified description for items, unused for spells

The COPY command takes your file and moves it, in this example, to the override folder, making it accessible to the game. The SAY commands are optional; they set the strings in dialog.tlk for your item or spell. When creating your items or spells for the kit, don't bother adding the strings to dialog.tlk--WeiDU does it automatically and in an uninstallable fashion. The four SAY commands are all optional, so include the SAYs that you need. COPY can also be used for multiple files, either by copying a directory (in his example, the folder named bams inside the MyMod folder)

COPY ~MyMod/bams~ ~override~

or by specifying more than one file with COPY

COPY ~MyMod/bam1.bam~ ~override~
     ~MyMod/bam2.bam~ ~override~
     ~MyMod/eff1.bam~ ~override~

SAY can be used in conjunction with a multiple file COPY; however the SAY will apply to every file copied with the function.

Using COPY and COPY_EXISTING to assign a kit to a creature

Assigning a kit to a creature is more difficult tha it seems. Creature files (.CRE) use the kit number from KITLIST.2da to determine their kit. However, depending if the player has more than one kit mod installed, the reference will change. So, you need assign the kit at the time of installation. If you're adding a new creature and want it to have the new kit, you could use

COPY ~Delainy/cre/C!DELA10.cre~ ~override/C!DELA10.cre~ // Level 10 Delainy
  SAY NAME1 ~Delainy~
  SAY NAME2 ~Delainy~
  WRITE_SHORT 0x244 0 // doesn't change
  WRITE_SHORT 0x246 0x4000 + ~%C!WWBARD%~ // the internal name of your kit, surrounded by %

This is code I use to assign the C!WWBARD kit to Delainy. If you want to assign a kit to an existing creature, for example assigning Viconia a Nightcloak of Shar kit, you can use COPY_EXISTING. COPY_EXISTING is similar to COPY, except that it searches for the file in game and makes the changes you specify to it. It can also take multiple souce and destination files, similar to COPY.

COPY_EXISTING ~Viconi6.cre~ ~override~
              ~Viconi8.cre~ ~override~
              ~Viconi9.cre~ ~override~
              ~Viconi11.cre~ ~override~
              ~Viconi13.cre~ ~override~
              ~Viconi16.cre~ ~override~ // ToB only, see below on ACTION_IF
  WRITE_SHORT 0x244 0 // doesn't change
  WRITE_SHORT 0x246 0x4000 + ~%A#SHAR%~ // the internal name of your kit, surrounded by %

Viconia has multiple CRE files depending on the level she spawns, so this code will patch all of them. However, this is bad code: if you use COPY_EXISTING and WeiDU can not find the file specified, installation will fail. In the example above, Viconi16.cre is a ToB-only file, so using this code on an SoA-only install will cause it to fail. The solution to that is our next command, ACTION_IF.

Conditional installations: using ACTION_IF for detection

ACTION_IF is a great way to make your mod compatible with other mods and to avoid problems with SoA-only installs. ACTION_IF is essentially a list of WeiDU commands that only occur if a certain condition is met. Syntax is as follows:

ACTION_IF FILE_EXISTS_IN_GAME ~item.itm~ THEN BEGIN
  (WeiDU commands such as COPY if the condition is true)
END
ELSE BEGIN // the ELSE clause is entirely optional
  (WeiDU commands such as COPY if the condition is false)
END

There are conditions other than FILE_EXISTS_IN_GAME (again, check the WeiDU docs). One task that is directly applicable to kit-making is to only copy over HLA spells if ToB is installed. To do that, you can use the condition GAME_INCLUDES ~tob~.

To fix the bad Viconia example from above, you use this instead (note that only the Viconi16.cre patch is conditional; all other files are always patched since they are not inside the ACTION_IF):

COPY_EXISTING ~Viconi6.cre~ ~override~
              ~Viconi8.cre~ ~override~
              ~Viconi9.cre~ ~override~
              ~Viconi11.cre~ ~override~
              ~Viconi13.cre~ ~override~ // Viconi16.cre has moved to the ACTION_IF, below
  WRITE_SHORT 0x244 0 // doesn't change
  WRITE_SHORT 0x246 0x4000 + ~%A#SHAR%~ // the internal name of your kit, surrounded by %

ACTION_IF FILE_EXISTS_IN_GAME ~Viconi16.cre~ THEN BEGIN
  COPY_EXISTING ~Viconi16.cre~ ~override~ // ToB only
    WRITE_SHORT 0x244 0 // doesn't change
    WRITE_SHORT 0x246 0x4000 + ~%A#SHAR%~ // the internal name of your kit, surrounded by %
END

Any WeiDU command can be used inside an ACTION_IF, including ADD_KIT. Two popular mods that affect classes and kits in general are Ghreyfain's Ashes of Embers (universal weapons, aka CLERICS WITH SWORDS) and aVENGER's Rogue Rebalancing (thieves get 3 stars in dual-wielding). You can use ACTION_IF to detect if they're installed and modify the kit accordingly. For example, here's the same Silverstar of Selûne kit of Cleric Remix that we used in part three, as it appears in the tp2. I include a check for ~bola01.itm~, an item added by AoE.

ACTION_IF FILE_EXISTS_IN_GAME ~bola01.itm~ THEN BEGIN // if Ashes of Embers is installed
  ADD_KIT ~C!Selune~
     ~C!Selune                1           1           1           1           1           1           1           1~ // no weapon restrictions
     ~C!Selune 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1~ // no weapon restrictions
     ~C!Selune                0       0       0       0       9       0~
     ~C!Selune                0       0       0       0       0       0~
     ~C!Selune                0       0       0       0       17      0~
     ~C!Selune                0       0       0       0       15      0~
     ~C!Selune                0       0       0       1       0       0       1       1       0~
     ~C!Selune                1       0       1       1       0       1~
     ~Cleric_Remix/Selune/C!Selune.2da~
     ~K_C_D K_C_E K_C_G K_C_H K_C_HE K_C_HL K_C_HO~
     ~0x00004000     3~
     ~C!3~
     ~CHAN09 * HELM07 BAG20 RING06 RING31 * BOOT01 AMUL19 BRAC16 BELT06 AROW11,40 BULL03,40 BOLT06,40 POTN52,5 POTN4,2 POTN14,5 HAM07 SW1H27 STAF08~
     SAY ~Silverstar of Selûne~
     SAY ~Silverstar of Selûne~
     SAY ~SILVERSTAR OF SELÛNE: Description cut due to length~
END
ELSE BEGIN // if Ashes of Embers is NOT installed
  ADD_KIT ~C!Selune~
    ~C!Selune                0           0           1           1           0           1           0           0~ // normal weapon restrictions
    ~C!Selune 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0~ // normal weapon restrictions
    ~C!Selune                0       0       0       0       9       0~
    ~C!Selune                0       0       0       0       0       0~
    ~C!Selune                0       0       0       0       17      0~
    ~C!Selune                0       0       0       0       15      0~
    ~C!Selune                0       0       0       1       0       0       1       1       0~
    ~C!Selune                1       0       1       1       0       1~
    ~Cleric_Remix/Selune/C!Selune.2da~
    ~K_C_D K_C_E K_C_G K_C_H K_C_HE K_C_HL K_C_HO~
    ~0x00004000     3~
    ~C!3~
    ~CHAN09 * HELM07 BAG20 RING06 RING31 * BOOT01 AMUL19 BRAC16 BELT06 AROW11,40 BULL03,40 BOLT06,40 POTN52,5 POTN4,2 POTN14,5 HAM07 SW1H27 STAF08~
    SAY ~Silverstar of Selûne~
    SAY ~Silverstar of Selûne~
    SAY ~SILVERSTAR OF SELÛNE: Description cut due to length~
END

If AoE is installed, you'll notice that the kit now allows proficiencies in all weapons, matching the changes made by AoE. If AoE is not present, then the kit has the typical proficiency set of a cleric. The same could be used for thief kits and Rogue Rebalancing--by checking for an item only added by Rogue Rebalancing, you could install a thief kit with one or three stars in dual-wielding, as appropriate.

Summary

I've tried to cover the majority of Kit creation and installation with this tutorial series, but there will inevitably be areas I have missed or additional questions to be asked. As such, please refer to the kit creation series discussion thread here at The Gibberlings Three and we will do our best to answer your questions.

Complete Series

Edited by Mike1072
Link to comment
Guest
This topic is now closed to further replies.
×
×
  • Create New...