Skip to content

Enchant the Missile Launchers (Ranged Weapon Tweak)

DeeDee Member Posts: 10,447
edited June 2016 in General Modding

Enchant the Missile Launchers: A Small Ranged Weapon Tweak

Download Link
In the tabletop version of AD&D, magical ranged weapons bestow their full enchantment value on any ammunition that is used with them. In the Baldur's Gate series, that behavior wasn't possible; when you equip a nonmagical arrow, the engine didn't know how to see the launcher's enchantment level. We now have an opcode that can get around that, but it needs to be applied.

That's what this mod is for.

This small patch grabs every magical missile launcher in the game (slings, crossbows, and the various bows) and applies an effect that allows them to use their listed enchantment levels, regardless of what ammunition is being used with them.

That means if you have a +2 shortbow and normal arrows, it'll bypass creature defenses as if they were +2 arrows. (+3 arrows will still function like +3 arrows; your equipped launcher can't make your equipped ammunition less magical than it is). This also means that an end-game longbow doesn't also have to be paired with end-game ammunition in order to be usable against end-game monsters

It also means that infinite-ammo launchers like Firetooth and Gesen Bow are made more powerful by equipping real ammunition, not less.

Just install it like any other mod. It should work fine with BG:EE, SoD, and BGII:EE. Feedback is welcome!

New Component: Ammunition Recovery

I spent a lot of time thinking about how best to handle ammunition. It doesn't make sense to me, for instance, that you can't recover arrows that you use in combat--and picking up a dozen stacks of arrows obsessively because you don't want to go back to town seems like a huge waste of time. That's the reason for increasing stack sizes in a number of tweak mods: to remove the headache of inventory management so that you can focus on the parts of the game that are fun. Unfortunately, the inventory management is still there, it just happens less often.

So. This thing.

The skinny: Any ammunition you purchase from a store is now treated as a rechargable quiver with a specific number of charges, which recharges itself after every rest. This means that when you buy arrows, you're buying a quiver of 20 arrows; it will always be limited to 20, but you'll start every day with a full quiver.

Each ammunition type has its own number of charges, as laid out below:
- Bolts: 20
- Bullets: 20
- Arrows: 20
- Throwing Daggers: 5
- Throwing Axes: 2
- Darts: 15

In addition, to keep things somewhat balanced, magical ammunition and thrown weapons have a maximum charge limit based on their particular enchantment. A given weapon will use this limit or the base weapon's limit, whichever is lower:
- +1, +2, +3, +4: 10
- Minor Secondary Effect (such as Fire, Acid, Cold, or Electricity damage): 5
- Powerful Secondary Effect (such as Poison, Stunning, or Polymorph): 1

Optional Components: Eldoth and Jan

Eldoth in BG:EE and Jan in BGII:EE have the ability to make their own ammunition as a 1/day ability, and the ammunition they create is pretty powerful. No one wants to spend fifteen days stocking up on Poison Arrows, and when you forget to do it in the middle of a dungeon that can be frustrating.

To that end, I've taken away from those characters the ability to create new ammunition, and instead given each of them a rechargeable version of their special ammunition that has 5 charges.

That means you won't be able to stock up on Flasher Master Bruiser Mates, but it also means you'll always have five of them (and only five of them) on hand, ready to go.

Optional Component: Fix Fuller's Bolts

Fuller wants you to bring him some bolts. But because of the way the ammunition component above works, Bolts now cost 7 gp - and Fuller won't take them from you. So this component just adds a single stack of bog-standard non-renewable bolts to the Candlekeep store, right at the top of the list so you'll be able to spot them more easily.

Notes

Pay attention to your characters if you use this component. There's a bit of a hitch where running out of charges on an ammunition item won't prompt the character to switch to the next ammunition; they'll just stand there idly, waiting for death. You can fix it on the fly pretty easily by switching ammo slots manually, but you'll want to pay attention to remember to do it.


(Original post below)
[spoiler]

Working on something for myself here, and trying to make the work go faster so that I can get it working and installed to test it out.

I'm sure someone's already created a mod that does this, so if there is, just post a link to it and I'll be happy to take a look. Otherwise, any intrepid WeiDU experts are welcome to offer solutions.

The Concept:

Make all magical ranged weapons grant their enchantment level to whatever equipped ammunition is being used.

