Jump to content

Cannot interact with custom crafting menu from sitting?


Recommended Posts

In short: I'm making a super simple version of "Spell Research", where the "Research Journal" misc. item just activates a crafting menu (a piece of custom furniture in a hidden cell) from which you can craft a "spell thesis" directly (another misc item which actually teaches the spell). And it works! Well, except for one minor thing.

 

Here's the script attached to the player alias:

 

 

 

Scriptname SpellResearchLitePlayerScript extends ReferenceAlias  

Actor Property PlayerRef Auto
ObjectReference Property SpellCraftingMenu Auto
Keyword Property SpellJournal Auto
Keyword Property SpellThesis Auto
Idle Property IdleWriteLedgerEnter Auto
Idle Property IdleWriteLedgerWrite Auto
Idle Property IdleBookSitting_Reading Auto
Idle Property IdleBookSitting_TurnManyPages Auto
Idle Property IdleStop_Loose Auto
Message Property MsgInCombat Auto
Message Property MsgIsTrespassing Auto
Message Property MsgIsSwimming Auto
Message Property MsgHasWeaponOut Auto


Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)
    if(akBaseObject.HasKeyword(SpellJournal))
        if PlayerRef.IsInCombat()
            MsgInCombat.Show()
        elseif PlayerRef.IsTrespassing()
            MsgIsTrespassing.Show()
        elseif PlayerRef.IsSwimming()
            MsgIsSwimming.Show()
        elseif PlayerRef.IsWeaponDrawn()
            MsgHasWeaponOut.Show()
        else
            Game.DisablePlayerControls()
            Utility.Wait(0.1)
            Game.EnablePlayerControls()
            RegisterForMenu("Crafting Menu")
            Utility.Wait(0.1)
            SpellCraftingMenu.Activate(PlayerRef)
            Utility.Wait(0.25)
            if (PlayerRef.GetSitState() >= 3)
                PlayerRef.PlayIdle(IdleBookSitting_Reading)
            else
                PlayerRef.PlayIdle(IdleWriteLedgerEnter)
            endif
        endif
    endif    
EndEvent

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
    if(akBaseItem.HasKeyword(SpellThesis))
        if (PlayerRef.GetSitState() >= 3)
            PlayerRef.PlayIdle(IdleBookSitting_TurnManyPages)
        else
            PlayerRef.PlayIdle(IdleWriteLedgerWrite)
        endif
    endif
EndEvent

Event OnMenuClose(String MenuName)
    if MenuName == "Crafting Menu"
        UnregisterForMenu("Crafting Menu")
        PlayerRef.PlayIdle(IdleStop_Loose)
    endif
EndEvent

 

 

Like I said, it all works as intended, but only while the player is standing. As you can tell from the script, I've tried to tell it to use a different set of animations depending on whether the player is sitting or standing (since "studying" is a thing one does while sitting down, generally). However, if the journal is activated while sitting, the player just stands up, and nothing else happens (the crafting menu does not appear). I know there's no problems with the sitting idles themselves; I'm using them on another OnEquipped script attached to the crafted theses and they work fine there. I've tried tweaking the script a few different ways, but the only conclusion I can come to is that "activating" the hidden crafting menu object just automatically kicks you out of the sitting animation (then the transition animation prevents the crafting menu from opening, I'm assuming). Can anyone confirm if this is indeed the case?

 

I've noticed that custom crafting menus using a similar mechanism from Campfire, Hunterborn, etc., also don't work at all while sitting - I assume now due to this same limitation.

 

Would there be a way around this? Or is there some other screw-up in my script I'm not seeing (I'm a rank amateur when it comes to papyrus, if that isn't obvious)? Worst case, my mod will still work with the limitation of only being able to use the journal while standing, but I wanted to give it this little bit of extra flavor if possible...

 

Anyway, thanks in advance for any insights!

Edited by JazzKiwifruit
Link to comment
Share on other sites

The player is unable to activate a furniture object if they're already using a furniture, that's why they're standing up. The same applies to trying to make them player a furniture idle.

 

This is why mods of mine as well as Hunterborn work that way.

 

I'm not certain if this is the case if the furniture being activated has no sit markers, something you could try. In that case if it works it would just open the crafting menu and no animation would play.

Link to comment
Share on other sites

The player is unable to activate a furniture object if they're already using a furniture, that's why they're standing up. The same applies to trying to make them player a furniture idle.

 

This is why mods of mine as well as Hunterborn work that way.

 

I'm not certain if this is the case if the furniture being activated has no sit markers, something you could try. In that case if it works it would just open the crafting menu and no animation would play.

Ah, thank you. That makes sense. I'll try that out, but I'm pretty sure there's already no sit markers on the custom furniture I'm using. Even if I could get the crafting menu to open while sitting with no animations, that would be better than nothing.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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