Weapon Sets Swapper
Abel
Member Posts: 785
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.
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
10
Comments
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!
Does it work on bg 2?
I am sure a lot of people don't know this. Bump! 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::
[...]
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.
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!
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.
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.
@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.
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!
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
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.
About your question, I guess it would work. You just need the coordinates of the relevant slots!
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 ]
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!
Regards
I still seem not able to switch between a bow and 2H
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.