Jump to content


Member Since 11 Jan 2007
Offline Last Active Today, 04:28 PM

Topics I've Started

Stacking Bonuses from Launchers and Ammo

01 October 2018 - 11:12 AM

A recent pull request from Mercurier has brought to light an issue that I think deserves further discussion.
We have the ability (in EE games) to make it so launchers can bestow their enchantment level (in terms of what can be hit) upon ammo that they fire.  This is something that Demi requested, though I don't know his whole plan.
Without this tweak, to hit a creature that needs +3 weapons to be hit, you would need to use ammo that's +3 or greater enchantment.  With this tweak, you could use either ammo that's +3 or greater enchantment or a launcher that's +3 or greater enchantment.
In addition to the enchantment change, Mercurier proposed removing the damage and THAC0 bonuses from ammo. Right now, both our launchers and our ammo gain THAC0 and damage bonuses from enchantment level, so it stacks (+1 shortbow with +1 arrows = +2 THAC0 / +2 damage). I don't know if that's best, but I think that completely removing the bonuses from ammo would render plain enchanted ammo almost entirely useless.  I'll quote our discussion below.

Conceptually, what do the plain +2/+3/+4 ammos provide if their THAC0 and damage bonuses are removed? There aren't too many creatures that require enchanted ammo to hit to justify hoarding them... and once you get an enchanted launcher, that bonus goes away as well. I don't know if this is what Demi intended to do. We probably don't want doubly stacking damage/THAC0, but they need to have some benefit over plain arrows.

Per PnP launcher and ammo enchantment (and the associated damage/thac0 bonus) should not stack, but the higher one takes precedence. Current EE engine provides limited support for this rule for the enchantment part (determining what the weapon can hit), but not for the damage/thac0 part. IMHO stripping off damage/thac0 from ammo could be a close approximation: players can still hit dragons/liches with +0/+1/+2 launcher plus +3 ammo, but will lost a little bit of damage/thac0, which I guess is not too big deal. A good application is using Strong Arm (+2) and +3 ammo to quickly takeout dragons.

Additional note here:
In my personal mod I changed Strong Arm to a non-magical short composite bow crafted by its original owner-- an ogre hunter. In player's hand it functions as a composite longbow requiring 19 str (+8 dmg) -- good at wiping off mobs yet requires rare ammo for serious boss fights.

This is a good example that an early game equipment gets extended utility during late game. Some players use weimer's item upgrade mod so that their beloved Celestial Fury gets extended utility. I envision this tweak will open the road for more flexible and innovative item designs.

Yeah, but the effect of this change is that the majority of the time, +1/+2/+3 ammo would function no differently from unenchanted ammo. Once you got a +2 weapon, +2 ammo would be worthless. I think it might be good to move this discussion to the forums.

What do you guys think?

Is doubly stacking THAC0/damage a problem? What solutions would ensure that more heavily enchanted ammo remained better than less heavily enchanted ammo?

If anyone can find prior discussion of these issues, linking those posts could help.

Discussion Threads

24 March 2018 - 05:26 PM

Implemented Classes:

Other Implemented Components:

Community Discussions:

Version 8 Now Available

03 October 2016 - 05:27 PM

This update contains EET compatibility and an updated Polish translation courtesy of Cahir.
You can download the latest version of Song and Silence in the download center or you can check it out on GitHub.
The full change log is below.
  • EET compatibility
  • EE item description formatting (en dash prefix in lists)
  • Updated WeiDU to v240
  • Updated Polish translation (thanks Cahir)

Windows 10: Original BG2 Crashes When Selecting Class in Character Creation

22 September 2016 - 08:09 PM

I noticed my unmodded game crashing during character creation when choosing a class.  Clicking Fighter, Cleric, Druid, or Bard caused a crash, but clicking Wizard or Sorcerer did not.
It happened in both a disc-based Baldur's Gate II installation and a GOG installation.  (Not the Enhanced Edition.)

I updated to Windows 10 a couple of months ago and I hadn't noticed any crashes before, even though I had run the game a few times and tested sample mod code (creating new ToB games, spawning items, that sort of thing).

After trying to pin down the problem, I discovered it could be fixed by running bgmain.exe in Windows 7 compatibility mode.  (Right click the file, go to Properties and the Compatibility tab, then Run this program in compatibility mode with Windows 7.)
I'm posting this as a reference for anyone who might have experienced a similar problem.

EE Item Restrictions (Opcode 319 and item_use.2da)

15 September 2016 - 09:53 PM

I have some information about opcode 319 and item_use.2da determined from testing.

Here is the current IESDP description of opcode 319.

#319 (0x319) Usability: Item Usability
Parameter #1: IDS Entry
Parameter #2: IDS File
Special: Description note

