City of Arabel
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    mw bonus appears to not apply

    Scheduled Pinned Locked Moved Closed Bugs
    5 Posts 3 Posters 201 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • CadizC
      Cadiz
      last edited by

      Area name:
      Issue Location:
      Quest Name:
      Store Name:
      NPC Name:
      NPC Location:
      Server Version:
      Screen Shot:
      Time: https://www.timeanddate.com/

      Issue Description:

      when i cast mw on my gloves there is a temp bonus to the item and it is reflected in the character sheet.

      however when looking at the combat log the bonus is not applied.

      Zool's rule - don't be a dick.

      EchoE 1 Reply Last reply Reply Quote
      • EchoE
        Echo @Cadiz
        last edited by

        Here's the code. Someone help me find why it doesnt work as intended.

        void  AddEnhancementEffectToWeapon(object oMyWeapon, float fDuration) {
            IPSafeAddItemProperty(oMyWeapon, ItemPropertyEnhancementBonus(1), fDuration, X2_IP_ADDPROP_POLICY_KEEP_EXISTING, TRUE, TRUE);
            return;
        }
        
        void main() {
            /*
              Spellcast Hook Code
              Added 2003-07-07 by Georg Zoeller
              If you want to make changes to all spells,
              check x2_inc_spellhook.nss to find out more
        
            */
            if (!X2PreSpellCastCode()) {
                // If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
                return;
            }
        
        // End of Spell Cast Hook
            //Declare major variables
            effect eVis = EffectVisualEffect(VFX_IMP_SUPER_HEROISM);
            effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
            int nDuration = GetAdjustedCasterLevel(OBJECT_SELF);
            int nMetaMagic = GetMetaMagicFeat();
            object oTarget = GetSpellTargetObject();
            object oMyWeapon;
        
            switch (GetObjectType(oTarget)) {
                case OBJECT_TYPE_ITEM:
                    oMyWeapon = oTarget;
                    break;
        
                case OBJECT_TYPE_CREATURE:
                    oMyWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oTarget);
        
                    if (!GetIsObjectValid(oMyWeapon)) {
                        oMyWeapon = GetItemInSlot(INVENTORY_SLOT_ARMS, oTarget);
                    }
        
                    break;
        
                default:
                    SendMessageToPC(OBJECT_SELF, "You must cast this spell at a creature or an item." );
                    return;
                    break;
            }
        
            if (nMetaMagic == METAMAGIC_EXTEND) {
                nDuration = nDuration * 2; //Duration is +100%
            }
        
            if(GetIsObjectValid(oMyWeapon) ) {
                SignalEvent(GetItemPossessor(oMyWeapon), EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));
        
                if (nDuration > 0) {
                    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oMyWeapon));
                    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oMyWeapon), HoursToSeconds(nDuration));
                    AddEnhancementEffectToWeapon(oMyWeapon, HoursToSeconds(nDuration));
                }
        
                return;
            } else {
                FloatingTextStrRefOnCreature(83615, OBJECT_SELF);
                return;
            }
        }
        

        "You can complain if you weren't asked; you can't complain if you were asked but didn't contribute." ~ Professor.

        1 Reply Last reply Reply Quote
        • ZoolZ
          Zool
          last edited by Zool

          Tested in game.

          70d552fd-a953-4908-9760-39048c8ba260-image.png

          Looks to be working just fine

          > !!!MOLES for the MOLE GOD!!!

          CadizC 1 Reply Last reply Reply Quote
          • CadizC
            Cadiz @Zool
            last edited by

            @zool the issue was that i has in this example +11 ab before the mw was cast so the only benefit was that it was enchantment to pass dr and the +1 dam, rather than giving the +1 ab as well

            Zool's rule - don't be a dick.

            ZoolZ 1 Reply Last reply Reply Quote
            • ZoolZ
              Zool @Cadiz
              last edited by

              @cadiz Sure, but I just tested it, and that character had +10 AB, before the spell was cast, and +11 afterwards, with +1 damage and DR piercing.

              They had +1 enchancement, as it says, and it all worked fine.

              So, at the least, I can't reproduce this bug. At most, it doesn't exist.

              > !!!MOLES for the MOLE GOD!!!

              1 Reply Last reply Reply Quote
              • ZoolZ Zool moved this topic from Bug Reports on
              • 1 / 1
              • First post
                Last post