Jump to content

Recommended Posts

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?

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 move

2) You are starving

3) Tent's on fire

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.

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...