Skip to content

WeiDU parsing: issue with require_predicate or component

Abdel_AdrianAbdel_Adrian Member Posts: 430
edited June 2015 in General Modding
I'm trying to link certain components with ADD_KIT that are necessary for the custom kit. I'd like to install these components only if the kit was installed, but the way it's set up right now, these files will be added regardless of whether or not the kit was added. I get parsing issues if I try to add lines (i.e. COPY ~whatever~ ~override~) between BEGIN and END of ADD_KIT.
I'm trying something like:

BEGIN ~X~
SUBCOMPONENT ~Y~
REQUIRE_PREDICATE ~Z~

But this is where I'm lost. I don't know how to use REQUIRE_PREDICATE (or COMPONENT) other than for GAME_IS, and I'd really like these components to always install with the kit and not give a choice, seeing as they're necessary for the kit to work.

How do I use WeiDU to check if a component is installed and then automatically install a corresponding component? Thanks!

P.S. I've got Bladesinger and Priestess of Lloth kits complete now, just need to polish them up before release. I really appreciate any help.


Edit: not sure if I got it or not.
I used:
ACTION_IF FILE_EXISTS ~override/EMCLABLL.2da~
THEN BEGIN

I'm just not sure if ADD_KIT adds the custom CLAB file that you indicate the class should use.
Post edited by Abdel_Adrian on

