How to determine if a NPC is a companion

Post » Fri May 17, 2013 1:54 pm

I'm writing a papyrus script using SKSE which http://www.creationkit.com/GetNthRef_-_Cell in the Player's cell. I want to check if any of these NPCs are companions of the player, but I'm not really sure what qualifies an NPC as a companion. Is it sufficient to just check if the NPC is in the PlayerFaction? Does that actually mean they are following the player? Will it be compatible with other companion mods?

User avatar
Lily Evans
 
Posts: 3401
Joined: Thu Aug 31, 2006 11:10 am

Post » Fri May 17, 2013 4:30 am

This is a hard one. Well at least in Oblivion it was and I really doubt it got easier in skyrim. One of the issues in Oblivion was that several of the flags that told an NPC to follow the player was just an actor that was FOLLOWING the player. That COULD mean an ambushing enemy actor or spy not a friend.

Several different strategies were tried but none of them worked in every situation except for the ones that required the player to "mark" an actor as a "companion". For example I made such a mod where you gave a "friendship ring" to the actor. This ring could be detected by any other mod with only 6 lines of code to identify the actor as a companion using a system that did NOT require dependency on my mod (but it did require OBSE).

So the real question is going to be what do YOU define as a follower. Then see what you can do to detect the conditions you define as a follower.

A good start is being in the same faction, not hostile to the player and flagged to follow.

But then if it were me I would use my friendship ring idea instead.

User avatar
Rude_Bitch_420
 
Posts: 3429
Joined: Wed Aug 08, 2007 2:26 pm

Post » Fri May 17, 2013 10:58 am

Thanks for the helpful information. I suspected this would be hard, I think I can find a work around as an alternative to checking for companions in what I'm trying to do though.
User avatar
Kellymarie Heppell
 
Posts: 3456
Joined: Mon Jul 24, 2006 4:37 am

Post » Fri May 17, 2013 12:03 pm

There's http://www.creationkit.com/IsPlayerTeammate_-_Actor but I don't think that will catch mod added companions that do not use the vanilla follower system

- Hypno
User avatar
Heather beauchamp
 
Posts: 3456
Joined: Mon Aug 13, 2007 6:05 pm

Post » Fri May 17, 2013 12:13 am

The teammate flag is supposed to be used for followers, but third party follower systems sometimes turn this off to prevent actors from auto-equipping their best gear. There is no guaranteed way to determine if an actor is a follower, the CurrentFollowerFaction should be used by most follower systems, this is what is used to condition the special follower dialogue.

User avatar
^~LIL B0NE5~^
 
Posts: 3449
Joined: Wed Oct 31, 2007 12:38 pm


Return to V - Skyrim