Skip to content

Need Advice on Potential Spell Mod

KalindorKalindor Member Posts: 51
edited July 2018 in General Modding
I am considering adapting some of the spells and abilities that I have previously scripted for NwN into BG2:EE. However, I am not sure of what is possible in this engine with the currently available opcodes, etc. I would like advice from experienced modders about whether the following types of abilities are doable in BG2:EE:

1) Effect that changes the next spell you cast. Examples: "Your next spell lasts twice as long," "Your next spell also deals +2d6 fire damage."
2) As 1 above, but over a duration. Example: "For one turn, any spells you cast heal you for 2d6 hit points."
3) An effect that modifies a specific spell. Examples: "Ice Storm spells cast by you deal an additional 1d6 cold damage," "When you strike an enemy with Chill Touch, they must save vs. death or die."
4) Effects conditional on the target's status. Examples: "Deal 1d10 poison damage + 2d10 additional damage if the target is diseased," "Target suffers 2d6 magic damage for each Enchantment spell affecting them."
5) Copy effects from one creature to another. Example: "Any enchantments affecting you are mirrored on touched ally."
6) Effect that reduces (but does not eliminate) miscast magic chance. This could be used to simulate Still Spell feats on the vanilla armor system, for example.
7) Effect that changes the type of damage dealt. Example: "Damage inflicted by your spells is converted to fire damage."

Thanks in advance for any advice.

-K