Context:

As of Icewind Dale: Enhanced Edition, there's an opcode (345) that allows an effect to change the target's effective enchantment level with all their attacks. I want to use that effect to give every magic launcher the same treatment that infinite-ammo launchers give to their weapon-created ammunition. Gesen Bow +4 is treated as a +4 weapon when you don't equip arrows on it; I want it to be treated as a +4 weapon even if you've equipped normal, nonmagical arrows.

What I need

A way to quickly add an appropriate 345 effect onto every ranged launcher item that has an enchantment value of at least 1, based on that value. Here's my terrible pseudocode for what I'm trying to achieve:
item.enchantment = enchantment

if item.launcher == true then
if enchantment >= 1 then
apply effect(345, enchantment, "permanent/while equipped")
end
end
I'll zip up and attach a sample item with the effect already applied.[/spoiler]
Post edited by Dee on
AstroBryGuyAerakarGrammarsaladrorikonJuliusBorisovinethbrusArdulCrevsDaakDemivrgvsRaduzielThacoBell_Luke_
«13

Comments

  • The user and all related content has been deleted.
    DeeAstroBryGuyJuliusBorisov
  • DeeDee Member Posts: 10,447
    edited May 2016
    With some tweaking, that worked like a charm. Attaching the results here.

    Enchant the Missile Launchers

    This small patch grabs every magical missile launcher in the game (slings, crossbows, and the various bows) and applies an effect that allows them to use their listed enchantment levels, regardless of what ammunition is being used with them.

    That means if you have a +2 shortbow and normal arrows, it'll bypass creature defenses as if they were +2 arrows. (+3 arrows will still function like +3 arrows; your equipped launcher can't make your equipped ammunition less magical than it is).

    Just install it like any other mod. It should work fine with BG:EE, BGII:EE, and IWD:EE. I haven't tested it in-game yet to see how it plays, though. Feedback is welcome!
    Post edited by Dee on
    AstroBryGuyJuliusBorisov
  • The user and all related content has been deleted.
  • kjeronkjeron Member Posts: 2,367

    Does opcode 345 exist in IWDEE? I thought it was a 2.0+ addition...

    The opcode crashes an IWDEE v1.4 game.

    I am surprised this change was not included as a bug-fix in the official release. I had thought it had only been a feature due to "limitations of the engine", which is no longer true.
    Grammarsalad
  • AquadrizztAquadrizzt Member Posts: 1,065

    Does opcode 345 exist in IWDEE? I thought it was a 2.0+ addition...

    That was my initial reaction as well. I am nearly certain that it is only available in the v2.0 engine.
  • ErgErg Member Posts: 1,756
    edited May 2016


    INT_VAR opcode = 345 parameter2 = EVAL ~%enchantment%~
    I'm not familiar with this opcode and I couldn't find documentation anywhere, but it should be
    INT_VAR opcode = 345 parameter1 = EVAL ~%enchantment%~
    Also I think you must set target to Self and timing mode to "permanent/while equipped".
    AstroBryGuyDee
  • argent77argent77 Member Posts: 3,431
    I fear it's a bit more complicated than that. Effects added to the bow are only affecting the bow itself. The current code would simply reset the bow's enchantment to the present enchantment value. However, param2 controls the weapon type to (re-)enchant. Enchantment level is specified in param1. Adding effects to the launcher ability doesn't appear to work either.

    I thought using opcode 249 (Ranged Hit Effect) with attached EFF containing opcode 345 would do the trick, but it didn't work in my tests either (even though I don't know why).
    AstroBryGuyDeeErg
  • kjeronkjeron Member Posts: 2,367
    argent77 said:

    I fear it's a bit more complicated than that. Effects added to the bow are only affecting the bow itself. The current code would simply reset the bow's enchantment to the present enchantment value. However, param2 controls the weapon type to (re-)enchant. Enchantment level is specified in param1. Adding effects to the launcher ability doesn't appear to work either.

    I thought using opcode 249 (Ranged Hit Effect) with attached EFF containing opcode 345 would do the trick, but it didn't work in my tests either (even though I don't know why).

    Need to set the Special Field of opcode 345 to "Mainhand Weapon" (1) instead of "Current Weapon" (0).
    DeeAstroBryGuyErg
  • lansounetlansounet Member Posts: 1,182
    edited May 2016
    @argent77 Actually it works with 345 when you use "both weapons" last parameter in NI.

    Tested it in SoD, added the effect to BDBOW03 with these settings



    and I could hit a stone golem (BDGOLSTO.CRE wearing IMMUNE2.ITM) with regular arrow.

    Seems like I posted basically the same thing as kjeron above except I went and checked for the effect used in Enchanted Weapon spell which uses "both weapons" (3) and copied that. *because value 0 didn't work*


    Deeargent77AstroBryGuyErg
  • DeeDee Member Posts: 10,447
    Erg said:


    INT_VAR opcode = 345 parameter2 = EVAL ~%enchantment%~
    I'm not familiar with this opcode and I couldn't find documentation anywhere, but it should be
    INT_VAR opcode = 345 parameter1 = EVAL ~%enchantment%~
    Also I think you must set target to Self and timing mode to "permanent/while equipped".
    It appears to set those values by default, checking an item after installation.
    kjeron said:

    argent77 said:

    I fear it's a bit more complicated than that. Effects added to the bow are only affecting the bow itself. The current code would simply reset the bow's enchantment to the present enchantment value. However, param2 controls the weapon type to (re-)enchant. Enchantment level is specified in param1. Adding effects to the launcher ability doesn't appear to work either.

    I thought using opcode 249 (Ranged Hit Effect) with attached EFF containing opcode 345 would do the trick, but it didn't work in my tests either (even though I don't know why).

    Need to set the Special Field of opcode 345 to "Mainhand Weapon" (1) instead of "Current Weapon" (0).
    Good to know. I'll upload a revised version in a bit.
    AstroBryGuy
  • DeeDee Member Posts: 10,447
    Here's the updated version, which sets the Special field to the Mainhand Weapon. Let me know if that fixes or doesn't fix the issue there.
  • argent77argent77 Member Posts: 3,431
    @lansounet It works in SoD! I wonder why the same effect doesn't work in ToB.
  • lansounetlansounet Member Posts: 1,182
    @argent77 It also works on my version of BG2:EE v2.2.66
  • argent77argent77 Member Posts: 3,431
    @Dee Try this. It sets a couple of base values and moves enchantment level to param1.
    COPY_EXISTING_REGEXP GLOB ~^.+\.itm~ ~override~ PATCH_IF (%SOURCE_SIZE% > 0x71) BEGIN READ_SHORT 0x1c type PATCH_IF (type = 0x0f || type = 0x12 || type = 0x1b) BEGIN READ_LONG 0x60 enchantment PATCH_IF (enchantment > 0) BEGIN LPF ADD_ITEM_EQEFFECT INT_VAR opcode = 345 target = 1 timing = 2 parameter1 = enchantment special = 1 END END END END BUT_ONLY

    @lansounet It seems to work now in a clean BG2:EE installation. Maybe another mod interfered with it before.
    ErgDee
  • ErgErg Member Posts: 1,756
    edited May 2016
    Dee said:

    It appears to set those values by default, checking an item after installation.

    @Dee,

    no the default are 0, i.e. "None" for "Target" and "Instant/Limited" for "Timing Mode". You must set them to 1 and 2 respectively. Also you are still erroneously applying the enchantment to param2 instead of param1.

    Edit: ninja'd by @argent77
    Dee
  • DeeDee Member Posts: 10,447
    edited May 2016
    Huh. I must have been looking at an item I had already modified. A fresh reinstall confirms what you're saying.

    Uploading the latest version, using the code that @argent77 supplied. Thanks for the assistance, everyone!
    Post edited by Dee on
    Wise_Grimwald
  • argent77argent77 Member Posts: 3,431
    edited May 2016
    This component looks like the perfect candidate for @CamDawg 's Tweaks Anthology.
    GrammarsaladrorikonWise_Grimwald
  • DeeDee Member Posts: 10,447
    Alright, formalizing the top post in this thread and attaching the zip file there. @CamDawg has my permission to use this component if he likes.
    lansounetrorikonJuliusBorisovWise_Grimwald
  • GrammarsaladGrammarsalad Member Posts: 2,582
    argent77 said:

    This component looks like the perfect candidate for @CamDawg 's Tweaks Anthology.

    Agreed
  • DeeDee Member Posts: 10,447
    There's more stuff on the way here. If you try it out, please let me know how the game plays with the tweak that's posted in the OP.
  • [Deleted User][Deleted User] Posts: 0
    edited June 2019
    The user and all related content has been deleted.
    Post edited by [Deleted User] on
    Wise_Grimwald
  • DeeDee Member Posts: 10,447
    Okay, quick update:

    New Component: Ammunition Recovery

    I spent a lot of time thinking about how best to handle ammunition. It doesn't make sense to me, for instance, that you can't recover arrows that you use in combat--and picking up a dozen stacks of arrows obsessively because you don't want to go back to town seems like a huge waste of time. That's the reason for increasing stack sizes in a number of tweak mods: to remove the headache of inventory management so that you can focus on the parts of the game that are fun. Unfortunately, the inventory management is still there, it just happens less often.

    So. This thing.

    The skinny: Any ammunition you purchase from a store is now treated as a rechargable quiver with a specific number of charges, which recharges itself after every rest. This means that when you buy arrows, you're buying a quiver of 20 arrows; it will always be limited to 20, but you'll start every day with a full quiver.

    Each ammunition type has its own number of charges, as laid out below:
    - Bolts: 20
    - Bullets: 20
    - Arrows: 20
    - Throwing Daggers: 5
    - Throwing Axes: 2
    - Darts: 15

    In addition, to keep things somewhat balanced, magical ammunition and thrown weapons have a maximum charge limit based on their particular enchantment. A given weapon will use this limit or the base weapon's limit, whichever is lower:
    - +1, +2, +3, +4: 10
    - Minor Secondary Effect (such as Fire, Acid, Cold, or Electricity damage): 5
    - Powerful Secondary Effect (such as Poison, Stunning, or Polymorph): 1

    Optional Components: Eldoth and Jan

    Eldoth in BG:EE and Jan in BGII:EE have the ability to make their own ammunition as a 1/day ability, and the ammunition they create is pretty powerful. No one wants to spend fifteen days stocking up on Poison Arrows, and when you forget to do it in the middle of a dungeon that can be frustrating.

    To that end, I've taken away from those characters the ability to create new ammunition, and instead given each of them a rechargeable version of their special ammunition that has 5 charges.

    That means you won't be able to stock up on Flasher Master Bruiser Mates, but it also means you'll always have five of them (and only five of them) on hand, ready to go.

    Optional Component: Fix Fuller's Bolts

    Fuller wants you to bring him some bolts. But because of the way the ammunition component above works, Bolts now cost 7 gp - and Fuller won't take them from you. So this component just adds a single stack of bog-standard non-renewable bolts to the Candlekeep store, right at the top of the list so you'll be able to spot them more easily.

    Notes

    Pay attention to your characters if you use this component. There's a bit of a hitch where running out of charges on an ammunition item won't prompt the character to switch to the next ammunition; they'll just stand there idly, waiting for death. You can fix it on the fly pretty easily by switching ammo slots manually, but you'll want to pay attention to remember to do it.

    And that's everything. I'm updating the zip file in the top post; let me know what you think!
    JuliusBorisovmf2112
  • kjeronkjeron Member Posts: 2,367
    Dee said:

    New Component: Ammunition Recovery

    An interesting Concept, but I cannot agree with the quiver charge amounts. Bolts and Bullets are the only two that seem reasonable. The rest will expend themselves way to fast to be practical.

    I would see 2 turns worth of ammunition per quiver:
    20 Bolts, Bullets, and Throwing Axes
    40 Arrows and Throwing Daggers
    60 Darts

    And scale the magical ammunition similarly:
    Enchanted +X = 5 Rounds worth (Normal / 4)
    Elemental = 2 Rounds worth (Normal / 10)
    Other = 1 Round worth (Normal / 20)
    mf2112
  • DeeDee Member Posts: 10,447
    I'm not going to increase any of the charge limits above 20; 20 is the standard stack size, and that's an important balancing feature. The goal here is to make you think carefully about the tactics of using your ammunition wisely. If you want more than twenty arrows, equip a second quiver; that's why you have three slots.

    As for thrown weapons, I set them lower for a few reasons:

    1. Equipping twenty axes is impractical; you need them all to be accessible so that you can throw them, and the game makes it pretty clear that a throwing axe is just a battle axe that you throw. The same is true, to a lesser extent, for throwing daggers.
    2. Throwing axes and throwing daggers share a proficiency with their melee counterparts, which means that a character built around throwing axes (or throwing daggers) should be comfortable switching to melee as needed.
    3. Throwing axes and throwing daggers are not designed to be primary weapons; they're the thing you use when you're about to dive into melee. Throwing daggers get a higher charge limit because they're smaller and easier to keep on a bandolier, but they're not the same as a bow; you use them before you engage in melee, not as a substitute for a normal ranged weapon.

    Darts could be set to 20, sure, but even at 15 that's enough for five rounds of dart-throwing. If you need more than that, carry spares.

    This component isn't meant to give you enough ammunition to get through a dungeon in one go; it's meant to give you a way to recover your limited ammunition without having to run back to town, and to give you the freedom to use your specialty ammunition without worrying about not having it later.
    Mr2150[Deleted User]JuliusBorisov
  • kjeronkjeron Member Posts: 2,367
    Dee said:

    I'm not going to increase any of the charge limits above 20; 20 is the standard stack size, and that's an important balancing feature. The goal here is to make you think carefully about the tactics of using your ammunition wisely. If you want more than twenty arrows, equip a second quiver; that's why you have three slots.

    This component isn't meant to give you enough ammunition to get through a dungeon in one go; it's meant to give you a way to recover your limited ammunition without having to run back to town, and to give you the freedom to use your specialty ammunition without worrying about not having it later.

    I think my issue with it may be more a matter of play style - I do not rest nearly often enough for such changes to be practical for non-magical ammunition. Maybe I rely too much on ranged weapons.
    Mr2150
  • DeeDee Member Posts: 10,447
    edited June 2016
    kjeron said:

    Dee said:

    I'm not going to increase any of the charge limits above 20; 20 is the standard stack size, and that's an important balancing feature. The goal here is to make you think carefully about the tactics of using your ammunition wisely. If you want more than twenty arrows, equip a second quiver; that's why you have three slots.

    This component isn't meant to give you enough ammunition to get through a dungeon in one go; it's meant to give you a way to recover your limited ammunition without having to run back to town, and to give you the freedom to use your specialty ammunition without worrying about not having it later.

    I think my issue with it may be more a matter of play style - I do not rest nearly often enough for such changes to be practical for non-magical ammunition. Maybe I rely too much on ranged weapons.
    That's legitimate--and it's part of what inspired me here. I play ranged characters a lot, and I often find that:

    A ) At a certain point I have so much ammo in my inventory that ammunition becomes irrelevant, and
    B ) I never rest for my spellcasters to regain spells because they're all wielding slings.

    With this component, I find that I'm more likely to rest at a regular pace, and less likely to have my mages sit in the back throwing bullets instead of spells.
    JuliusBorisovAstroBryGuy
  • DeeDee Member Posts: 10,447
    After a bit of review, I'm walking back the numbers for magical ammunition in the Ammunition Recovery component; +1 arrows should feel like +1 longswords when it comes to using them: functionally identical but with a bit of a bonus.

    So I'm working on bumping the +X versions to a charge limit of 20, and the minor secondary effect versions to a maximum charge limit of 10. (Major secondary effects still have a charge limit of 1, because from what I can tell they're only meant to be situational.)
    mf2112
  • DanacmDanacm Member Posts: 950
    @Dee how can i install your mod, there isnt any weidu installer, or just copy paste to overrides ?
  • inethineth Member Posts: 707
    @Danacm:

    It looks like the mod was developed on Mac OSX, where it's customary for users to install their own weidu launcher, and the author forgot (or chose not to) bundle a Windows launcher as most mods do.

    But you can add it yourself:
    1. Extract the mod archive into your game folder, just like you normally would.
    2. Download the latest Windows binary of WeiDU from here.
    3. Extract the weidu.exe file from that download. (You don't need any of the other files.)
    4. Place the weidu.exe into your game folder and rename it to setup-enchant.exe (because "enchant" is the name of the mod's folder and TP2 file.)
    5. Now run it to install the mod.
  • DanacmDanacm Member Posts: 950
    Oh, thank you @ineth :)
Sign In or Register to comment.