Jump to content

Blankets for sleeping NPCs


thorGraves

Recommended Posts

I'd love to edit the "sleeping NPC"-animation to include a blanket. There are some NPC animations in Sykrim with props like "Pulll a tankard out of thin air and drink from it", so it doesn't sound impossible to include a blanket in another animation, however, besides a very few blender experience, I don't even have a clue where to start.

 

A) Is there such a mod allready?

B) If not, does anybody know a tutorial on how to include "props" in an animation?

C) if not B) can anybody give me a clue how these animtions are called in Creation Kit, so I can google for it?

 

Edited by thorGraves
Link to comment
Share on other sites

There's only one house mod I know of that has this feature, and that's Clearsky Hideout. I was hoping that after it's been proven doable that somehow more mod authors would take some steps to put this feature in their own house mods but hasn't happened yet as far as I can tell. Perhaps this functionality is harder to implement than most people can perceive.

Link to comment
Share on other sites

  • 4 weeks later...

I borrowed the blankets from Clearsky Hideout and attached a script to the basemodels of some beds. Currently only the commoner's single-user beds(say the guards barracks in Whiterun). It's not nice, blankets just appear out of thin air, but it works, see the attached screenshot.

 

However I can't find a nice "on deactivate"-Event. So while I can get a loop-free snippet that places the blanket, I can't remove it, without looking every X seconds for "Still in use?". Looks like a receipe for desaster. Does anybody know a better way for this than RegisterforSingleupdate?

Scriptname furniture_autoBlanketSingle extends ObjectReference 
{Usage for Single Beds}

Import MiscUtil; For debugging purposes
ObjectReference Property User Auto 
; Reference to a Misc item created from Clearsky-hideout Blanket Nif
MiscObject Property sheetBaseObj auto
; The container for the actual Sheet
ObjectReference Property sheet=None auto

Event OnActivate(ObjectReference akActionRef)
  if (akActionRef!=None)
    PrintConsole(Self +" activated by " + akActionRef)
    setup(akActionRef)
  EndIf
EndEvent

function setup(ObjectReference akActionRef)
    User=akActionRef
    (User as Actor).UnequipAll() ; <-Don not sleep in Armor
    sheet=Self.placeatme(sheetBaseObj)
    float xR=Self.GetAngleX()
    float yR=Self.GetAngleY()
    float zR=Self.GetAngleZ()
    ; NIF-Model seems to be facing the opposite z-direction:
    sheet.setAngle(xR,yR,zR+180.0)
    float xP=Self.GetPositionX()
    float yP=Self.GetPositionY()
    float zP=Self.GetPositionZ()
    ; z-Coord Needs to be adujusted per Bed-Type, I guess:
    sheet.setPosition(xP,yP,zP+40)    
    RegisterForSingleUpdate(1)
EndFunction

Event OnUpdate()
    if(Self.IsFurnitureInUse())
      PrintConsole(Self +" still in use by "+User)
      RegisterForSingleUpdate(3)
    else
      PrintConsole(Self +" no longer in use")
      cleanup()
    endif
EndEvent

function cleanup()
    UnregisterForUpdate()
    User=None
    PrintConsole("Trying to remove sheet")
    if (sheet!=None)
        PrintConsole("Yep, sheet is still there, so disable and delete it")
        sheet.DisableNoWait()
        sheet.delete()
        sheet=None
    EndIf            
EndFunction

Event OnCellAttach()
    PrintConsole(Self +" attached")
    if(Self.IsFurnitureInUse() && User!=None)
        OnActivate(User)
    EndIf
EndEvent

event OnCellDetach()
    PrintConsole(Self +" detached")
    cleanup()
EndEvent
Edited by thorGraves
Link to comment
Share on other sites

Hi guys,

And sorry to barge in.

ThorGraves just PM'd me about this and the thing is I've been actively working on a 'blankets on every bed' mod for the past few months and it is very well advanced.

In fact, my latest mod Skyrim Sleeping Bag was born from this work which aims at adding blankets on every Skyrim bed.

In any other situation, I'd be more than happy to help - and still, I can probably help with your script, thorGraves. If your intentions are to add blankets to a custom house mod, I'll gladly help you do that using meshes and scripts from my Clearsky Hideout mod. But if you wait a bit, I'll have much nicer meshes and better scripts for you to do that.

 

On the other hand, if your intentions are to develop a mod which also adds blankets to every bed in Skyrim - I'd rather have you wait till I've uploaded my own mod before I let you use some of its assets.

 

I'm aware it may sound a bit uncooperative at the moment, and I'm sorry about that, but I've put so much work into this that, well, I'd rather finish it before I let it be used as a modders resource.

 

Thank you for understanding, guys.

Link to comment
Share on other sites

This sounds awesome! I did love how it worked in Clearsky Hideout, so I'm looking forward to seeing this upcoming mod. My mod has close to 80 beds that can be used by NPCs & followers, & it would be great to see them using blankets :)

Link to comment
Share on other sites

Ooh... 80 beds?!... Mhm, don't know, if you've got 80 sleepers, that's 80 instances of the same script running... o_O

 

Then, on the other hand, that'd probably be the ideal ground for a crash test!... :woot:

Link to comment
Share on other sites

LOL, maybe not then. The most that would be used in a single cell is 48, but I know very little about scripting, & have avoided them in my mod as much as possible to avoid lag. It would be cool if it somehow worked as a toggle, so the scripts were only activated when an NPC gets in or out of bed, & not the rest of the time. It still sounds like an awesome mod though, & I look forward to seeing it :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...