Jump to content

Script to make an item continuously cycle through its animations


cumbrianlad

Recommended Posts

Don't go out of your way to answer this question, though it would be nice to get it working the way I set out below!

 

I've found a much simpler arrangement that just involves my furniture, recipes and standard dwemer pipe pistons... it still looks pretty cool!

 

Hi.

 

Basically, I've cobbled together a Dwemer workbench that allows the player to craft an ingredient (Crushed Brazing Crystal) if they have a whole crystal in their inventory. That bit works fine.

 

The problem lies in the workbench itself.

 

I have a dwemer piston trap positioned so that when it fires it descends into a bowl below to give the idea that the player puts the crystal in the bowl and the trap crushes it.

 

What I'd like is for the player to walk into a trigger box and the piston to start animating up and down, pausing at the end of each stroke, then stop its animations when the player leaves the trigger.

 

I know the string properties for the animations and events so that I could use PlayAnimationAndwait, followed by Utility.Wait(##) for the pause, but I haven't a clue how to get the thing to work.

 

I tried using two events OnTriggerEnter and OnTriggerleave and 3 states as below. basically this won't compile, throwing a wobbler at LoopingObject.PlayAnimationAndWait with these errors...

 

Starting 1 compile threads for 1 files...

Compiling "MBEJtoggleCrusherScript"...

C:\Program Files (x86)\Steam\SteamApps\common\Skyrim Special Edition\Data\Source\Scripts\temp\MBEJtoggleCrusherScript.psc(20,0): no viable alternative at input 'LoopingObject'

C:\Program Files (x86)\Steam\SteamApps\common\Skyrim Special Edition\Data\Source\Scripts\temp\MBEJtoggleCrusherScript.psc(20,13): mismatched input '.' expecting LPAREN

C:\Program Files (x86)\Steam\SteamApps\common\Skyrim Special Edition\Data\Source\Scripts\temp\MBEJtoggleCrusherScript.psc(0,0): error while attempting to read script MBEJtoggleCrusherScript: Object reference not set to an instance of an object.

No output generated for MBEJtoggleCrusherScript, compilation failed.

 

So my script's rubbish but that's to be expected: I've no idea how to use states. At least it might give you an idea of what I'm trying to do.

 

Scriptname MBEJtoggleCrusherScript extends ObjectReference

 

ObjectReference property LoopingObject auto

String Property FireAnim="Up" auto

String Property FireEvent="TransUp" auto

String Property ResetAnim="Down" auto

String Property ResetEvent="TransDown" auto

 

 

Event OnTriggerEnter(ObjectReference akActionRef)

GoToState("Loop1")

EndEvent

 

Event OnTriggerLeave(ObjectReference akActionRef)

GoToState("LoopEnd")

EndEvent

 

State Loop1

 

LoopingObject.PlayAnimationAndWait(FireAnim,FireEvent)

Utility.Wait(2.0)

GoToState("Loop2")

 

EndState

 

State Loop2

 

LoopingObject.PlayAnimationAndWait(ResetAnim,ResetEvent)

Utility.Wait(2.0)

GoToState("Loop1")

 

EndState

 

State LoopEnd

;Do Nothing

EndState

Link to comment
Share on other sites

Within your states you do not have any events to trigger your code to run. Thus when papyrus is trying to compile it sees "LoopingObject" and thinks it should be a function rather than an ObjectReference property. Try putting the code within the OnBeginState event.

 

Example:

State Loop2
  Event OnBeginState()
    LoopingObject.PlayAnimationAndWait(ResetAnim,ResetEvent)
    UtilityWait(2.0)
    GoToState("Loop1")
  EndEvent
EndState
Link to comment
Share on other sites

  • Recently Browsing   0 members

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