weire Posted April 21, 2025 Share Posted April 21, 2025 In my mod, I set the pig follower stop leashing and stop run after me. So it can be far away from me. And when I join the game or come back from cave, the leadership is not resume unless they are nearby. I already rewrite the cached_player_join_fn, I guess the reason is that the pig is not loaded, thus the "ms_playerjoined" is not listened. anyway to achieve this? I think there are no creature in DST have this feature, when the creature is allow to be far away, they can only follow a things instead of player, like chest, beefalo. Can I achieve it by follower components' onLoad()? is onLoad() run when I come close to the pig or when I join the world? Link to comment https://forums.kleientertainment.com/forums/topic/165428-how-can-i-resume-followers-at-join-when-they-are-far-away-from-me/ Share on other sites More sharing options...
weire Posted April 23, 2025 Author Share Posted April 23, 2025 seems I made it, in the load of pigman, do this inst:RemoveEventCallback("ms_playerjoined", inst.components.follower.cached_player_join_fn, TheWorld) inst.components.follower.CAN_old_cached_player_join_fn = inst.components.follower.cached_player_join_fn inst.components.follower.cached_player_join_fn = function(world, player) dprint("cached_player_join_fn") dprint(player.userid) dprint(inst.components.follower.cached_player_leader_userid) if inst.components.follower.cached_player_leader_userid == player.userid then inst.components.follower:SetLeader(player) end end inst:ListenForEvent("ms_playerjoined", inst.components.follower.cached_player_join_fn, TheWorld) Link to comment https://forums.kleientertainment.com/forums/topic/165428-how-can-i-resume-followers-at-join-when-they-are-far-away-from-me/#findComment-1813678 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