Zackreaver Posted August 6, 2015 Share Posted August 6, 2015 Perhaps I'm overthinking this but, I'm trying to make a character that can sleep during day, night, dusk, and stay sleeping even when the world state changes. I tried looking into sleeping bags, tents, and siesta's but they only seem to give me the option to specify day and night, as opposed to letting me just remove the check for waking the specific character up. Maybe I'm over thinking this, is there an easy way to just make a character able to sleep anytime? Link to comment https://forums.kleientertainment.com/forums/topic/56820-how-do-i-make-a-character-able-to-sleep-at-any-time/ Share on other sites More sharing options...
DarkXero Posted August 8, 2015 Share Posted August 8, 2015 Perhaps I'm overthinking this but You are not. I'm trying to make a character that can sleep during day, night, dusk easy way Impossible. The tent and the bedroll states are very convoluted.You need to copy paste the entire states and change small details.Everything is hard coded is Wilson's stategraph states. You would need to change the failreasons on onenter on both, and the checks on timeout on the tent state, and the checks on animqueueover on the events on the bedroll state. Whether to sleep or not is up to Wilson. Whether to keep sleeping or not is up to the tent.Any changes you make to the tent or a tent component would be meaningless for that task. Try it:AddPrefabPostInit("tent", function(inst) inst.sleep_phase = "day"end)means you will be able to enter sleep time during night, and keep sleeping through the day until dusk. stay sleeping even when the world state changes. This is easier.AddComponentPostInit("sleepingbag", function(self) local old_dwu = self.DoWakeUp self.DoWakeUp = function(self, nostatechange) local sleeper = self.sleeper if sleeper and sleeper.prefab == "wilson" then local wantstomove = sleeper.components.locomotor:WantsToMoveForward() local ishungry = sleeper.components.hunger:IsStarving() if not wantstomove and not ishungry and not self.inst:HasTag("fire") then return end end old_dwu(self, nostatechange) endend)You will only wake up when:1) Trying to move2) You are starving3) Tent's on fire Link to comment https://forums.kleientertainment.com/forums/topic/56820-how-do-i-make-a-character-able-to-sleep-at-any-time/#findComment-661402 Share on other sites More sharing options...
Maris Posted August 9, 2015 Share Posted August 9, 2015 sleeper.components.locomotor:WantsToMoveForward() Oh thanks. I was trying to make that more people could sleep in tent simultaneous. And I was stuck at DoWakeUp function which has no "doer" parameter. Link to comment https://forums.kleientertainment.com/forums/topic/56820-how-do-i-make-a-character-able-to-sleep-at-any-time/#findComment-661477 Share on other sites More sharing options...
Zackreaver Posted August 9, 2015 Author Share Posted August 9, 2015 You are not. Oh good, I'm glad to hear I wasn't just overlooking something simple. Impossible. The tent and the bedroll states are very convoluted. Yeah it seemed that way, that's what was getting me stumped. Well, the "Doesn't wake during world state change" is good enough, I'll just have the character make a unique straw roll that's only usable during the day. Once again, appreciate the help DarkXero. Link to comment https://forums.kleientertainment.com/forums/topic/56820-how-do-i-make-a-character-able-to-sleep-at-any-time/#findComment-661498 Share on other sites More sharing options...
DarkXero Posted August 9, 2015 Share Posted August 9, 2015 I'll just have the character make a unique straw roll that's only usable during the day You will need a new stategraph state, because bedrolls are hard coded to be used in the night.Might as well edit the bedroll state with an IF for your character then. Link to comment https://forums.kleientertainment.com/forums/topic/56820-how-do-i-make-a-character-able-to-sleep-at-any-time/#findComment-661668 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