caballi Posted September 21, 2024 Share Posted September 21, 2024 How do I force my character to change with each passing day? I'm having a hard time finding data because I'm not good at English. If you can help me, I will thank you positively in any way. Please help me. Link to comment https://forums.kleientertainment.com/forums/topic/159873-how-to-create-a-random-character/ Share on other sites More sharing options...
yanecc Posted September 21, 2024 Share Posted September 21, 2024 3 hours ago, caballi said: How do I force my character to change with each passing day? I'm having a hard time finding data because I'm not good at English. If you can help me, I will thank you positively in any way. Please help me. What do u want to change? to another character? I think you could make it through the seamlessplayerswapper component, something like: local roles = {"wormwood", "wanda", "wendy"} local function ChangeRole(inst) local current_role = inst.prefab local new_role = current_role -- make sure a different character while new_role == current_role do local index = math.random(#roles) new_role = roles[index] end inst.components.seamlessplayerswapper:_StartSwap(new_role) end local function OnDayComplete(inst) if inst == GLOBAL.ThePlayer then inst:DoTaskInTime(0, ChangeRole) end end AddPlayerPostInit(function(inst) inst:WatchWorldState("cycles", OnDayComplete) end) Link to comment https://forums.kleientertainment.com/forums/topic/159873-how-to-create-a-random-character/#findComment-1749874 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