mchoneybee Posted June 16, 2020 Share Posted June 16, 2020 Hello! I'm a semi-new modder and I've gotten pretty good at it, having made do with creating two functional character mods with custom perks and items so far. I think it's been a little over a week, though, so I'm no expert. So, on that note, I'd like some help with figuring out a project I want to work on. I want to create a follower for one of my modded characters-- kind of like abigail, I want her to spawn with an item that can be used to summon the follower. I've looked into a few turorials/templates etc. and I've looked into the official game scripts for abigail and bernie, but my problem is that I can't seem to figure out which files/lines of code are necessary and which ones I can get rid of in favor of customizing and simplifying the follower I want to make. I also can't seem to figure out where to put the files inside my mod's folder so that it's included with just that character and still works properly. Any advice would be appreciated! Link to comment Share on other sites More sharing options...
penguin0616 Posted June 17, 2020 Share Posted June 17, 2020 First, you'll need the "follower" component for the actual follower. Then you'll need a leader. The player is a leader by default, but if you want them to follow the item over the player (like chester), you'll need to add the "leader" component to the item. Once you do that, just bind the follower to a leader. Here's an example. local follower = ... local leader = ... follower:AddComponent("follower") if leader.components.leader == nil then leader:AddComponent("leader") end follower.components.follower:SetLeader(leader) Link to comment Share on other sites More sharing options...
mchoneybee Posted June 18, 2020 Author Share Posted June 18, 2020 17 hours ago, penguin0616 said: First, you'll need the "follower" component for the actual follower. Then you'll need a leader. The player is a leader by default, but if you want them to follow the item over the player (like chester), you'll need to add the "leader" component to the item. Once you do that, just bind the follower to a leader. Here's an example. local follower = ... local leader = ... follower:AddComponent("follower") if leader.components.leader == nil then leader:AddComponent("leader") end follower.components.follower:SetLeader(leader) Ooh, thank you! Would I put this in the follower.lua file under the master.postinit, or...? And then if the player is leader by default I shouldn't need to use the tag for the character I'm attaching the follower to, right? Link to comment Share on other sites More sharing options...
penguin0616 Posted June 18, 2020 Share Posted June 18, 2020 I don't know what you mean by "under master.postinit". I'm assuming you're making your own follower, and I am now assuming this follower is following the player. Because of that, you'll want to add the follower component during construction and you don't have to worry about adding the leader component. Since the leader is a player, you can just "prefab.components.follower:SetLeader(GetPlayer())". Link to comment Share on other sites More sharing options...
mchoneybee Posted June 20, 2020 Author Share Posted June 20, 2020 On 6/17/2020 at 10:19 PM, penguin0616 said: I don't know what you mean by "under master.postinit". I'm assuming you're making your own follower, and I am now assuming this follower is following the player. Because of that, you'll want to add the follower component during construction and you don't have to worry about adding the leader component. Since the leader is a player, you can just "prefab.components.follower:SetLeader(GetPlayer())". Okay cool! This isn't helpful at all to my project, but thank you!! I'll try to use this where I uh, where I can. If I figure out anything else. Link to comment Share on other sites More sharing options...
penguin0616 Posted June 21, 2020 Share Posted June 21, 2020 Feel free to ask further questions if something doesn't make sense. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.