Berany Posted February 8, 2020 Share Posted February 8, 2020 Hi. I successfully created new creatures with the help of someone nice last time. These creatures are summoned when my character reads a book. When summoned, they were good at following my character. But when I shut down the game and log back on, they don't move. Can you tell me how to get followers to follow my character even after I leave the server and come back in? I'm sorry I always seem to get help. Thank you for reading. Link to comment https://forums.kleientertainment.com/forums/topic/115568-helpmy-custom-follower-doesnt-move/ Share on other sites More sharing options...
mentalistpro Posted February 8, 2020 Share Posted February 8, 2020 (edited) Since I don't have your scripts, so this is what I would do. You may look into how Chester and Abigail follow players in general. For Chester, he will keep following as long as the tag exists. local function OnStartFollowing(inst) inst:AddTag("companion") end local function fn() ... inst:AddComponent("follower") inst:ListenForEvent("startfollowing", OnStartFollowing) ... end For Abigail, she is linked to the player 'permanently'. local function linktoplayer(inst, player) inst.persists = false inst._playerlink = player player.abigail = inst player.components.leader:AddFollower(inst) for k, v in pairs(player.abigail_flowers) do k:Refresh() end player:ListenForEvent("onremove", unlink, inst) end local function fn() ... inst.LinkToPlayer = linktoplayer ... end Edited February 8, 2020 by mentalistpro 1 1 Link to comment https://forums.kleientertainment.com/forums/topic/115568-helpmy-custom-follower-doesnt-move/#findComment-1305897 Share on other sites More sharing options...
Berany Posted February 8, 2020 Author Share Posted February 8, 2020 7 hours ago, mentalistpro said: Since I don't have your scripts, so this is what I would do. You may look into how Chester and Abigail follow players in general. For Chester, he will keep following as long as the tag exists. local function OnStartFollowing(inst) inst:AddTag("companion") end local function fn() ... inst:AddComponent("follower") inst:ListenForEvent("startfollowing", OnStartFollowing) ... end For Abigail, she is linked to the player 'permanently'. local function linktoplayer(inst, player) inst.persists = false inst._playerlink = player player.abigail = inst player.components.leader:AddFollower(inst) for k, v in pairs(player.abigail_flowers) do k:Refresh() end player:ListenForEvent("onremove", unlink, inst) end local function fn() ... inst.LinkToPlayer = linktoplayer ... end Thank you for reply. I wrote the script based on the template someone posted and the code of Abigail. aidenorbbrain.lua aidenorb.lua -This is the follower I made magictools.lua - This is the book that summons the follower. The same problem occurred when I tried to use the code in the template because I thought the code I modified might be wrong. I'm sorry to bother you. Thank you. Link to comment https://forums.kleientertainment.com/forums/topic/115568-helpmy-custom-follower-doesnt-move/#findComment-1306005 Share on other sites More sharing options...
Yakuzashi Posted February 8, 2020 Share Posted February 8, 2020 I am not sure, but this might help. 1 Link to comment https://forums.kleientertainment.com/forums/topic/115568-helpmy-custom-follower-doesnt-move/#findComment-1306065 Share on other sites More sharing options...
Berany Posted February 9, 2020 Author Share Posted February 9, 2020 5 hours ago, Yakuzashi said: I am not sure, but this might help. Thank you but I've already used this tutorial. I don't know why this problem happened, but I came up with a temporary solution. The problem I have is that when I close the server and come back in, my followers don't follow me. So I would rather have the followers automatically disappear from the world when I ended the server. (For example, if I turn off the game, the followers automatically die.) Is there any way to do this? Link to comment https://forums.kleientertainment.com/forums/topic/115568-helpmy-custom-follower-doesnt-move/#findComment-1306154 Share on other sites More sharing options...
Yakuzashi Posted February 9, 2020 Share Posted February 9, 2020 I am afraid it's far beyond my capabilities, but I am pretty sure that someone on this forum will help you. Anyway I hope this will help somehow Line 406: self.inst:ListenForEvent("ms_playerjoined", OnPlayerJoined, TheWorld) Line 407: self.inst:ListenForEvent("ms_playerleft", OnPlayerLeft, TheWorld) Link to comment https://forums.kleientertainment.com/forums/topic/115568-helpmy-custom-follower-doesnt-move/#findComment-1306158 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now