Skip to content

How difficult is it to create an upgradable weapon?

TomeTome Member Posts: 466
Hey guys, I've been toying with the idea of having a 'signature' weapon for my Bhaalspawn this time round that grows with him as the game progresses. I managed the acquisition simply enough in BG:EE, just adding it to the inventory of the Demon Knight at the end of Durlag's Tower and should be able to add it easily to Irenicus' dungeon, so re-acquisition isn't a huge concern for me. However, I have no experience with item upgrades at all and was wondering if it was hard to learn. For context, I'm a pretty terrible modder: I can make functional items using DLTCEP with ease and have made a few kit mods for pre 2.0 that haven't been brought up to date and that is essentially the end of my abilities. I can't use WEIDU at all.

Worst case scenario I can just tweak the item as I go along using DLTCEP, but I'd rather keep it 'immersive' if at all possible so I don't need to enable the console. Thanks for any advice you can offer! :smile:

Comments

  • GodGod Member Posts: 1,150
    edited November 2016
    Item upgrades in Infinity Engine games are normally handled by using separate item files for the basic and upgraded item states.

    Since you're using the awesomely powerful DLTCEP:
    1. Create a complete set of weapons beforehand, one separate item file for each progressive incarnation of it. Make sure to label them in a way that makes it easy for you to figure out which one is which.
    2. In the Extended Effects tab, add an ability to spawn the next item in the series to each variant except the final one. If you want, make this ability expend the existing weapon. One way to achieve this is to make the upgrade ability consume 1 charge and give the item a 1 charge maximum. This should link your items in a upgrade chain, such that allows you to replace your weapon with the next one at will.
    Should be easy as that.
    I may be wrong though, as I don't have a BG2EE installation to check if it'd work like I remember it should.
  • TomeTome Member Posts: 466
    Thank you very much! I'd toyed with using a spawn effect, but I'd have never thought of coupling it with a charge system to expend the old version of the weapon. Would it be possible to add additional conditions to the upgrade without requiring a hugely more complex implementation? Such as needing certain quests completed or additional items a la Cromwell's Forge. Just for a more immersive feeling of 'earning' the item.
  • GodGod Member Posts: 1,150
    It's been a while since I did anything remotely related to quests, but IIRC checking quest flags is more complex a task.

    However, know that you already are able to pull off a functional extra component mechanic with the very same method you just learned. Let me show you how.

    Design a set of dedicated crafting items, one per upgrade, to be sacrificed in the upgrade process, or repurpose some already existing items if that's what you'd prefer. Once you have your crafting items nice and ready, instead of assigning a charged ability to the weapon itself, assign one to the extra component, such that will spawn your upgraded weapon as well as remove the previous one. For that purpose, you need to use two opcodes, the item creation opcode you already used, and a similar one that removes a referenced item (the old unwanted weapon) from the inventory. Ensure that both are placed under the same header, as you don't want two separate abilities on a 1 charge item, but rather one ability with two simultaneous effects. As a result, you will be able to use the extra component to upgrade the weapon. Once you have verified that the upgrades are working correctly in-game, simply place your items wherever you'd like to 'earn' them :smile:
    Note that since there are no actual item checks present, the previous weapon is not explicitly required to create the upgraded variant. One could prevent the weapon from being removed just by dropping it, but I trust you can refrain from exploiting this.

    Dialogues are a proper, exploit-proof way to implement a crafting system, but delving into that would be an overkill I think.
  • TomeTome Member Posts: 466
    That's a fantastic insight, thank you very much-also means no charge display on the weapon proper, meaning it won't look weird. Will definitely give this a go! :) Might meddle with Cromwell and WeiDu too, just as a learning exercise, although I doubt I'll risk actually going through with it on my main game.
Sign In or Register to comment.