Comments

  • kjeronkjeron Member Posts: 2,367
    Most of these are doable, just less than practical.
    Kalindor said:

    1) Effect that changes the next spell you cast. Examples: "Your next spell lasts twice as long,"

    There's an effect to adjust spell duration by a percentage, but it uses a duration, not a spell count. You would just have to modify all spells to remove the effect when they finish casting. It's also indiscriminate, offensive/defensive, positive and negative effects would have the modified duration. A (very) few number of effects are not affected by it though.
    Kalindor said:

    "Your next spell also deals +2d6 fire damage."
    2) As 1 above, but over a duration. Example: "For one turn, any spells you cast heal you for 2d6 hit points."
    3) An effect that modifies a specific spell. Examples: "Ice Storm spells cast by you deal an additional 1d6 cold damage," "When you strike an enemy with Chill Touch, they must save vs. death or die."

    All of these would require modifying the spells(or items) that will have added effects to trigger them, but still doable.
    Kalindor said:

    4) Effects conditional on the target's status. Examples: "Deal 1d10 poison damage + 2d10 additional damage if the target is diseased," "Target suffers 2d6 magic damage for each Enchantment spell affecting them."

    Most simple idea. Subspells can be applied based on any detectable stat/state/spellstate. You might not always get an effect for every single enchantment, as some share these detectable values.
    Kalindor said:

    5) Copy effects from one creature to another. Example: "Any enchantments affecting you are mirrored on touched ally."

    Possible, would require patching every such spell you want copy-able, however, said target ally would receive full duration regardless of how much time was left on the caster.
    Kalindor said:

    6) Effect that reduces (but does not eliminate) miscast magic chance. This could be used to simulate Still Spell feats on the vanilla armor system, for example.

    Miscast Magic modifiers are always positive (cannot be reduced). For something like Still Spell, you would have to split the Miscast effect on the armor into multiple smaller amounts, and provide the creature immunity to them one at a time. Deafness applies +50% miscast chance, that similarly cannot be reduced, only blocked/removed entirely.
    Kalindor said:

    7) Effect that changes the type of damage dealt. Example: "Damage inflicted by your spells is converted to fire damage."

    No such effect. You would need to duplicate the entire spell for each damage type, then filter which spell to cast by a detectable stat/spellstate.
    KalindorArunsunRaduziel
  • KalindorKalindor Member Posts: 51
    Thanks, good to hear. For points 2 and 3, how would I go about rigging the spell to make such a check?
  • kjeronkjeron Member Posts: 2,367
    Files per effect: (SpellA.spl, SpellB.spl, SpellC,spl, EffA.eff), for all: Projectile = 1(None)
    SpellA: (adds the on-cast effect to you):
    - Opcode 177, duration = 60, resource = EffA
    // Use EFF file
    EffA:
    - Opcode = 256, resource = SpellB, parent_resource = SpellA
    // store a false sequencer on yourself

    SpellB: (contains the on-cast effect):
    - Range = 32767, Damage/Heal/whatever

    SpellC: (triggers the on-cast effect):
    - Opcode 256, target = 9 (Original Caster), resource = SpellA
    // releases the sequencer each time you cast this spell

    Add to any desired spell (all headers):
    - Ocpode 146, target = 2, parameter2 = 1, resource = SpellC
    // Cast SpellC

    If you want it to scale with caster level, you would need separate version of each priest/wizard, with the spells flagged as such, otherwise leave all as innate.
    This could also be done by checking a custom Spellstate instead of storing a Sequencer, but there are a limited number of spellstates (~120) available for all mods.
    ArunsunKalindorRaduzielimp51096454
  • KalindorKalindor Member Posts: 51
    Ingenious. I would never have thought of this. Thanks again for spelling it out for me.
  • KalindorKalindor Member Posts: 51
    @kjeron or others, if you wouldn't mind me pestering you with another question, how would one go about making the following spell effect? Would it be possible in BG2:EE?

    "The target gains a +1 bonus to armor class for every two points in the Charisma attribute."

    Much appreciated.
  • kjeronkjeron Member Posts: 2,367
    edited August 2018
    Kalindor said:

    @kjeron or others, if you wouldn't mind me pestering you with another question, how would one go about making the following spell effect? Would it be possible in BG2:EE?

    "The target gains a +1 bonus to armor class for every two points in the Charisma attribute."

    Much appreciated.

    Such an effect would have to be applied repeatedly (generally every round), in order to incorporate changes to charisma score.
    SpellA: (adds the repeat effect to you):
    - Opcode 177, duration = 60, resource = EffA
    // Use EFF file
    EffA:
    - Opcode = 232, resource = SpellB, parameter2 = 20, special = 102
    // cast spell on condition (hp < 102%)
    // hp < 102% will always be true and is checked once per round
    // 102 is used because value must be even or the combat log will be flooded with feedback messages

    SpellB: (contains filters for Charisma):
    - Opcode 326, target = 1, parameter1 = 24 parameter2 = 132 resource = SpellBC
    - // apply effects list (SpellBC) (if Charisma >= 24)
    - Opcode 318, target = 1, parameter1 = 24 parameter2 = 132 duration = 1, resource = SpellB
    - // block remaining effects (of this spell) (if Charisma >= 24)
    - Opcode 326, target = 1, parameter1 = 22 parameter2 = 132 resource = SpellBB
    - Opcode 318, target = 1, parameter1 = 22 parameter2 = 132 duration = 1, resource = SpellB
    - Opcode 326, target = 1, parameter1 = 20 parameter2 = 132 resource = SpellBA
    - Opcode 318, target = 1, parameter1 = 20 parameter2 = 132 duration = 1, resource = SpellB
    - Opcode 326, target = 1, parameter1 = 18 parameter2 = 132 resource = SpellB9
    - Opcode 318, target = 1, parameter1 = 18 parameter2 = 132 duration = 1, resource = SpellB
    - Opcode 326, target = 1, parameter1 = 16 parameter2 = 132 resource = SpellB8
    - Opcode 318, target = 1, parameter1 = 16 parameter2 = 132 duration = 1, resource = SpellB
    - etc...
    - Opcode 326, target = 1, parameter1 = 4 parameter2 = 132 resource = SpellB2
    - Opcode 318, target = 1, parameter1 = 4 parameter2 = 132 duration = 1, resource = SpellB
    - Opcode 326, target = 1, parameter1 = 2 parameter2 = 132 resource = SpellB1
    - Opcode 318, target = 1, parameter1 = 2 parameter2 = 132 duration = 1, resource = SpellB
    - Opcode 326, target = 1, parameter1 = 0 parameter2 = 132 resource = SpellB0
    - Opcode 318, target = 1, parameter1 = 0 parameter2 = 132 duration = 1, resource = SpellB

    SpellBC: (contains effects for 24/25 Charisma):
    - Opcode 321, target = 1, resource = SpellB0
    - // remove effects of all spells applying the various AC bonuses for Charisma
    - Opcode 321, target = 1, resource = SpellB1
    - Opcode 321, target = 1, resource = SpellB2
    - etc..
    - Opcode 321, target = 1, resource = SpellB9
    - Opcode 321, target = 1, resource = SpellBA
    - Opcode 321, target = 1, resource = SpellBB
    - Opcode 321, target = 1, resource = SpellBC
    - Opcode 0, target = 1, parameter1 = 12, duration = 14
    - + any other effects you want for 24/25 Charisma

    SpellB9: (contains effects for 18/19 Charisma):
    - Opcode 321, target = 1, resource = SpellB0
    - Opcode 321, target = 1, resource = SpellB1
    - Opcode 321, target = 1, resource = SpellB2
    - etc..
    - Opcode 321, target = 1, resource = SpellB9
    - Opcode 321, target = 1, resource = SpellBA
    - Opcode 321, target = 1, resource = SpellBB
    - Opcode 321, target = 1, resource = SpellBC
    - Opcode 0, target = 1, parameter1 = 9, duration = 14
    - + any other effects you want for 18/19 Charisma

    SpellB2: (contains effects for 4/5 Charisma):
    - Opcode 321, target = 1, resource = SpellB0
    - Opcode 321, target = 1, resource = SpellB1
    - Opcode 321, target = 1, resource = SpellB2
    - etc..
    - Opcode 321, target = 1, resource = SpellB9
    - Opcode 321, target = 1, resource = SpellBA
    - Opcode 321, target = 1, resource = SpellBB
    - Opcode 321, target = 1, resource = SpellBC
    - Opcode 0, target = 1, parameter1 = 4, duration = 14
    - + any other effects you want for 4/5 Charisma

    etc...
    Kalindorimp51096454
  • KalindorKalindor Member Posts: 51
    Thank you once again. Very interesting strategy. Good to see that it is possible. I wonder if the perpetually triggering nature of such abilities would slow the game down. Hmm.
Sign In or Register to comment.