RedMattis Posted January 26, 2015 Share Posted January 26, 2015 I have a nocturnal character and I want her to be able to sleep at day, but not night. Any ideas for how to go about this? Link to comment https://forums.kleientertainment.com/forums/topic/49761-sleeping-at-day/ Share on other sites More sharing options...
DarkXero Posted January 26, 2015 Share Posted January 26, 2015 http://forums.kleientertainment.com/topic/49116-character-mod-hulot-the-grumpy-owl/ Link to comment https://forums.kleientertainment.com/forums/topic/49761-sleeping-at-day/#findComment-606151 Share on other sites More sharing options...
RedMattis Posted February 1, 2015 Author Share Posted February 1, 2015 http://forums.kleientertainment.com/topic/49116-character-mod-hulot-the-grumpy-owl/I believe he ended up replacing the prefab though. Anyway I'm still stuck on this. I keep getting this error:[string "../mods/Seras/modmain.lua"]:174: attempt to call global 'AddStateGraphPostInit' (a nil value)when I try to modify the WilsonSG function as suggested. Probably I'm making some error with the AddStateGraphPostInit. I don't really get how it works.AddStateGraphPostInit("wilson", function(sg) local oldOnEnter = sg.states.bedroll.onenter function newOnEnter(inst) if inst:HasTag("nocturnal") then -- Code copied from SGWilson inst.components.locomotor:Stop() if TheWorld.state.isnight then inst:PushEvent("performaction", { action = inst.bufferedaction }) inst:ClearBufferedAction() inst.sg:GoToState("idle") inst.components.talker:Say(GetString(inst, TheWorld:HasTag("cave") and "ANNOUNCE_NODAYSLEEP_CAVE" or "ANNOUNCE_NODAYSLEEP")) return end local danger = FindEntity(inst, 10, function(target) return target:HasTag("monster") or target.components.combat and target.components.combat.target == inst end) local hounded = TheWorld.components.hounded if hounded and (hounded:GetWarning() or hounded:GetTimeToAttack() <= 0) then danger = true end if danger then inst:PushEvent("performaction", { action = inst.bufferedaction }) inst:ClearBufferedAction() inst.sg:GoToState("idle") inst.components.talker:Say(GetString(inst, "ANNOUNCE_NODANGERSLEEP")) return end inst.components.health:SetInvincible(true) -- Just while we play the initial anim inst.AnimState:PlayAnimation("action_uniqueitem_pre") inst.AnimState:PushAnimation("bedroll", false) if inst.components.grue ~= nil then inst.components.grue:SetSleeping(true) end if inst.components.talker ~= nil then inst.components.talker:IgnoreAll() end if inst.components.firebug ~= nil then inst.components.firebug:Disable() end inst:OnSleepIn() inst.components.inventory:Hide() if inst.components.playercontroller ~= nil then inst.components.playercontroller:EnableMapControls(false) inst.components.playercontroller:Enable(false) end else oldOnEnter(inst) end endend) Link to comment https://forums.kleientertainment.com/forums/topic/49761-sleeping-at-day/#findComment-608532 Share on other sites More sharing options...
Jjmarco Posted February 1, 2015 Share Posted February 1, 2015 @RedMattis, AddStategraphPostInit, no uppercase G here. Function names are case sensitive. Link to comment https://forums.kleientertainment.com/forums/topic/49761-sleeping-at-day/#findComment-608557 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