[Papyrus] How to dynamically attach scripts to NPCs

Post » Wed Jun 20, 2012 7:09 am

So, I have tried out the quest alias method, but that is not what I am looking for.(The modAV() lines are stacking on eachother, now I have a stormcloak soldier with more than 500 health points, when I am level 1)
Could somebody help me out, please?
User avatar
R.I.P
 
Posts: 3370
Joined: Sat Dec 01, 2007 8:11 pm

Post » Wed Jun 20, 2012 6:43 am

As far as I know there is just one other method besides the Questalias approach, which is by using an MagicEffect that casts a spell on nearby actors with a script type MagicEffect that has the script attached to it you want to be attached on actors.

If you could explain a bit more in detail what your script is supposed to do mabye we're able to help you understanding why the quest alias approach didn't work for you or how to do it using the Magic Effect approach.
User avatar
Milagros Osorio
 
Posts: 3426
Joined: Fri Aug 25, 2006 4:33 pm

Post » Wed Jun 20, 2012 5:10 am

I don't think the problem is the Alias and its script, because i had ModAV(-1) stack too, but inside an Update Event in a Quest script.

The code was mad and Player was losing randomly -1, or -2, -3, even -5 sometimes. I found this was just because the RFU was (1.0); setting it to a higher value for a low reading frequency solved the problem.
User avatar
Life long Observer
 
Posts: 3476
Joined: Fri Sep 08, 2006 7:07 pm

Post » Wed Jun 20, 2012 7:08 am

As far as I know there is just one other method besides the Questalias approach, which is by using an MagicEffect that casts a spell on nearby actors with a script type MagicEffect that has the script attached to it you want to be attached on actors.

If you could explain a bit more in detail what your script is supposed to do mabye we're able to help you understanding why the quest alias approach didn't work for you or how to do it using the Magic Effect approach.
My problem is that, if I try to add a token, it is then placed into the alias' inventory/perk list.
User avatar
I love YOu
 
Posts: 3505
Joined: Wed Aug 09, 2006 12:05 pm

Post » Wed Jun 20, 2012 1:36 am

I've been trying a combination of the two where I use the QuestAlias trick to find the Actors - then I do actor.addspell to give them the 'ability' which has my script - this seems to be working but you have me worrying now, that perhaps the effect is actually applying to the alias, rather than the actor... must test further :wink:

I believe that AddSpell is safer than AddPerk (from something DukePatrick wrote) - so perhaps you should try AddSpell instead?

Also you may need to make sure you are using http://www.creationkit.com/GetActorReference_-_ReferenceAlias
User avatar
Rachel Eloise Getoutofmyface
 
Posts: 3445
Joined: Mon Oct 09, 2006 5:20 pm

Post » Wed Jun 20, 2012 10:02 am

There's a thread that gives instructions on doing just this. Don't have a link, but try searching for it :)
User avatar
Milagros Osorio
 
Posts: 3426
Joined: Fri Aug 25, 2006 4:33 pm

Post » Wed Jun 20, 2012 4:18 am

@KorJax:
This one, right? http://www.gamesas.com/topic/1349649-dynamically-attaching-scripts-to-actors-near-the-player/

Cipscis
User avatar
Kelsey Anna Farley
 
Posts: 3433
Joined: Fri Jun 30, 2006 10:33 pm

Post » Wed Jun 20, 2012 9:59 am

Yep! Thats the one :P
User avatar
MatthewJontully
 
Posts: 3517
Joined: Thu Mar 08, 2007 9:33 am

Post » Wed Jun 20, 2012 8:03 am

@KorJax:
This one, right? http://www.gamesas.com/topic/1349649-dynamically-attaching-scripts-to-actors-near-the-player/

Cipscis
Yes Cipscis, that was the one I tried out.
User avatar
Erika Ellsworth
 
Posts: 3333
Joined: Sat Jan 06, 2007 5:52 am


Return to V - Skyrim