Jump to content

Add AI Package to NPC dynamically (by casting spell on them)


Recommended Posts

Hi! SO I want to add an AI package to NPCs dynamically, by casting spell on them. To do this I created a quest that reacts to a spell casting. Then I added an alias reference for the actor that a spell is cast on, and for that alias I added an AI package, in this case to make them follow me.


However this does not work in the game when I cast spells on NPCs. Am I missing some steps? I have to say I'm pretty new with the aliases and they kind of really confuse me. So I'm not sure I did this right.


Link to comment
Share on other sites

ReferenceAlias property MyActorRef Auto
 
;begin spell script
MyActorRef.ForceRefTo(akTarget)
;rest of spell script

should do it. Make sure the quest is already running before you attempt to force the ref alias. ForceRefTo() always forces an EVP afaik so they should respond immediately.

 

n.b. make sure the quest thats running the follow package has a fairly high priority because if they're already in a high priority quest its packages will take precedence over your package and they won't follow you. Check the vanilla follower quest (DialogueFollower iirc) for guidelines as to priority

 

 

 

Hi! I wonder if it's possible to add an AI Package to all NPCs at once? Say if I want every NPC in game to force greet me with a certain dialogue. Or say a certain category of NPCs.

I know only how to manually add an ai package to a specific actor. But see no ways to implement it on everybody at once. Thank you in advance for help!

 

 

Probably easiest to start a quest let it fill a number of reference aliases with actors from the loaded cell area and stop the quest when the cell unloads

 

Reference Alias window > Find Matching Reference > In Loaded Area

Edited by soupdragon1234
Link to comment
Share on other sites

ReferenceAlias property MyActorRef Auto
 
;begin spell script
MyActorRef.ForceRefTo(akTarget)
;rest of spell script

should do it. Make sure the quest is already running before you attempt to force the ref alias. ForceRefTo() always forces an EVP afaik so they should respond immediately.

 

n.b. make sure the quest thats running the follow package has a fairly high priority because if they're already in a high priority quest its packages will take precedence over your package and they won't follow you. Check the vanilla follower quest (DialogueFollower iirc) for guidelines as to priority

 

 

 

Hi! I wonder if it's possible to add an AI Package to all NPCs at once? Say if I want every NPC in game to force greet me with a certain dialogue. Or say a certain category of NPCs.

I know only how to manually add an ai package to a specific actor. But see no ways to implement it on everybody at once. Thank you in advance for help!

 

 

Probably easiest to start a quest let it fill a number of reference aliases with actors from the loaded cell area and stop the quest when the cell unloads

 

Reference Alias window > Find Matching Reference > In Loaded Area

 

Thank you for your help! Works perfectly now!

Edited by blackandwhite1459
Link to comment
Share on other sites

  • Recently Browsing   0 members

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