Add perk to all npcs.

Post » Thu Jun 21, 2012 4:20 am

In a few of my mods (see link in sig) I add hidden perks to the player characters which add various effects (ie. penalties while wearing heavy armor).

I do this by starting a quest which runs a script which adds a perk and then finishes the quest and all is well in Tamriel.

The downside is that these effects only affect the player, it would be nice to know how to add that perk to all npcs.

Of course I wouldn't mind if a perk wasn't used and these effects were added in another manner, I just liked the elegance of the perk because it didn't require an on-going script, and it could easily be removed and added via console to disable/enable all the effects.

I'd love any help on the issue!
Thanks!
User avatar
BRIANNA
 
Posts: 3438
Joined: Thu Jan 11, 2007 7:51 pm

Post » Thu Jun 21, 2012 1:23 am

I think you can do this with cloak effects, then simply adding a spell effect that is an ability to the cloak. What would happen is then, that every NPC near you would get this "ability" cast on them, and it sticks. In theory at least.

You can't use perks - NPC's totally ignore them.
User avatar
Kevin S
 
Posts: 3457
Joined: Sat Aug 11, 2007 12:50 pm

Post » Wed Jun 20, 2012 4:40 pm

Thanks, I'll look into using cloaks to accomplish this!

Do npcs also ignore all effects of vanilla perks?
I mean do higher level npcs not get things like power shot or champion's stance, for example?
User avatar
leni
 
Posts: 3461
Joined: Tue Jul 17, 2007 3:58 pm

Post » Thu Jun 21, 2012 5:51 am

You can't use perks - NPC's totally ignore them.

I thought this only applied to dynamically attached perks. AFAIK perks that are pre-added in the CK do work on actors, but I haven't test it myself yet.
User avatar
KIng James
 
Posts: 3499
Joined: Wed Sep 26, 2007 2:54 pm

Post » Thu Jun 21, 2012 3:19 am

http://www.creationkit.com/Dynamically_Attaching_Scripts

NPCs can use vanilla perks, but only if the perks are added to them through the creation kit. Using the http://www.creationkit.com/AddPerk_-_Actor scripting function does nothing to them.

Ninja-d :ninja:

But do check out the link for how to dynamically attach scripts.
User avatar
Dawn Porter
 
Posts: 3449
Joined: Sun Jun 18, 2006 11:17 am

Post » Wed Jun 20, 2012 8:02 pm

What about the "perk to apply" dropdown in the magic effect window? I am assuming no, but doesn't hurt to ask. Would using that, along with a very large radius cloak spell do anything to actors?
User avatar
Kevin Jay
 
Posts: 3431
Joined: Sun Apr 29, 2007 4:29 am

Post » Wed Jun 20, 2012 10:38 pm

What about the "perk to apply" dropdown in the magic effect window? I am assuming no, but doesn't hurt to ask. Would using that, along with a very large radius cloak spell do anything to actors?

I did test that one, and it didn't work for me. I also read somewhere else that perk to apply doesn't work. So put using dynamic Perks out of your mind...
User avatar
NeverStopThe
 
Posts: 3405
Joined: Tue Mar 27, 2007 11:25 pm

Post » Thu Jun 21, 2012 2:29 am

so ... If I'm understanding correctly,
NPCs don't have any perks, not even vanilla perks. So, if for example, the 1st archery overdraw00 perk was changed to multiply damage by 999999, then all enemy archers and also followers would still do their standard damage?

I'm going to play with the cloaks anyways since that's a simple way to just give everything near you the effects you want, but I have a question about those too.
What is the range? If I want enemy archers and mages which start very far away to also have these effects, will cloaks reach them?
User avatar
Hella Beast
 
Posts: 3434
Joined: Mon Jul 16, 2007 2:50 am

Post » Thu Jun 21, 2012 5:36 am

Actors do have Perks, but they can only be added to Actors in the CK. If you add them dynamically on runtime the Perks don't get added to them. So if you want an Actor to have a Perk, pre-add it in the CK.

I bet that the Cloak spells have a setting somewhere that adjusts the range. Haven't looked though.
User avatar
Jarrett Willis
 
Posts: 3409
Joined: Thu Jul 19, 2007 6:01 pm

Post » Thu Jun 21, 2012 12:31 am

Actors do have Perks, but they can only be added to Actors in the CK. If you add them dynamically on runtime the Perks don't get added to them. So if you want an Actor to have a Perk, pre-add it in the CK.

