Jump to content

Help with portable crafting kit scripting


AnimeOtaku102

Recommended Posts

I know there's already SkyRealism - Crafting Kits, but I want to try something slightly different and make a crafting kit that's a miscellaneous object instead of a pseudo-armor piece. I already have a rough working version, but like aforementioned mod using the item while seated or mounted creates unexpected behavior (especially while mounted), so I want to toss in a few conditional statements to prevent it from being used under certain circumstances. What I have so far is:

 

 

 

Scriptname ArmorModdingKitScript extends ObjectReference

MiscObject Property ArmorModdingKit Auto
ObjectReference Property ArmorModdingKitREF Auto

Event OnEquipped(Actor akActor)

If (akActor == Game.GetPlayer())
If (akActor.IsInCombat()) ;If Player is in combat
debug.messagebox("Now doesn't seem like the best time for that...")
ElseIf (akActor.IsSneaking()) ;If Player is sneaking
debug.messagebox("That would draw too much attention to you.")
ElseIf (akActor.IsSwimming()) ;If Player is swimming
debug.messagebox("Unfortunately you don't have a degree in underwater basket weaving.")
ElseIf (akActor.IsOnMount()) ;If Player is mounted
debug.messagebox("The horse's head makes for a poor workbench, best dismount first...")
ElseIf (akActor.GetSitState() == 3) ;If Player is seated
debug.messagebox("True Nords don't work while resting on their laurels! Get up first!")
Else
Game.DisablePlayerControls(false, false, false, false, false, true, false) ;Close the inventory window by disabling controls
utility.wait(0.1)
Game.EnablePlayerControls(false, false, false, false, false, true, false) ;Enable controls
ArmorModdingKitREF.Activate(Game.GetPlayer()) ;Call the crafting station
EndIf
EndIf

EndEvent

 

 

 

Tested the above code and everything appears to work just fine, but I was wondering if anyone knows of a function to detect when the player is falling? I already tried IsFlying(), but unfortunately that wasn't it.

 

Link to comment
Share on other sites

I don't know if there is a way to check if the player is falling. Perhaps some common sense on the player's part should be expected?

 

Well, it wouldn't break anything if they use the crafting station in freefall, they'll wind up landing anyway, I was just being obsessive about conditions.

 

Also would have been an opportunity to put in another silly message, something along the lines of "Try as you might, you cannot invent and craft a parachute mid-fall."

Link to comment
Share on other sites

Would falling count as being in the jump state? Maybe check if they are jumping: If GetAnimationVariableBool("bInJumpState") == true

Dunno if this check will work though.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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