Jump to content

[LE] Looping script - unsure why?


Hoamaii

Recommended Posts

Hey guys,

 

In case it helps, here's the "counting" side script I've been using to try and understand what's going on - only used with the player so far:

Int Property Count = 0 auto

Event OnActivate(ObjectReference akActionRef)
	If Count == 0
		Debug.Notification("Count 0, SitState " + Game.getPlayer().GetSitState())
		Count = 1
	ElseIf Count == 1
		Debug.Notification("Count 1, SitState " + Game.getPlayer().GetSitState())
		Count = 2
	ElseIf Count == 2
		Debug.Notification("Count 2, SitState " + Game.getPlayer().GetSitState())
		Count = 3
	ElseIf Count == 3
		Debug.Notification("Count 3, SitState " + Game.getPlayer().GetSitState())
		Count = 0
	EndIf
EndEvent

Here's what I get on direct player activation:

 

- when activating to enter the furniture: "Count 0, SitState 2"

- when pressing "E" or "forward" to exit furniture: "Count 1, SitState 4"

- when the _Exit animation plays after pressing "E": Count 2, SitState 4" (note: this never fires if exiting pressing "forward")

 

Here's what I get when using the same furniture running a Sit package on the player:

 

- when entering furniture when the package completes: "Count 0, SitState 0"

- when furniture plays the Sit_Idle: "Count 1, SitState 3"

- none on _Exit animation.

 

In this case, I was using my non-looping script (a few posts up above) to trigger the package, only directly activating the furniture once in game to launch the script. I also used "Trace" instead of "Notification" in an attempt to get time stamps, but that did not give me any usable info.

 

- "Count 0, sitState 0" occurs exactly when the package completes and when _Enter animation starts playing - and despite the fact that I don't call "self.activate" in my "Waiting" State.

- "Count 2, SitState 3" occurs at the end of _Enter animation, when the Sit_Idle animation kicks in. In my above script, that was happening in the "Sitting" state, when registering for control "Activate", and despite the fact that there is no "onActivate" event in that state.

- no activate event received onControlDown(...) - even when I was calling Self.Activate(...) onConrolDown(...) instead of SAE.

 

Notice how direct activation only received SitStates 2 and 4, and package activation only received SitStates 0 and 3. I have absolutely no explanation for that inconsistency. I'm kind of at a loss of other functions to use to try and figure that out atm - RegisterForAnimationEvent and onAnimationEvent do not work on much else than "IdleFurnitureExit" from my experience. My best guess is procedures do not use the same activation system as the targeted furniture's.

 

 

But if you're not gonna use a package on your furniture, Max, I'd think using SitStates as SurfSideNaturals suggests is a good place to start for you.

 

I'd test it a bit further though as I'm not sure how this "SitState/Activation count" plays for NPCs - we know NPCs' activation system differs from the player's BUT that also varies with the type of furniture used (that much I remember from my extensive use of Vanilla furniture in Clearsky). In case they're using a package, at this state of my furniture testings, I have no idea which SitState they'd be in when the furniture's onActivate event fires. I'll post more info if I figure that out.

Link to comment
Share on other sites

Hey Hoamaii,

 

You should be able to use if for both.

 

It will only fire if the sit state is 2 or lower. If you want it to fire on exit then set it to 3 or higher.

 

In both cases it looks like the script will only fire once on enter.

 

Interesting and useful post.

Edited by SurfsideNaturals
Link to comment
Share on other sites

Well Hoamaii you have run into some issues here... that they will need a lot of experimentation and research to figure it out.


The last script i posted does exactly what it's supposed to do, while pressing "E" to exit furniture the second activation never fires because it's in a "Busy State", so i'm done with it.


I didn't try SurfSideNaturals script, but it looks that it also has the correct approach.

Link to comment
Share on other sites

@ SurfSide & @ Max:

 

Yeah, I'm in some sort of uncharted territory with the current mod I'm working on using custom furniture for custom anims... :yes:

 

See, there's yet another issue with furnitures: some will skip at least one of the acyclic _Enter and _Exit animations the first time they're loaded, and that seems to mess up SitStates at times. That's true for every custom furniture animation, but that's also true for some Vanilla furnitures which were created for NPCs only: "woodPickup" is one for sure, but there are others, just can't remember which right now (been 5 years since I played around with them... :ohdear:)

 

But yeah, conditions around SitState 2 should be fine for most cases though :sweat:

Link to comment
Share on other sites

  • Recently Browsing   0 members

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