Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
Joined: Sep 2016
journeyman
OP Offline
journeyman
Joined: Sep 2016
For anyone interested in using scripting to check for different combinations of one-handed weapons, here's how I do it. Opens up great options for providing bonuses for weird combinations of weapons or for fighting with an empty off-handed that the rather limited WeaponType checks can't accomplish.

First comes the laborious part: tagging every weapon root template with identifying tags. (I'm away from my main comp right now or I would just post the merged files. Reply if you want them and I'll get to it later.)

Next, with character- or game-scripts:

Quote
EVENT EquipWeapon
VARS
ITEM:_Weapon
ON
OnItemEquipped(__Me,_Weapon)
ACTIONS
IF "c1"
IsTagged(_Weapon,"1_DAGGER")
THEN
SetTag(_Weapon,"1HD_EQUIPPED")
ENDIF
IF "c1"
IsTagged(_Weapon,"1HD")
THEN
SetTag(_Weapon,"1HD_EQUIPPED")
ENDIF
IF "c1"
IsTagged(_Weapon,"1_WAND")
THEN
SetTag(_Weapon,"1HD_EQUIPPED")
ENDIF
IF "c1"
IsTagged(_Weapon,"1_SHIELD")
THEN
SetTag(_Weapon,"1HD_EQUIPPED")
ENDIF
IterateItemsInInventory(__Me,"FreehandCheckFor1HD","1HD_EQUIPPED")

EVENT FreahandHas1HD
ON
OnIterateCount("FreehandCheckFor1HD",1)
ACTIONS
SetTag(__Me,"ABST_AMBI")

EVENT FreahandHasO
ON
OnIterateCount("FreehandCheckFor1HD",0)
ACTIONS
ClearTag(__Me,"ABST_AMBI")

EVENT FreahandHasTwo
ON
OnIterateCount("FreehandCheckFor1HD",2)
ACTIONS
ClearTag(__Me,"ABST_AMBI")

EVENT UnEquipWeapon
VARS
ITEM:_Weapon
ON
OnItemUnequipped(__Me,_Weapon)
ACTIONS
IF "c1"
IsTagged(_Weapon,"1_DAGGER")
THEN
ClearTag(_Weapon,"1HD_EQUIPPED")
ENDIF
IF "c1"
IsTagged(_Weapon,"1HD")
THEN
ClearTag(_Weapon,"1HD_EQUIPPED")
ENDIF
IF "c1"
IsTagged(_Weapon,"1_WAND")
THEN
ClearTag(_Weapon,"1HD_EQUIPPED")
ENDIF
IF "c1"
IsTagged(_Weapon,"1_SHIELD")
THEN
ClearTag(_Weapon,"1HD_EQUIPPED")
ENDIF
IterateItemsInInventory(__Me,"FreehandCheckFor1HD","1HD_EQUIPPED")


So this applies a tag if you only have one-handed weapon equipped, or a shield equipped and no weapon, and removes it if you unequip that weapon/shield or if you equip another weapon/shield.

If you change those initial tags to prompt other tags on equip (say 1_WAND would lead to WAND_EQUIPPED) you can combine this method with more convention checks for WeaponType to create simple checks for any kind of combination, i.e. a stance skill that only works if you have a Sword and Wand equipped, a talent that provides extra bonuses when wielding a Sword/Dagger, etc.

Joined: Nov 2017
L
member
Offline
member
L
Joined: Nov 2017
I'm sure this is very useful, but what does this allow you to do that WeaponType checks and GetEquippedItem don't?

Joined: Sep 2016
journeyman
OP Offline
journeyman
Joined: Sep 2016
As far as I know the only scripting query we can apply to try and achieve the same effect is CharacterHasWeaponType, which accepts the following categories:

-Bow
-Crossbow
-Staff
-Sword (one or two-handed)
-Club (one or two-handed)
-Axe (one or two-handed)
-Dagger
-Wand

So if I wanted to provide different bonuses based on dual-wielding two swords, wielding one two-handed sword, wielding one sword with an empty off-hand, or wielding a sword and shield, this couldn't actually help me. I put together the method above to provide new empty offhand bonuses beyond Ambidextrous.

Last edited by smarmbot; 16/03/18 03:16 AM.
Joined: Sep 2016
journeyman
OP Offline
journeyman
Joined: Sep 2016
(If there's an easier way to differentiate between cases like that I would love to hear it! That's part of the reason I posted here--throwing what I've got at the wall and seeing if anyone has something better.)


Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5