Skip to content

Weapon Sets Swapper

AbelAbel Member Posts: 785
edited January 2015 in General Modding
It has always been frustrating not being able to wield projectile weapons with off-hand weapons or, more generally, to quickly change between various types of weapons. IWD2 solved this by enabling weapon sets. In BG, one can always swap weapons and/or shield sets for others via inventory, but it's tedious.

I wrote a script that does this job as quickly as can be done upon a simple key press.
It requires AutoHotkey.
Open the script with a text editor and follow the guidelines (preceded by ";").
I suggest you use Notepad++ and format the script using Language>A>AutoIt in the editor to have a better view.

It's not a mod per se but I think it belongs in this section since it requires some customisation on your end.
It's a rough job that can be improved if people actually need it.
Post edited by Abel on

Comments

  • KerozevokKerozevok Member Posts: 695
    Great job Abel, I didn't know autohotkey, I'll take a look.
  • AbelAbel Member Posts: 785
    Salut @Kerozevok ;) !
    Thanks for you comment! Since I feared not many people would take interest in this, I did, as I said, a very rough job.
    I've had ideas to simplify the user configuration and to add options to switch between various pieces of equipment (belt, necklace, boots, rings, etc.) but I'm yet to be convinced it would be worth working on.
    I guess you're pretty good with programming so you should find a way to tune my code to your needs!
  • KerozevokKerozevok Member Posts: 695
    edited May 2013
    Salut Abel. Pas de problème, je l’adapterai à l'occaz pour BGT, mais pour l'heure c'est surtout autohotkey qui m'intéresse. ;)
  • BorsookBorsook Member Posts: 152
    Abel said:

    It has always been frustrating not being able to wield projectile weapons with off-hand weapons or, more generally, to quickly change between various types of weapons. IWD2 solved this by enabling weapon sets. In BG, one can always swap weapons and/or shield sets for others via inventory, but it's tedious.

    I wrote a script that does this job as quickly as can be done upon a simple key press.
    It requires AutoHotkey.
    Open the script with a text editor and follow the guidelines (preceded by ";").
    I suggest you use Notepad++ and format the script using Language>A>AutoIt in the editor to have a better view.

    It's not a mod per se but I think it belongs in this section since it requires some customisation on your end.
    It's a rough job that can be improved if people actually need it.

    Thank you for this, the fact that they did not implement IWD2 changes is my biggest disappointment with BG:EE, they wasted a chance for really improving BG
  • artificial_sunlightartificial_sunlight Member Posts: 601
    Wil it put unusable items in your weapon slot? And I think we should build a list of resolutions and values fof the script. Or make more script together, I think its more lazy/noob user friendly. But Im sure to check it out.
    Does it work on bg 2?
  • SionIVSionIV Member Posts: 2,689
    Borsook said:

    Abel said:

    It has always been frustrating not being able to wield projectile weapons with off-hand weapons or, more generally, to quickly change between various types of weapons. IWD2 solved this by enabling weapon sets. In BG, one can always swap weapons and/or shield sets for others via inventory, but it's tedious.

    I wrote a script that does this job as quickly as can be done upon a simple key press.
    It requires AutoHotkey.
    Open the script with a text editor and follow the guidelines (preceded by ";").
    I suggest you use Notepad++ and format the script using Language>A>AutoIt in the editor to have a better view.

    It's not a mod per se but I think it belongs in this section since it requires some customisation on your end.
    It's a rough job that can be improved if people actually need it.

    Thank you for this, the fact that they did not implement IWD2 changes is my biggest disappointment with BG:EE, they wasted a chance for really improving BG
    Then they would have had to change the whole interface.
  • DarKelPDarKelP Member Posts: 183
    edited October 2014
    @Abel Thank you so much for the script. It will help me a lot, it is very annoying open the inventory every time.

    I am sure a lot of people don't know this. Bump!
    Abel said:

    Be careful to suspend or exit the script when not playing.

    You can use for this issue:

    #IfWinActive, Baldur's Gate - Enhanced Edition or #IfWinActive, Baldur's Gate II - Enhanced Edition

    [...]
    ;Default Alt+s
    #IfWinActive, Baldur's Gate - Enhanced Edition
    !s::
    [...]
  • AbelAbel Member Posts: 785
    Oh, hello :) ! Glad it's of use! Thanks for the tip!
    Actually, since you're posting here, I'll tell you I was working on an in game script that would record and swap between sets. Way better than this AHK script since it wouldn't need external software.
    It's huge but alas unfinished. At one point I realised I couldn't spend the time it would need to make it work flawlessly. But the code's still on my hard drive, so maybe I'll work back on it sometime!
    If you're interested I'll share it, though it may not be worth the time needed to understand it.
  • WilburWilbur Member Posts: 1,173
    I can't believe I've missed this mod. Thank you!
  • ioannismanioannisman Member Posts: 43
    Could you please describe the whole process in detail, many thanks!
  • AbelAbel Member Posts: 785
    @ioannisman What do you mean? Did you install Autohotkey? I think you have to customise the script and use the comments I included in it. Can you download the file? I don't see it anymore and I don't have it on my computer anymore.
  • ioannismanioannisman Member Posts: 43
    Autohotkey is installed , I open Autot3 Window Spy, the script is running in the backround, I start BG2EE but every time I press alt+s there are changes only in the weapons in the quick slots, any weapon in the inventory is unaffected.
    I add the script if that would be of any help, many thanks for your quick reply and a happy new year to us all!
  • AbelAbel Member Posts: 785
    Ok, I'm checking the script.
    Did you find the coordinates with AutoIt3? It's tedious to do, but I don't know how the game scales with various resolutions.
    Now, Set 2 uses slots 15 and 16, which are the 2 slots of the last column in the inventory.
    Set 3 uses slots 13 and 14. So, you have to put your weapons in those slots for the swap to work.
  • ioannismanioannisman Member Posts: 43
    Well I play the game in a 22' monitor at 1680x1050 if that helps. I just cannot understand what to do, how I find the coordinates with Autolt3, this I think is the crucial point here!
  • WilburWilbur Member Posts: 1,173
    edited January 2015

    Well I play the game in a 22' monitor at 1680x1050 if that helps. I just cannot understand what to do, how I find the coordinates with Autolt3, this I think is the crucial point here!

    I didn't know how to use AutoIt3 while BG was running so I took a print screen (with inventory screen open). Then I opened the print screen pic in Windows Photo Viewer, changed it to full screen, opened AutoIt3 and selected Windows Photo Viewer with Ctrl+Alt+Tab to activate AutoIt3. Then I measured the correct coordinates for my resolution (1920x1080) and changed them to ahk file using Notepad++. I had to change every coordinate in the configuration section to get it working. I measured them with the cursor roughly in the middle of the slot. This is the first time I've used AutoHotkey so I'm not an expert by any means but I did get it working this way :)

    Configuration part with more comments in underlined italic
    ;;;;;;;;;;;;;;;;;;;;;;;;;CONFIGURATION;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;Please find the coordinates (X,Y) of each slot for your game resolution
    ;For that purpose, use AutoIt3 Window Spy provided with AutoHotkey
    ;Column of weapon slot and weapon/shield slot (X)
    Wp = 187 main hand weapon slot X coordinate
    Sh = 569 off hand slot X coordinate
    ;Row of weapon slots (Y)
    WpS = 272 main hand and off hand Y coordinate
    ;Column of inventory (of 8 columns in total)
    In7 = 510 first weapon set X coordinate in inventory; second slot in top row from the right
    In8 = 575 second weapon set X coordinate in inventory; first first slot in top row from the right
    ;Top row of inventory (for weapons)
    InWp = 587 top inventory row Y coordinate
    ;Bottom row of inventory (for off-hand weapons/shields)
    InSh = 652 bottom inventory row Y coordinate
    ;;;;;;;;;;;;;;;;;;;;;;;#2;;;;;;;;;;;;;;;;;;;;;;;;;

    Hope this helps :)

    Edit. typos and some.
    Post edited by Wilbur on
  • AbelAbel Member Posts: 785
    edited January 2015
    @ioannisman‌
    @Wilbur Thanks for your kind help!
    I included new lines in the script to help you get coordinates, so you don't have to use the Window Spy anymore.
    Just download the file of the first post again.

    ;;;;;;;;;;;;;;MOUSE POSITION RETRIEVER;;;;;;;;;;;;;;;;;;;;; ;Will display a message with mouse coordinates ;Default Alt+p !p:: MouseGetPos, xpos, ypos Msgbox, The cursor is at X%xpos% Y%ypos%. return
    Press Alt+p and a message box will give you the information.
  • ioannismanioannisman Member Posts: 43
    Ok, this is getting better and better but Abel and Wilbur even with your great support little progress is being done or something bad is happening with my cognitive abilities!

    There are 4 weapon slots 13, 14, 15, 16, so there must be 8 coordinates but in the script there are 7 which except from those 2:

    Column of inventory (of 8 columns in total)
    In7 = 510 first weapon set X coordinate in inventory; second slot in top row from the right
    In8 = 575 second weapon set X coordinate in inventory; first slot in top row from the right

    the others I cannot understand how to find!

    So please my friends lets pretend that I am a 6 years old child could you please write down to each of the other 5 left a description for ex. second slot in top row from the right or first slot bottom row from the right?

    Column of weapon slot and weapon/shield slot (X)
    Wp = 187 main hand weapon slot X coordinate
    Sh = 569 off hand slot X coordinate

    ;Row of weapon slots (Y)
    WpS = 272 main hand and off hand Y coordinate

    ;Top row of inventory (for weapons)
    InWp = 587 top inventory row Y coordinate

    ;Bottom row of inventory (for off-hand weapons/shields)
    InSh = 652 bottom inventory row Y coordinate

    Many, many thanks for your time and interest in this!
  • WilburWilbur Member Posts: 1,173
    @ioannisman

    The coordinates for four weapon slots in your inventory are specified in In7, In8, InWp and InSh. It takes only four values since every slot shares a coordinate with another slot e.g. first weapon set's main and off hand slots share the same X coordinate (In 7 value) and the main hand slots of both weapon sets share the same Y coordinate (InWp) and so on. I can't provide you with a screen shot right now so hopefully this will clear things out.

    I believe we will get it working sooner or later :)
  • AbelAbel Member Posts: 785
    edited January 2015
    @ioannisman‌
    I made a picture to show you which coordinates you must get. I don't have BGEE installed so used IWDEE instead but should be the same.
    Remember: columns are X and rows Y coordinates.
    Set 1 is Wp and Sh, Set 2 is 13 and 14, Set 3 15 and 16. 14 and 16 are for shields or off-hand weapons. If you have one, amend this part of the script:

    ;;;;;;;;;;;;;;;;;;;;;;;#2;;;;;;;;;;;;;;;;;;;;;;;;; ;Presence of a off-hand weapon/shield for each set ;Put 1 if yes, 0 if no Set1 = 1 ;Quick bar set Set2 = 1 ;Inventory slots 15 & 16 set Set3 = 0 ;Inventory slots 13 & 14 set
    Hope it helps.

    image
  • EmptyPepsiCanEmptyPepsiCan Member Posts: 12
    Is this script likely to work with Baldur's Gate 1&2 Complete? So far it hasn't been, but that could easily be user error.
  • EmptyPepsiCanEmptyPepsiCan Member Posts: 12
    Nothing, huh?
  • AbelAbel Member Posts: 785
    @EmptyPepsiCan Hello! Sorry I don't come around here often!
    About your question, I guess it would work. You just need the coordinates of the relevant slots!
  • AlexbathoryAlexbathory Member Posts: 2
    edited July 2015
    Thanks for creating a solution for this very important issue, I'm surprised it wasn't dealt within the EE itself!
  • AlexbathoryAlexbathory Member Posts: 2
    edited July 2015
    I followed the instructions for the configuration (I'm running with a 1920x1080 resolution, I think I got all the coords right) but apparently nothing happens when I click ALT+S in game with the software on. Here enclosed you can find the modified script, could you please check if you see anything wrong in it? Thanks in advance!

    Btw, I'm playing Icewind Dale EE

    [EDIT: I indirectly found the problem: there must be an error in the new script you attached, because when I put the same coords in the "old" script sent by Ioannisman everything worked just fine :smiley: ]
    Post edited by Alexbathory on
  • AbelAbel Member Posts: 785
    Oh wao, I'm really late to answer @Alexbathory! Glad you found out the answer to your problem by yourself.

    I also take this chance to tell you that a true weapon swapper has been anounced for SoD. I've never been so glad that a script would become useless. Yay!
  • Earnest_ernestEarnest_ernest Member Posts: 40
    Sorry to necrosurrect this but I was wondering if you still had your in-game script(BCS or BS i guess) in your hard drive that would fix the dual-wielding issue?

    Regards
  • AbelAbel Member Posts: 785
    @Earnest_ernest Hi! The scripts work for Autohotkey which uses .ahk extensions (BCS and BS are Infinity Engine games scripts). You can find these scripts in the previous posts. Beamdog updated its games and you can now switch between a WP/SH & 2H or WP/WP & 2H. You can't do WP/SH & WP/WP, though. If you need to, you can still use my scripts in tandem with the new feature.
  • Earnest_ernestEarnest_ernest Member Posts: 40
    Abel said:

    @Earnest_ernest Hi! The scripts work for Autohotkey which uses .ahk extensions (BCS and BS are Infinity Engine games scripts). You can find these scripts in the previous posts. Beamdog updated its games and you can now switch between a WP/SH & 2H or WP/WP & 2H. You can't do WP/SH & WP/WP, though. If you need to, you can still use my scripts in tandem with the new feature.

    Im sorry, what did WP stand for?.

    I still seem not able to switch between a bow and 2H
  • GrimLefourbeGrimLefourbe Member Posts: 637
    WP stands for weapons. In the 2.0 version of the EE, you can have an inactive left hand weapon or shield so you can switch between 2Weapons and a 2 handed weapon or between a weapon + shield and a 2 handed Weapon

    The game doesn't let you swap between Weapon/shield and weapon/weapon because the game only lets you have 1 offhand item equipped at any time.

    I wonder if it would be possible to use some LUA UI tricks to allow actual item sets.
Sign In or Register to comment.