Skip to content

How to apply EFF_Files only when equipping either melee or range weapon

gattberserkgattberserk Member Posts: 190
edited February 2017 in General Modding
Hi guys,

Just wanna ask which opcode should I use to create an effect that only apply when I use either range / melee weapon.

For eg.: Extra 1 APS when using melee weapon.


Is such an effect possible?


I try to to look for similar item effect in BGEE, and archer eyes is the closest but it bug me with its interesting opcodes.


It uses opcode 301 with [0x1, 0x1], which means apply 5% critical chance on this weapon. Does it means the items description doesn't apply since it mention only +5% Critical hit chance on ranged attack. How does the engine differentiate between ranged or melee weapon.


Do enlighten me :)

Comments

  • [Deleted User][Deleted User] Posts: 0
    edited February 2017
    The user and all related content has been deleted.
    CrevsDaak
  • kjeronkjeron Member Posts: 2,367


    It uses opcode 301 with [0x1, 0x1], which means apply 5% critical chance on this weapon. Does it means the items description doesn't apply since it mention only +5% Critical hit chance on ranged attack. How does the engine differentiate between ranged or melee weapon.
    Do enlighten me :)

    The "This Weapon only" option only applies if the item is actually a weapon, otherwise its the same as "Always". The field that controls attack type is the last field of the effect, set to Ranged attacks only(2). There is no direct option for most other opcodes, and there is no way for other equipped effects, such as APR, to only affect one attack mode of a throwing weapon.

    If it's a kit ability that's supposed to kick in at a certain level, you'll need to apply a new spell state at a certain level in the kit's clab table, with splstate.ids and opcode 328; and then apply a 326 effect on all melee weapons, filtering by that spell state, and make a subspell with the actual effect.

    Just use the Min/Max Dice fields of the effect or Opcode 177.
  • gattberserkgattberserk Member Posts: 190
    Hi guys,

    Thanks for the insight, but i am still not sure what opcode to use or apply to opcode 177.

    If i select damage type for 177 ids file would that help?


    Also regarding the archer eyes, do you mean there is a 3rd parameter that select ranged attack?
  • The user and all related content has been deleted.
  • kjeronkjeron Member Posts: 2,367

    Also regarding the archer eyes, do you mean there is a 3rd parameter that select ranged attack?

    Yes:

    @subtledoctor if you want to restrict an equipped effect to only apply after a certain level, you can use the fields at offset 0x1c and 0x20 of an item/spell effect:
    0x1c = # dice thrown / maximum level.
    0x20 = Dice size / minimum level.

    Some opcodes use these fields for Dice, such as Opcode12:Damage, the rest use them to restrict level ranges.
    If the opcode does use them as dice, or you need to restrict the effect through opcode 177 anyway, you can to set the min/max level in opcode 177 effect, and set the fields in the *.eff for dice values:

    semiticgoddessCrevsDaakRaduziel
  • gattberserkgattberserk Member Posts: 190
    edited March 2017

    opcode 177 takes an ids type in parameter2 (like, kit.ids) and the particular ids number in parameter1 (like, a particular kit). If you want it tobtarget a custom kit you can use a variable that represents the kit number, derived as explained here.

    It's not clear to me what exactly you're trying to do. The more specific you can be, the more helpful the responses will be.

    kjeron said:


    Just use the Min/Max Dice fields of the effect or Opcode 177.

    Whuh?
    Hmm i wish to create an item that give extra attack per second only with melee weapon. Extra aps does not apply to ranged weapon.

    That apply to throwing axes and knives

  • gattberserkgattberserk Member Posts: 190
    kjeron said:

    Also regarding the archer eyes, do you mean there is a 3rd parameter that select ranged attack?

    Yes:

    @subtledoctor if you want to restrict an equipped effect to only apply after a certain level, you can use the fields at offset 0x1c and 0x20 of an item/spell effect:
    0x1c = # dice thrown / maximum level.
    0x20 = Dice size / minimum level.

    Some opcodes use these fields for Dice, such as Opcode12:Damage, the rest use them to restrict level ranges.
    If the opcode does use them as dice, or you need to restrict the effect through opcode 177 anyway, you can to set the min/max level in opcode 177 effect, and set the fields in the *.eff for dice values:

    I didnt managed to see the attack type using dltcep. Look like i learn smth new today
  • The user and all related content has been deleted.
  • gattberserkgattberserk Member Posts: 190
    edited March 2017

    Oh, like, you wear a helm and it gives you +1 APR in melee but not for ranged combat?

    Yeah I don't think that's possible.

    Well, I mean, you could simulate it, maybe, but it would involve doing all sorts of unholy things to throwing axes and daggers. Even I wouldn't attempt it... and I attempt all sorts of crazy stuff.

    I want to do it to a shield, and only apply a +1 APR to provide a good alternative to Dual wielding. However since you can use a sling and a shield, it doesnt provide a good alternative since I will be tempted to let someone who use sling to use that shield instead.


    Which is why I want to apply +1 APR only to a melee weapon.
  • The user and all related content has been deleted.
  • semiticgoddesssemiticgoddess Member Posts: 14,903
    You can also use "set melee hit effect" to cast a spell on the caster that gives +1 APR for 6 seconds but does not stack. If you're using a melee weapon, you'll get the APR bonus after your first attack, but if you switch to a ranged weapon, it will only last for a single round before vanishing.

    Since there's almost incentive to switch from melee to ranged within a single round due to positioning issues, the exploit wouldn't actually be useful. So the only flaw is that your first melee attack would occur, at worst, 1.5 seconds slower than normal.
  • [Deleted User][Deleted User] Posts: 0
    edited March 2017
    The user and all related content has been deleted.
    Post edited by [Deleted User] on
    semiticgoddess
  • kjeronkjeron Member Posts: 2,367

    Do melee hit effects kick in if you miss your attack roll?

    Nope, doesn't trigger on "Weapon Ineffective" either.
    Would be far simpler to just impose a ranged Thac0/damage Penalty when using said shield.
  • gattberserkgattberserk Member Posts: 190
    kjeron said:

    Do melee hit effects kick in if you miss your attack roll?

    Nope, doesn't trigger on "Weapon Ineffective" either.
    Would be far simpler to just impose a ranged Thac0/damage Penalty when using said shield.
    Or to impose an apr penalty when using a ranged attack that offset the apr bonus of the shield

    Would that be better?
  • gattberserkgattberserk Member Posts: 190
    edited March 2017
    I found a way to achieve what I wanted already.





    Opcode 321 is the key. Removal: Effect specified by Resource.


    First I created 2 spells.

    Spell 1: opcode 321 (Spell 1) + 1 APR (for 2 round),
    Spell 2: opcode 321 (Spell 1)


    Set Melee Effect (248) using Spell 1
    Set Ranged Effect (249) using Spell 2


    Problem solve! :smiley:
    semiticgoddessRaduziel
Sign In or Register to comment.