Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Axis & Allies 1942 Online is now available in Early Access! Buy it on Steam. The FAQ is available.
New Premium Module: Tyrants of the Moonsea! Read More
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

Druids using bows - need help

ArdulArdul Member Posts: 205
Hello everyone,

I like to tinker a bit with modding and make some edits to some of the mods I am using. One of the things I would like to do, is removing the item usability restrictions on bows from druids. I am writing about it here, in the hope that somebody could cook up the few lines of code needed to make bows useable by druids?

Thanks!

Comments

  • sarevok57sarevok57 Member Posts: 4,630
    if you have NI infinity im pretty sure you can make it happen

    first, you need to go into all the bow files in the .ITM folder

    coincidentally all the bows are marked with BOWxx.ITM

    so they are pretty easy to find

    once you find the bow files you can select each one and press the "Edit" tab and then unselect all the boxes that have druid in the name

    next, you need to adjust some .2da files ( which is in the 2DA folder up top )

    and you will need to adjust the WEAPPROF.2da so that all druids can at least become proficient in bows and make it so fighter druids can specialize in them ( aka highlighting line 6, and replacing 0s with 1s for the druid and druid class kits, and replacing the 0 with 2 for fighter/druid

    now, this will work perfectly for bg1ee

    if you want this to work for bg2ee as well, you can make things a little easier by copy pasting your now "overwritten files" ( which will be in your override folder and there should be things like; BOW01.itm, BOW02.itm, BOW03.itm, WEAPPROF.2da, ect ) from your bg1 over ride folder into your bg2 over ride folder, and now half the work is done

    for bg2, all you have to do now is make all the bows that werent in bg1 usable by your druid using the above step of going into edit and unselecting all the boxes with druid in the name

    and if you want this to go into IWD as well, take your BG1 over ride files ( since IWD has more similarities with bg1, and then like bg2 go into the IWD bow files and edit the bows that arent in bg1 )

    and voila, if everything is done correctly, you should now be able to have druids use bows in all 3 games and even get some proficiency out of them as well

    OrlonKronsteen
  • RaduzielRaduziel Member Posts: 4,598
    edited October 9
    I wrote this piece of code, but I have no idea why it is only affecting Longbows and ignoring Shortbows.

    Also, IDK how to allow Druids to equip arrows - ATM they can't. I've run this mod in IWDEE for purpose of testing.

    If someone else can take a look and say what I'm missing, I appreciate.
    BACKUP ~Test/Backup~
    SUPPORT ~Raduziel www.twitter.com/raduziel~
    VERSION ~0.1~
    
    BEGIN ~Bows for Druids~
    
    COPY_EXISTING_REGEXP ~.*\.itm~ override
    	READ_BYTE 0x31 proficiency
    	PATCH_MATCH proficiency WITH 
    		104 105 BEGIN
    	PATCH_IF (SOURCE_SIZE > 0x71)     BEGIN
    		READ_LONG	0x64	       ex_off
    		READ_SHORT	0x68	       glob_ex
    		FOR	(j = 0; j < glob_ex; ++j)	BEGIN
    			READ_SHORT (ex_off + (j * 0x38) + 0x0002) location
    			PATCH_IF location = 1 BEGIN
    			WRITE_BYTE 0x21 (THIS BAND 0b10111111)
    			WRITE_BYTE 0x1f (THIS BAND 0b11101111) 
    			SET j = glob_ex
    			END
    		END
    	END
    END
    DEFAULT
    END
    BUT_ONLY
    
    COPY_EXISTING ~WEAPPROF.2DA~ override
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 5  10  ~1~ //Druid
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 27 10  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 28 10  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 5  19  ~2~ //Fighter/Druid
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 27 19  ~2~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 28 19  ~2~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 5  45  ~1~ //Totemic Druid
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 27 45  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 28 45  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 5  46  ~1~ //Shapeshifter
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 27 46  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 28 46  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 5  47  ~1~ //Avenger
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 27 47  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 28 47  ~1~
    SET_2DA_ENTRIES_NOW ~RAWEAPPROF~ 1
    PRETTY_PRINT_2DA
    BUT_ONLY_IF_IT_CHANGES
    
    //EoF
    

  • sarevok57sarevok57 Member Posts: 4,630
    unfortunately cant help much with @Raduziel code up above ( that looks way too intense and out of my league for me, perhaps its the ex_off and glob_ex or READ_SHORT (ex_off + (j * 0x38) + 0x0002) location throwing it off? )

    but if you do it my way, i forgot to mention that ( Raduziel reminded me ) you will also have to change the arrows as well to make them usable by druids by again going to the edit tab and unselecting the correct box ( they are also easy to find in the .ITM folder because their item names are under ARROWxx.itm )

    luckily bg1 has the most arrows so you can export all of your arrow over rides to SoA and IWD and then just have to do the odd arrow editing for SoA and IWD afterwards

  • kjeronkjeron Member Posts: 2,038
    Due to the addition of the Shaman class, all items usable by one but not the other now carry an op319 effect to disallow the item instead of using the Druid class flag.
    Longbows aren't usable by either, so unchecking the class flag is enough.
    Arrows and Shortbows are usable by Shamans, so it needs a different approach.
    ...
    	PATCH_MATCH proficiency WITH 
    		104 105 BEGIN
    			LPF DELETE_EFFECT match_opcode = 319 match_parameter1 = 11 match_parameter2 = 5 END
    ...
    

    Raduzielartificial_sunlight
  • RaduzielRaduziel Member Posts: 4,598
    @kjeron Weidu is chocking after adding this line.
    BACKUP ~Test/Backup~
    SUPPORT ~Raduziel www.twitter.com/raduziel~
    VERSION ~0.1~
    
    BEGIN ~Bows for Druids~
    
    COPY_EXISTING_REGEXP ~.*\.itm~ override
    	READ_BYTE 0x31 proficiency
    	PATCH_MATCH proficiency WITH 
    		104 105 BEGIN
    		PATCH_IF (SOURCE_SIZE > 0x71)  BEGIN
    		LPF DELETE_EFFECT match_opcode = 319 match_parameter1 = 11 match_parameter2 = 5 END
    		READ_LONG	0x64 ex_off
    		READ_SHORT	0x68 glob_ex
    		FOR	(j = 0; j < glob_ex; ++j)	BEGIN
    			READ_SHORT (ex_off + (j * 0x38) + 0x0002) location
    			PATCH_IF location = 1 BEGIN
    			WRITE_BYTE 0x21 (THIS BAND 0b10111111)
    			WRITE_BYTE 0x1f (THIS BAND 0b11101111) 
    			SET j = glob_ex
    			END
    		END
    	END
    END
    DEFAULT
    END
    BUT_ONLY
    
    COPY_EXISTING ~WEAPPROF.2DA~ override
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 5  10  ~1~ //Druid
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 27 10  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 28 10  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 5  19  ~2~ //Fighter/Druid
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 27 19  ~2~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 28 19  ~2~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 5  45  ~1~ //Totemic Druid
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 27 45  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 28 45  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 5  46  ~1~ //Shapeshifter
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 27 46  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 28 46  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 5  47  ~1~ //Avenger
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 27 47  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 28 47  ~1~
    SET_2DA_ENTRIES_NOW ~RAWEAPPROF~ 1
    PRETTY_PRINT_2DA
    BUT_ONLY_IF_IT_CHANGES
    
    //EoF
    

  • GwendolyneGwendolyne Member Posts: 261
  • subtledoctorsubtledoctor Member Posts: 11,211
    edited October 9
    Something like
    COPY_EXISTING_REGEXP GLOB ~.*\.itm$~ ~override~
        PATCH_IF (SOURCE_SIZE > 0x71) BEGIN
          READ_BYTE  0x1e mdruid
          READ_BYTE  0x21 druid 
          READ_SHORT  0x1c type 
          READ_BYTE  0x31 prof 
          PATCH_IF (type = 15 || type = 5 || prof = 104 || prof = 105) BEGIN
            WRITE_BYTE 0x1e (mdruid BAND 0b10111111)
            WRITE_BYTE 0x21 (druid BAND 0b11101111)
            LPF DELETE_EFFECT INT_VAR match_opcode = 319 match_parameter1 = 11 match_timing = 2 END
            LPF DELETE_EFFECT INT_VAR match_opcode = 319 match_parameter1 = 16 match_timing = 2 END
          END
        END
      BUT_ONLY
      COPY_EXISTING ~kitlist.2da~ ~override~
        READ_2DA_ENTRIES_NOW ~r2en_kitlist~ 10
        FOR (row = 2; row < r2en_kitlist; row += 1) BEGIN
          READ_2DA_ENTRY_FORMER ~r2en_kitlist~ row 6 prof_col
          READ_2DA_ENTRY_FORMER ~r2en_kitlist~ row 8 class_num
          PATCH_IF (class_num == 11) OR (class_num == 16) BEGIN
            DEFINE_ASSOCIATIVE_ARRAY druid_kits_array BEGIN "%prof_col%" => "%class_num%" END
          END
        END
      BUT_ONLY
      COPY_EXISTING ~weapprof.2da~ ~override~
        COUNT_2DA_COLS cols
        SET_2DA_ENTRY 24 9 cols 1  // longbow
        SET_2DA_ENTRY 25 9 cols 1  // shortbow
        PHP_EACH druid_kits_array AS kit_col => class BEGIN
          SET_2DA_ENTRY 24 (%kit_col% + 1) cols 1  // longbow
          SET_2DA_ENTRY 25 (%kit_col% + 1) cols 1  // shortbow
        END
      BUT_ONLY
    

    Raduzielartificial_sunlight
  • RaduzielRaduziel Member Posts: 4,598
    edited October 9
    Taking a piece of @subtledoctor's code I was able to remove the restriction for both longbows and shortbows. No luck with arrows yet, though.
    BACKUP ~Test/Backup~
    SUPPORT ~Raduziel www.twitter.com/raduziel~
    VERSION ~0.2~
    
    BEGIN ~Bows for Druids~
    
    COPY_EXISTING_REGEXP ~.*\.itm~ override
    	READ_BYTE 0x31 proficiency
    	PATCH_MATCH proficiency WITH 
    		104 105 BEGIN
    		LPF DELETE_EFFECT INT_VAR match_opcode = 319 match_parameter1 = 11 match_timing = 2 END
            LPF DELETE_EFFECT INT_VAR match_opcode = 319 match_parameter1 = 16 match_timing = 2 END
    		PATCH_IF (SOURCE_SIZE > 0x71)  BEGIN
    		READ_LONG	0x64 ex_off
    		READ_SHORT	0x68 glob_ex
    		FOR	(j = 0; j < glob_ex; ++j)	BEGIN
    			READ_SHORT (ex_off + (j * 0x38) + 0x0002) location
    			PATCH_IF location = 1 BEGIN
    			WRITE_BYTE 0x21 (THIS BAND 0b10111111)
    			WRITE_BYTE 0x1f (THIS BAND 0b11101111) 
    			SET j = glob_ex
    			END
    		END
    	END
    END
    DEFAULT
    END
    BUT_ONLY
    
    COPY_EXISTING ~WEAPPROF.2DA~ override
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 5  10  ~1~ //Druid
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 27 10  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 28 10  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 5  19  ~2~ //Fighter/Druid
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 27 19  ~2~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 28 19  ~2~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 5  45  ~1~ //Totemic Druid
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 27 45  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 28 45  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 5  46  ~1~ //Shapeshifter
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 27 46  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 28 46  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 5  47  ~1~ //Avenger
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 27 47  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 28 47  ~1~
    SET_2DA_ENTRIES_NOW ~RAWEAPPROF~ 1
    PRETTY_PRINT_2DA
    BUT_ONLY_IF_IT_CHANGES
    
    //EoF
    

    artificial_sunlight
  • ArdulArdul Member Posts: 205
    Hey @subtledoctor that worked for arrows and short bows, but not for long bows and composite bows for some reason.

  • ArdulArdul Member Posts: 205
    And thanks to everyone else who are trying to come up with some solutions - it is really appreciated!

  • ArdulArdul Member Posts: 205
    @Raduziel you guys are getting close then :smile: . Subtledoctors code did also make arrows useable.

  • RaduzielRaduziel Member Posts: 4,598
    I think I know what to do, gimme a second.

  • RaduzielRaduziel Member Posts: 4,598
    edited October 9
    @Ardul

    Nailed it.
    BACKUP ~BowsForDruids/Backup~
    SUPPORT ~Raduziel www.twitter.com/raduziel~
    VERSION ~0.3~
    
    BEGIN ~Bows for Druids~
    
    COPY_EXISTING_REGEXP ~.*\.itm~ override
    	READ_BYTE  0x31 proficiency
    	READ_SHORT 0x1c type
    	PATCH_IF (type = 5 OR proficiency = 104 OR proficiency = 105) BEGIN
    		LPF DELETE_EFFECT INT_VAR match_opcode = 319 match_parameter1 = 11 match_timing = 2 END
           		LPF DELETE_EFFECT INT_VAR match_opcode = 319 match_parameter1 = 16 match_timing = 2 END
    		PATCH_IF (SOURCE_SIZE > 0x71)  BEGIN
    		READ_LONG	0x64 ex_off
    		READ_SHORT	0x68 glob_ex
    		FOR	(j = 0; j < glob_ex; ++j)	BEGIN
    			READ_SHORT (ex_off + (j * 0x38) + 0x0002) location
    			PATCH_IF location = 1 BEGIN
    			WRITE_BYTE 0x21 (THIS BAND 0b10111111)
    			WRITE_BYTE 0x1f (THIS BAND 0b11101111) 
    			SET j = glob_ex
    			END
    		END
    	END
    END
    BUT_ONLY
    
    COPY_EXISTING ~WEAPPROF.2DA~ override
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 5  10  ~1~ //Druid
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 27 10  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 28 10  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 5  19  ~2~ //Fighter/Druid
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 27 19  ~2~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 28 19  ~2~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 5  45  ~1~ //Totemic Druid
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 27 45  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 28 45  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 5  46  ~1~ //Shapeshifter
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 27 46  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 28 46  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 5  47  ~1~ //Avenger
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 27 47  ~1~
    SET_2DA_ENTRY_LATER ~RAWEAPPROF~ 28 47  ~1~
    SET_2DA_ENTRIES_NOW ~RAWEAPPROF~ 1
    PRETTY_PRINT_2DA
    BUT_ONLY_IF_IT_CHANGES
    
    //EoF
    

    I think that Subtledoctor's code for proficiency allowance is better than mine, as if I understood correctly it will automatically check for all druids - instead of manually inputting kit-by-kit as I did. Haven't tested, though.

    Ardulartificial_sunlightGusinda
  • ArdulArdul Member Posts: 205
    Yes that worked @Raduziel. Thank you so much! And thank you Kjeron and Subtledoctor for your help as well. Really appreciated!

    Raduziel
  • subtledoctorsubtledoctor Member Posts: 11,211
    Ardul wrote: »
    Hey @subtledoctor that worked for arrows and short bows, but not for long bows and composite bows for some reason.

    Usability, or proficiency?

    In the last block, you might need to adjust the "24 25" to "23 24" or something like that. It might just be editing the wrong rows of weapprof - I didn't test that code at all. But I can't see any reason that code would work for one or the other - except, as I said, an off-by-one error like that.

    I don't understand some of what Raduziel's code is doing - it is checking each header (and maybe each effect?) but the resulting change to usability affects the whole item, not just particular headers/effects. <So why bother with the check? It seems superfluous.

  • kjeronkjeron Member Posts: 2,038
    I don't understand some of what Raduziel's code is doing - it is checking each header (and maybe each effect?) but the resulting change to usability affects the whole item, not just particular headers/effects. <So why bother with the check? It seems superfluous.
    To make sure the item is actually a weapon.

  • subtledoctorsubtledoctor Member Posts: 11,211
    kjeron wrote: »
    I don't understand some of what Raduziel's code is doing - it is checking each header (and maybe each effect?) but the resulting change to usability affects the whole item, not just particular headers/effects. <So why bother with the check? It seems superfluous.
    To make sure the item is actually a weapon.

    Meh.

  • RaduzielRaduziel Member Posts: 4,598
    kjeron wrote: »
    I don't understand some of what Raduziel's code is doing - it is checking each header (and maybe each effect?) but the resulting change to usability affects the whole item, not just particular headers/effects. <So why bother with the check? It seems superfluous.
    To make sure the item is actually a weapon.

    Said the author of the code that I ripped off from DoF and adapted for this purpose.

    I also had to ask the first time I saw it.

Sign In or Register to comment.