I bet that the Cloak spells have a setting somewhere that adjusts the range. Haven't looked though.

Cloaks are broken into two parts. The cloak magic effect, and then an "aimed, concentration" effect. Each with their corresponding spells.

The cloak effect points to the aimed concentration spell. The cloak effect is what actually detects nearby enemies and "maintains" the second spell on them. Think of it as if you had a turret on your head that shoots the spell "flames" except it shoots a version of the spell flames that has infinite range. It will automatically target nearby actors within its specified radius, aim at them with perfect accuracy, and continually cast the spell at them until they leave the radius. It is an incredibly useful tool for new unique spells. Want a channeled AOE heal other than heals all friends in a radius around you? cloak spells are how to do it.

Now, here is the tricky part that is largely undocumented. Normally the detection radius of the cloak spell (the radius at which it will detect a target and continue casting the second spell on them) is melee range. However, you can specify a radius by changing the MAGNITUDE of the cloak spell, pointing at the cloak magic effect. Not the range setting in the spell, but the MAGNITUDE.

Remember that whatever you enter here will be in feet, so if you are going for a specific radius in game units, you will need to convert between feet and units. Look on the creation kit wiki for more info about units and "general" conversion rates.
User avatar
jaideep singh
 
Posts: 3357
Joined: Sun Jul 08, 2007 8:45 pm

Post » Wed Jun 20, 2012 8:39 pm

thanks maegfaer, but to keep compatibility at it's highest I don't want to modify any more formIDs than I have to, and NPCs are a popular thing to edit in other mods so if I can do it in another way I'll certainly try it out :)

@Elseagoat
Awesome description, very informative, thank you so much.
After reading that I really feel that I can realize this idea.
It'll be a lot of work for me to transfer all my mods over to cloak effects...

If you could suffer me more questions:
Do I still need a quest to add the cloak to the player? As I'm doing with my current hidden perk?
and
Do you know of a very simple mod that adds a very basic cloak that I can dissect in the CK to have a hands-on feel for it?
User avatar
Lillian Cawfield
 
Posts: 3387
Joined: Thu Nov 30, 2006 6:22 pm

Post » Wed Jun 20, 2012 5:12 pm

Best take a look at flame cloak. Find the spell, duplicate it, find the magic effect, duplicate that, find the second spell, duplicate it, and finally the second magic effect. Then point them at each other in that order and you can study them that way. Modifying the magnitude of the first spell is how you boost the "radius" beyond melee range. You may need to uncheck the "no magnitude" flag in the first magic effect to do this. You also want to set the first magic effect from "fire and forget" to constant effect.

Then whatever script you want to run on the nearby enemies, that goes on the SECOND magic effect (not the cloak). You put the cloak effect on yourself, and the cloak effect puts the second concentration/aimed effect on the nearby NPCs.

You will also want to mess with conditions to make it effect everyone near your or just enemies or just NPCs or whatever you want, these conditions go on the second magic effect.

Also remember to remove the keyword "WISpellDangerous from the cloak effect, as this keyword causes a "bug" with cloaks in the vanilla game that removes conjuration summons and reanimations. You need to leave "dispel magic effects with this keyword" checked, otherwise your cloak could potentially be "stacked" and you would have multiple of the same cloak running, so the best way to fix this is by removing that keyword. The only drawback to this is that NPCs near you wont say "That spell looks dangerous, keep away." Which honestly, if you are trying to apply a script to nearby npcs passively, is not something you want anyways. Remove the other keyword too if you want the vanilla flame/frost/lightning cloaks to not remove this ability when you cast them.

You will need some way to add this to the player. The most effective way is through the use of a quest with the player as an alias. Then just drop your cloak in there. This is pretty quick to set up. You could add it straight to the player's actor form, but that would cause incompatibilities.
User avatar
Erin S
 
Posts: 3416
Joined: Sat Jul 29, 2006 2:06 pm

Post » Thu Jun 21, 2012 5:38 am

Thank you so much for the help and quick answers!
I will have a look at all of this as my weekend project :)

Using this knowledge I should also be able to add nice functionality to some of the mods, not just make current functionality better.
Where are the "+Kudos" on this site?! lol
User avatar
Cheryl Rice
 
Posts: 3412
Joined: Sat Aug 11, 2007 7:44 am


Return to V - Skyrim