Hiru315 Posted November 24, 2020 Share Posted November 24, 2020 (edited) So I'm creating a custom character that summon followers like Maxwell. But when I open the save file again in game (onLoad). They'll stop following my character. And I need to kill them to get the penalty sanity back. But that'll crash the game. I thought of some options to fix that but don't know which one is possible and how to: 1_ Makes followers follow the summoning items like Chester or Gloomer. Set the character holding item as owner/leader. 2_ Vanish the followers completely when loading the game. Set max Sanity of the character back to full. If you know any of these options please help Edited November 24, 2020 by Hiru315 Link to comment Share on other sites More sharing options...
Thomas Die Posted November 24, 2020 Share Posted November 24, 2020 Code? (what you have rn) Link to comment Share on other sites More sharing options...
Hiru315 Posted November 25, 2020 Author Share Posted November 25, 2020 (edited) Here's my whole custom character I planned to change the state "Death" in the stategraphs file so followers will restore my character's maxHealth back but can't. Now I think vanish them completely from the game when loading the game again is easiest if it's possible. SOLAR.zip Edited November 25, 2020 by Hiru315 Link to comment Share on other sites More sharing options...
Ziro2k Posted November 27, 2020 Share Posted November 27, 2020 (edited) A player's followers are not saved with the player, so when the player is reloaded its followers will not be bound to them. Maxwell's minions are saved as pets, and are bound/unbound to the player via the petleash component. If you raise the maximum number of pets your character can have to accommodate these followers and then bind them to the player via the petleash component, it should manage spawning and linking them to the player automatically. Note, you'll also need to set these follower prefabs to not persist (inst.persists = false). This just means that the game will not automatically save and load their data, as this will instead be handled by the OnSave/OnLoad functions of the petleash component. Edited November 27, 2020 by Ziro2k 1 Link to comment Share on other sites More sharing options...
Hiru315 Posted November 27, 2020 Author Share Posted November 27, 2020 So I gave the follower component petleash. also set the inst.persists. But it still hasn't worked when loading the game again yet. Also do you know what code to just vanish these followers completely when OnLoad. That's my final way if other ways aren't possible lol. Is it "inst.ShouldLeaveWorld = data.ShouldLeaveWorld" ? Link to comment Share on other sites More sharing options...
Ziro2k Posted November 27, 2020 Share Posted November 27, 2020 (edited) 1 hour ago, Hiru315 said: So I gave the follower component petleash. also set the inst.persists. But it still hasn't worked when loading the game again yet. You don't add the petleash component to the follower. The petleash goes on the player, and it should already exist. Add the following to your character's master_postinit in their prefab file, where X is the maximum number of these followers that you want them to be able to have. inst.components.petleash:SetMaxPets(X + 1) Then instead of using Leader:AddFollower to add these followers to your character, use Petleash:LinkPet. The pet will automatically be added as a follower as well. 1 hour ago, Hiru315 said: Also do you know what code to just vanish these followers completely when OnLoad. That's my final way if other ways aren't possible lol. Is it "inst.ShouldLeaveWorld = data.ShouldLeaveWorld" ? Setting the follower prefab to not persist (inst.persists = false in the prefab file) will take care of this. Note that none of this will work the first time you load the game after making these changes, because you're loading based off of incorrect data. You will need to load the game, create new followers and link them as pets, then save and load again to see the results. Edited November 27, 2020 by Ziro2k 1 Link to comment 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