Attaching script to all NPCs?

Post » Mon Jun 18, 2012 1:04 pm

Basically what I'm trying to do is add some social functionality to all NPCs the player encounters - to that end I'll need to have some code that affects all the NPCs - since I want a kind of crowd interaction, where you might get someone randomly that is, for instance, really impressed by your dragon-ness and starts a dialog. Otherwise I'd have to limit it to player-initiated conversations.

Assuming it would actually work, I've considered altering the ActorBase itself (extending/inheriting wouldn't work since the NPCs wouldn't reference the new class object). But I would like to avoid that, since injecting dependencies into the base classes is begging for mod conflicts and future patch problems.

I've also been looking at package stacks, or AI packages, but I still get back to needing it to affect ALL NPCs.

Does anyone know of a way that this could be done without editing a mess of core NPC classes/templates etc?
User avatar
Danial Zachery
 
Posts: 3451
Joined: Fri Aug 24, 2007 5:41 am

Post » Mon Jun 18, 2012 1:45 pm

I think a Quest would be the way to go, Make a script and extend the Actor class, then do a check to see if the actor is NOT the player. Done.
User avatar
Bitter End
 
Posts: 3418
Joined: Fri Sep 08, 2006 11:40 am

Post » Mon Jun 18, 2012 1:12 pm

I think that's what the alias system is for. I haven't really looked into the dialogue\quest system that much 'cause it's so cumbersome but I'm pretty sure you'd create a quest which assigns an alias to a random NPC, with a script or package that tells it to approach the player and initiate dialogue. I think some of the companions quests use Alias assignments, and Couriers would be a good example of making an NPC follow and initiate dialogue.

The description of what you're trying to do foreshadows the entire world approaching the player to initiate dialogue.
User avatar
Janette Segura
 
Posts: 3512
Joined: Wed Aug 22, 2007 12:36 am

Post » Mon Jun 18, 2012 9:29 am

sounds like a good idea, if i can spawn a random NPC, then the player scripts can handle rolling he chances if its going to happen instead of the NPCs doing it, much less impact that way - I'll also need to dig into the aliases, haven't touched those yet
User avatar
Music Show
 
Posts: 3512
Joined: Sun Sep 09, 2007 10:53 am


Return to V - Skyrim