This effect restricts the item to creature(s) matching the object identifiers. The string to display when an invalid creature attempts to use the item is held in 0x2c.
Known values for 'IDS File' are:
  2 EA.ids
  3 General.ids
  4 Race.ids
  5 Class.ids
  6 Specific.ids
  7 Gender.ids
  8 Align.ids
  9 Kit.ids
  10 Actor's name
  11 Actor's scripting name (8 maximum in resource field)

If 'IDS File' is set to 10, the item is restricted to characters with the name specified by the strref held in parameter1.
If 'IDS File' is set to 11, the item is restricted to characters with the death variable specified by the resource field.

The message defined in 'Description note' will be displayed whenever this effect is triggered.


As referenced in Cam's original post about this opcode, setting the effect's power to 0 restricts the specified characters from using the item, while setting the power to 1 restricts everyone except the specified characters from using the item.

Regardless of whether the power is set to 0 or 1, multiple effects stack restrictively. If one effect prevents males from using the item and another effect prevents everyone except elves from using it, the only characters who can use it are non-male elves. Likewise, these effects stack restrictively with the class, kit, and attribute restrictions specified in the item header.


Effect probabilities are ignored for 319, so the restriction will remain active even if both probability1 and probability2 are set to 0.  To disable a 319 effect you must remove it from the file.


The strref supplied in the special parameter is not displayed "when an invalid creature attempts to use the item" nor "whenever this effect is triggered". When the power is set to 0, the text is displayed in a 'Not usable by' section of the item description.  When the power is set to 1, the text appears in a 'Usable by' section of the item description.
These usability descriptions replace the normal usability descriptions that are generated based on the class and kit descriptions specified in the item header.  Edit: This may only happen if parameter 2 is set to 10 or 11, need to confirm.


If an item has multiple 319 effects and all effects have the same power, the 'Not usable by' or 'Usable by' section of the item description (as appropriate) will list all of the strings associated with those effects.  However, if an item has some 319 effects that have power 0 and others that have power 1, only the 'Usable by' section will be displayed and it will list only the effects with power 1.



If an item has 319 effects and is also referenced in item_use.2da, the contents of the description usability section depend on whether the item has any class or kit restrictions in the item header.  If there are no such restrictions, the 319 effects will control the usability description as described above.  If there are class or kit restrictions, then the usability section will be replaced with Usable by: USER, where USER is the script name associated with the item in item_use.2da with exact capitalization preserved.
As an example, npshld.itm in BG2EE has a 319 effect with param2 = 11 (actor's script name), resource = ~ANOMEN~, and special = 9138 (~Anomen~).  It also has some class and kit restrictions and it is referenced in item_use.2da:

NPSHLD    ANOMEN    9382      2

Its usability section reads:

Usable by:

If the entry in item_use.2da is changed to this:

NPSHLD    AnOmEn    9382      2

Then its usability section will read:

Usable by:

If the class and kit restrictions in the item header are removed, then the usability section will instead be generated from the 319 effect and read:

Usable by:

item_use.2da doesn't seem to be described in IESDP, but the EE implementation appears to be a simpler form of this ToBEx feature without the additional STRREF columns. I didn't test the functionality of the FLAGS column, but vanilla items included in EE utilize FLAGS values between 1 and 4.

Item Restrictions

TobEx externalises creature-specific item restrictions to ITEM_USE.2DA. This allows modmakers to customise specific item restrictions for creatures in the style of Minsc's Boo and Xan's Moonblade.


[ROWNAME]: the resource name of the item that the item-creature restrictions apply to
USER: death variable/script name of creature (not case-sensitive)
STRREF#: the string reference to display in the inventory screen when the restriction indicated by the flag value of # applies
FLAG: bitfield indicating the type/s of restriction to apply

FLAG bits

  • bit 0 [1]: the item cannot be picked up from any slot of the creature (this overrides bits 3 and 4)
  • bit 1 [2]: the item can only be equipped by the creature (this is 'stackable', so multiple item entries with different creatures mean that each of the listed creatures can equip the item)
  • bit 2 [4]: no restrictions (this bit is reserved for GemRB)
  • bit 3 [8]: the item cannot be picked up from any equipped slot of the creature
  • bit 4 [16]: the item cannot be picked up from any inventory slot of the creature
  • bit 5 [32]: the item cannot be dropped into any equipped slot of the creature
  • bit 6 [64]: the item cannot be dropped into any inventory slot of the creature
MISC84  MINSC   10218   3       10218   -1      -1       -1      -1       -1
Item MISC84 cannot be picked up from any slot of "Minsc", and can only be equipped by "Minsc".