Jump to content

Magic effect that increases damage done with weapons


Recommended Posts

I have a number of weapons that I wish to give them a special effect. I have a Magic effect with OneHandedMod as assoc.item and it's also a peak value modifier and constant effect. It's basically a direct copy almost from an existing Ench of the vanilla game. I placed this inside a spell and placed it on all races. But it doesn't work.

 

The effect appears in the active effects screen but it does nothing.

 

I want it to be if a player or a npc equips this weapon, they get this magical effect that boosts it's damage. How can I achieve this? And no, I don't want to increase the weapons stat manually, that will cause incompatibility with mods that add weapons with same keywords. I want this effect to affect all weapons of the same type to improve compatibility with other mods.

 

I can't find any information about this and the wiki is useless.

 

How can I grant a weapon damage buff with magic effects?

Link to comment
Share on other sites

Hey, I'm not sure why that wouldn't be working. I wouldn't edit all the races though, because that will conflict with any other mod that changes the vanilla races. It also doesn't account for actors who have custom races added by other mods. A more dynamic way would be to add the spell ability with a cloak that you put on the player. Put the conditions on the cloak's magic effect's assoc item 1 spell: HasKeyword ActorTypeNPC == 1 AND HasSpell MySpellAbility == 0. That way it only affects npc's who don't already have the spell.

 

Another option is to set weapon damage with a script on game load. I do something similar with my Customize Weapon Speed mod. You have to do it every game load because changes to weapon stats don't carry over between loads. This does require skse. Here's a script that will set every weapon in game with a keyword to your specified damage:

 

 

 

Scriptname TM_PlayerAliasScript extends ReferenceAlias 
;Put this script on a ReferenceAlias in a quest, pointing to the player. 
;Specific reference, cell: Any, Ref: PlayerRef.
;Keep the quest start game enabled

Keyword Property MyKeyword Auto 
Int Property NewDamage Auto

Event OnInit()
    SetAllWeaponDamagesWithKeyword(NewDamage, MyKeyword)
EndEvent

Event OnPlayerLoadGame() 
    SetAllWeaponDamagesWithKeyword(NewDamage, MyKeyword) 
EndEvent

Function SetAllWeaponDamagesWithKeyword(Int Damage, Keyword KeyWordToCheck) 
    ;Set all weapons in game with the KeyWordToCheck to the Damage specified. 
    
    ;Debug.Notification("Setting All Weapon Damage")
    
    Int ModCount = Game.GetModCount() 
    Int I = 0 
    While I < ModCount 
        String ModName = Game.GetModName(I) 
        Form[] AllModWeapons = GameData.GetAllWeapons(ModName, None, True, False, False, False) 
        Int M = AllModWeapons.Length 
        If M > 0 
            ;Debug.Notification(ModName + " number of weapons = " + M)
            Int II = 0 
            While II < M 
                If AllModWeapons[II].HasKeyWord(KeyWordToCheck)
                    (AllModWeapons[II] as Weapon).SetBaseDamage(Damage)
                    II += 1
                Endif
            EndWhile
        EndIf
        I += 1
    EndWhile
Endfunction

Name the script something more unique.
If you notice the function takes too long, you can speed it up with threading which is what I had to do with my mod.
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...