Comments

  • [Deleted User][Deleted User] Posts: 0
    edited June 2015
    The user and all related content has been deleted.
    Post edited by [Deleted User] on
  • Abdel_AdrianAbdel_Adrian Member Posts: 430
    Thanks a ton @subtledoctor , that really helped clear some things up. I'm going to fiddle around a bit with the placing of my ENDs, but I'm definitely liking option 1. It was very easy to work in for my priestess kit, but the bladesinger will be a bit more difficult since it has so many bard - changing components after add kit.
    From what you said before the spoiler though, it seems like all the lines of COPY are already attached to the kit, I just don't think every component is at the moment. I think I can figure it out now.
  • Abdel_AdrianAbdel_Adrian Member Posts: 430
    edited June 2015
    .
  • MusignyMusigny Member Posts: 1,027


    But this is where I'm lost. I don't know how to use REQUIRE_PREDICATE (or COMPONENT) other than for GAME_IS, and I'd really like these components to always install with the kit and not give a choice, seeing as they're necessary for the kit to work.

    I am not 100% sure about what you intend to do but If you want to directly use the REQUIRE_COMPONENT flag, the syntax is the following. Reusing @subtledoctor example:
    BEGIN ~component name~
    REQUIRE_COMPONENT ~relative_path_to/mymod.tp2~ ~320~ ~message if the component cannot be installed~
    See the weidu doc - chapter 9.
  • Abdel_AdrianAbdel_Adrian Member Posts: 430
    Musigny said:


    But this is where I'm lost. I don't know how to use REQUIRE_PREDICATE (or COMPONENT) other than for GAME_IS, and I'd really like these components to always install with the kit and not give a choice, seeing as they're necessary for the kit to work.

    I am not 100% sure about what you intend to do but If you want to directly use the REQUIRE_COMPONENT flag, the syntax is the following. Reusing @subtledoctor example:
    BEGIN ~component name~
    REQUIRE_COMPONENT ~relative_path_to/mymod.tp2~ ~320~ ~message if the component cannot be installed~
    See the weidu doc - chapter 9.
    Thanks. What I intend to do is have a bunch of lines of COPY ~whatever~ ~override~ following the installation of a kit, but to only install if the kit did and to not give the user the option to not install those components, since the kit wouldn't really work then. I think anything of a BEGIN ~component~ nature will give the user the option to not install it, so I'm trying out ACTION_IF FILE_EXISTS ~override/[....CLAB...].2da~
    THEN BEGIN
    I'm going to try placing the COPY lines within ADD_KIT after the last SAY, like subtledoctor suggested, just haven't done so yet, but there are a few more complex lines that may not be as simple.
  • Abdel_AdrianAbdel_Adrian Member Posts: 430
    Actually, placing things before LAF fl#add_kit_ee seems to be the best way to go for me, I really don't even need many ACTION_IFs.
  • [Deleted User][Deleted User] Posts: 0
    edited June 2015
    The user and all related content has been deleted.
  • MusignyMusigny Member Posts: 1,027
    A tp2 component is the code starting with BEGIN and ending when another BEGIN is met (or the end of file).
    If both your kit and the related copied files are in the same component then follow @subtledoctor example, the additional files (your copy commands) will not be installed if the component fails, weidu will rollback every command of that component.
    If for some reasons you want to test the presence of the kit in another component you can either detect a particular file, a preset variable or use a variation of the third example: ACTION_IF or PATCH_IF (MOD_IS_INSTALLED ~relative_path_to/mymod.tp2~ ~component-number as seen in the weidu.log~).
  • Abdel_AdrianAbdel_Adrian Member Posts: 430
    You're totally right @subtledoctor , I think it's just the terminology I'm getting wrong here. I don't want these actions to be a separate component, and I guess they're not within add kit, but rather between the say lines and LAF, which seems to be working, but I see you posted them after the LAF. That's how I had it originally, but I thought those actions were taking place even if the user chose not to install the kit.

    This is what I have right now for one of my kits, I haven't done enough testing to be sure it's doing exactly what I want, but it seems to be installing every part of the kit, all the COPY lines, and the EE functions:
    BEGIN Priestess_of_Lloth
    REQUIRE_PREDICATE GAME_IS ~bgee bg2ee iwdee~ @25

    INCLUDE ~Bladesinger/lib/fl#add_kit_ee.tpa~

    ADD_KIT ~PRIEST_LLOTH~ /* this is the "internal" name of your kit, like BERSERKER or LATHANDER */
    ~PRIEST_LLOTH 0 0 1 1 0 1 0 0~ /* this line is appened to CLASWEAP.2DA */
    ~PRIEST_LLOTH 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~ /* this string is appened column-wise to WEAPPROF.2DA, starting with the third line*/
    ~PRIEST_LLOTH 3 7 6 8 9 8~ /* this line is appened to ABCLASRQ.2DA */
    ~PRIEST_LLOTH 0 1 0 1 0 -2~ /* this line is appened to ABCLSMOD.2DA */
    ~PRIEST_LLOTH 17 17 17 17 0 0~ /* this line is appened to ABDCDSRQ.2DA */
    ~PRIEST_LLOTH 15 15 15 15 0 0~ /* this line is appened to ABDCSCRQ.2DA */
    ~PRIEST_LLOTH 0 0 0 0 0 0 0 0 1~ /* this line is appened to ALIGNMNT.2DA */
    ~PRIEST_LLOTH 0 0 0 0 0 0~ /* this line goes to DUALCLAS.2DA */
    ~Bladesinger/2DA/EMCLABLL.2da~ /* this is the name of your abilities 2DA file, in the style of clabrn02.2da */
    ~K_C_H K_C_D K_C_G K_C_E K_C_HE K_C_HL K_C_HO~ /* These are the 2da files listed in KITTABLE.2DA that you want your kit to be a part of. List as many as you like. */
    ~0x01000000 3~ /* This is the "unusable" value you want for your kit and also the class value. These would normally appear at the end of KITLIST.2DA */
    ~Cl0~ /* This is the High Level Ability Abbreviation (see LUABBR.2DA) Normal values are Fi0, Pa0, etc. */
    ~CHAN09 * HELM07 BAG26 RING06 RING31 * BOOT01 AMUL20 BRAC10 BELT06 AROW11,40 BULL03,40 BOLT06,40 POTN52,5 POTN04,2 POTN14,5 HAMM07 SW1H27 STAF08~
    SAY ~priestess of lloth~
    SAY ~Priestess of Lloth~
    SAY @250

    COPY ~Bladesinger/Spells/EMCDSYM.spl~ ~override~
    COPY ~Bladesinger/Spells/EMLLOTH.spl~ ~override~
    COPY ~Bladesinger/Spells/EMMRES.spl~ ~override~
    COPY ~Bladesinger/Spells/EMVENOM.spl~ ~override~
    COPY ~Bladesinger/Spells/EMWEB.spl~ ~override~
    COPY ~Bladesinger/ITM/EMLLOTH.itm~ ~override~ // Holy Symbol of Lloth
    SAY NAME1 ~~
    SAY NAME2 @136
    SAY UNIDENTIFIED_DESC ~~
    SAY DESC @137

    ACTION_IF GAME_IS ~bgee~
    THEN BEGIN

    COPY ~Bladesinger/Spells/EMSPCLL1.spl~ ~override~
    COPY ~Bladesinger/Spells/EMSPCLL2.spl~ ~override~

    END

    ACTION_IF GAME_IS ~bg2ee~
    THEN BEGIN

    COPY ~Bladesinger/Spells2/EMSPCLL1.spl~ ~override~
    COPY ~Bladesinger/Spells2/EMSPCLL2.spl~ ~override~

    END

    LAF fl#add_kit_ee
    INT_VAR
    biography = ~-1~
    briefdesc = 31255 // Normal briefdesc for clerics
    fallen = 0
    fallen_notice = ~-1~
    STR_VAR
    kit_name = PRIEST_LLOTH
    clswpbon = ~0 0 3~
    numwslot = ~2~
    clascolr = ~25 83 66 28 23~
    clasiskl = ~0 0 0 0 0 0 0~
    clasthac = ~0~
    thiefscl = ~0 0 0 0 0 0 0 0~
    hpclass = ~HPPRS~
    clsrcreq = ~0 1 0 0 0 0 0~

    END

Sign In or Register to comment.