Jump to content

Help with script - NPC reference


DjaySaint

Recommended Posts

Posted

You should use "Properties".

A property is a reference to an object (pretty much any kind of object) used in Papyrus scripting.

 

Now, if your follower is a static NPC, well defined in one cell, then just add something like:

Actor Property myAmazingFollower Auto

 

And then after saving you MCM, edit the properties, and fill "myAmazingFollower" with the actor that you are adding.

ActorBase can be got in the same way you did for the player: ActorBase followerAB = myAmazingFollower.getLeveledActorBase()

 

In case your "follower" is a generic one, then you need something different.

For example, if you don't care about multiple followers mods, you can garb the ReferenceAlias Follower from the quest DialogueFollower.

If you care about EFF, UFO, etc, then you need to scan the surroundings of the player to find matching NPCs (and every follower mod uses a different way to make them followers.)

 

Last: do not use Game.getPlayer().

Add a property: Actor property PlayerRef Auto

Way faster, way more easy.

 

 

 


Second note. I hope your follower is a custom NPC with a custom actorbase, used only for this follower.

If it is not, then when you alter the ActorBase, then ALL NPCs that are using this ActorBase will have the same change.

The player skin/body/parts/whatever are managed outside the actorbase. Because the player has a specific one.

NPCs may share the same actor base.

 

Posted

You should use "Properties".

A property is a reference to an object (pretty much any kind of object) used in Papyrus scripting.

 

Now, if your follower is a static NPC, well defined in one cell, then just add something like:

Actor Property myAmazingFollower Auto

 

And then after saving you MCM, edit the properties, and fill "myAmazingFollower" with the actor that you are adding.

ActorBase can be got in the same way you did for the player: ActorBase followerAB = myAmazingFollower.getLeveledActorBase()

 

In case your "follower" is a generic one, then you need something different.

For example, if you don't care about multiple followers mods, you can garb the ReferenceAlias Follower from the quest DialogueFollower.

If you care about EFF, UFO, etc, then you need to scan the surroundings of the player to find matching NPCs (and every follower mod uses a different way to make them followers.)

 

Last: do not use Game.getPlayer().

Add a property: Actor property PlayerRef Auto

Way faster, way more easy.

 

Yeah it's a custom NPC follower defined in a cell.

 

The code above is what I was using for my player code, not specifically the follower.  I was adapting it to my follower though.

 

Would you mind if I sent a PM to show you specifically what I have?

 

Thanks for the reply!

Posted

 

...

 

Would you mind if I sent a PM to show you specifically what I have?

 

 

That is fine.

Do not send the full mod or the esp. I don't care too much about them.

Just send me the main scripts (MCM or else), and I will have a look.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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