Jump to content

Give everybody a list of extra perks


Seattleite

Recommended Posts

I can't script. I have a mod that's been on the Nexus for years, on the Skyrim Nexus though it works with the Special Edition as well, which is a massive gameplay overhaul. The problem is, it has a specific shortcoming because I can't script. There is a list of perks in it that the player gets by default, and they should be given to every NPC, not just the player. This includes the basic versions of the weapon specialisation perks, so all maces and hammers bypass some of the enemy's armour, all blades and bows can crit and all axes cause bleeding. It also includes perks that give you weaker versions of Deflect Arrows and Elemental Protection.

 

What I need is a script made that will apply these to every single character in the game, so these traits apply to all of the player's enemies, not just the ones who were given these perks in the vanilla game. Is such a thing possible? And is anybody willing to help me out with this? It doesn't feel right to bring a gameplay overhaul to the SE Nexus and not add anything to it.

Link to comment
Share on other sites

Hey, yes this is possible. The best way to do it is to use a cloak spell, with conditions. I've done similar things in my mods, most recently NPC Death Alert's SSE.

 

Since you're adding multiple perks, I would make a new formlist and put all the perks you want to add to npc's in it. To make a spell that adds the perks to NPC's. Create a new magic effect, with archytype: script, casting type: Concentration, Delivery: Aimed. Make sure the No Hit Effect, No Hit Event, Painless and Hide in UI boxes are checked. Compile This Script:

 

 

 

Scriptname MyModAddPerksScript extends ActiveMagicEffect 


Formlist Property MyPerkList Auto 


Event OnEffectStart(Actor akTarget, Actor akCaster)
    Int M = MyPerkList.GetSize() 
    While M > 0
        M -= 1 ;subtracts 1 from M
        Perk PerkToAdd = MyPerkList.GetAt(M) as perk 
        akTarget.AddPerk(PerkToAdd) ;adds nth perk in list to the npc
    EndWhile
    
EndEvent

 

 

 

 

Name the script something unique. Also make sure your perk formlist is named the same in your script as in the CK. Compile the script. I recommend Skyrim Script Compiler Pro: https://www.nexusmods.com/skyrimspecialedition/mods/31700 for compiling scripts. Then in your magic effect, add the script. After adding, click the Properties tab, then click Auto Fill All. If your property in the script is named the same as in the CK it will be set automatically to the right one.

 

Then make a new spell. Type: Spell, Casting: Concentration, Delivery: Aimed. Add the magic effect you just made with the script on it to your spell, and put the condition HasPerk <1st perk in your list> == 0. This way, the spell will only affect NPC's that don't already have your perks. If you only want it to run on humanoids you should also put the condition: HasKeyword ActorTypeNPC == 1.

 

Next you make the cloak spell. Create another new magic effect. Archetype: Cloak, Casting: Constant Effect, Delivery: Self. Make sure those same boxes are checked on this effect. Set the Assoc. Item 1 to the spell you just made, with the script on it. Then make a new spell, Type: Ability, Casting: Constant Effect, Delivery: Self, and put the cloak magic effect you just made on it, with the condition GetIsID Player == 1. The magnitude that you put on the magic effect determines the radius of the cloak in units. I recommend 10,000. When standing in the middle of whiterun, this will cover all of whiterun. Any NPC in this radius that doesn't already have your perks will have them added.

 

Next you need a way to actually add the cloak ability to your player. What I do, is make a quest, make sure that the Start Game Enabled box is checked. Compile this script and attach it to the quest on the scripts tab all the way to the right:

 

 

 

Scriptname MyModAddCloakScript extends Quest 


Spell Property MyCloakSpell Auto 


Event OnInit()
    Utility.Wait(1)
    Game.GetPlayer().AddSpell(MyCloakSpell) ;add cloak to player
    Utility.Wait(1)
    Self.Stop() ;stops this quest
EndEvent

 

 

 

After attaching the script again hit the properties tab, and Auto Fill All. Make sure you cloak spell is named the same in the script as in the CK. This way, the cloak spell is automatically added to the player after installing the mod. That's the last step.

Edited by dylbill
Link to comment
Share on other sites

No prob. In your Skyrim/Data folder, you should have a scripts.zip file. Unzip it. If you don't have it, you may have to re-install the creation kit. In your Skyrim/Data/Scripts folder, make a new folder called Source. Then copy all the files from Data/Source/Scripts and paste them in Data/Scripts/Source. You need the loose scripts and source files to compile scripts.

Link to comment
Share on other sites

  • 1 month later...
Guest deleted88154788

I can't script. I have a mod that's been on the Nexus for years, on the Skyrim Nexus though it works with the Special Edition as well, which is a massive gameplay overhaul. The problem is, it has a specific shortcoming because I can't script. There is a list of perks in it that the player gets by default, and they should be given to every NPC, not just the player. This includes the basic versions of the weapon specialisation perks, so all maces and hammers bypass some of the enemy's armour, all blades and bows can crit and all axes cause bleeding. It also includes perks that give you weaker versions of Deflect Arrows and Elemental Protection.

 

What I need is a script made that will apply these to every single character in the game, so these traits apply to all of the player's enemies, not just the ones who were given these perks in the vanilla game. Is such a thing possible? And is anybody willing to help me out with this? It doesn't feel right to bring a gameplay overhaul to the SE Nexus and not add anything to it.

Sorry for bringing this thread back up, but I'm also interested in this script. However I'm confused on this line:

 

"akTarget.AddPerk(PerkToAdd) ;adds nth perk in list to the npc"

 

Do I need to place a perk name there if I'm adding several, or do I write all of them there? And what's a "nth" perk?

Link to comment
Share on other sites

Actually, this method won't work. Adding perks to NPC's with a script doesn't work on them apparently, it only works for the player. Instead, I would suggest using spell abilities. In the creation kit, put all of your spell abilities you want to add to NPC's in a formlist:

 

 

 

Scriptname MyModAddAbilitiesScript extends ActiveMagicEffect 

Formlist Property MyAbilitiesList Auto ;put all abilities to be added in this list


Event OnEffectStart(Actor akTarget, Actor akCaster)
    Int M = MyAbilitiesList.GetSize() 
    While M > 0
        M -= 1 ;subtracts 1 from M
        Spell SpellToAdd = MyAbilitiesList.GetAt(M) as spell
        akTarget.AddSpell(SpellToAdd) ;adds nth perk in list to the npc
    EndWhile
EndEvent

 

Instead put the condition HasSpell <1st spell in list> == 0 on the concentration spell.

Edited by dylbill
Link to comment
Share on other sites

  • Recently Browsing   0 members

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