antstubell Posted September 25, 2020 Share Posted September 25, 2020 So here's another of my wacky ideas - almost finished, so player is going yo have Tarot cards read. Conditions are that the NPC reader has to be sitting and player has to be sitting. I have a chair activator and a sit marker which makes player sit, NPC sits as she normally would because she is running Sit package (scheduled, she won't always be there). Using OnActivate for the chair activator to make player sit, is not a problem but I need to register when player gets up/is not sitting and not sitting in that specific chair so other stuff can be disabled/enabled/etc. Wiki says OnSit is not reliable, I'm sure I used this years ago without a problem. So with Sitting in mind what do I need to check for, how would I script, an event that checks player is sitting in THAT chair, the NPC is sitting in HER chair (maybe location conditions are needed here?) - player controls will be disabled during 'the reading' and enabled when it is over so player can get up and finally when player gets up (Is not sitting in THAT chair) then the event is over - but it is repeatable. Phew! Hope I got the idea over and thanks for any input. Link to comment Share on other sites More sharing options...
TyburnKetch Posted September 25, 2020 Share Posted September 25, 2020 (edited) if PlayerRef.GetSitState() == Trueif MysticMeg.GetSitState() == True on their respective chairs? Edited September 25, 2020 by TyburnKetch Link to comment Share on other sites More sharing options...
antstubell Posted September 26, 2020 Author Share Posted September 26, 2020 (edited) Thanks. MysticMeg? Have some respect for the elderly lady her name is Nelly The Hag. EDIT: An OnActivate event though doesn't catch when player stands up. My current script, although not tested, I'm sure will not disable the objects I want. Actor Property PlayerRef AutoActor Property MyActor AutoObjectReference Property ChairMarkerREF AutoObjectReference Property TarotReadBox AutoObjectReference Property TarotGiveBox AutoEvent OnActivate(ObjectReference akActionRef)if akActionRef == PlayerREFChairMarkerREF.Activate(PlayerREF)EndIfIf PlayerRef.GetSitState() == True && MyActor.GetSitState() == TrueDebug.Notification ("I am sitting and so is Nelly")TarotReadBox.Enable()TarotGiveBox.Enable()EndIfIf PlayerRef.GetSitState() == False || MyActor.GetSitState() == FalseTarotReadBox.Disable()TarotGiveBox.Disable()EndIfEndEvent Edited September 26, 2020 by antstubell Link to comment Share on other sites More sharing options...
TyburnKetch Posted September 26, 2020 Share Posted September 26, 2020 Would listening for idlefurnitureexit make any difference? Link to comment Share on other sites More sharing options...
antstubell Posted September 26, 2020 Author Share Posted September 26, 2020 If any suggestion is SKSE related then sorry but SKSE does not work for me. I've been through this many times with help from you guys here and it won't work.Is idlefurnitureexit SKSE? Link to comment Share on other sites More sharing options...
TyburnKetch Posted September 26, 2020 Share Posted September 26, 2020 (edited) No. It is an animation. RegisterForAnimationEvent(idlefurnitureexit); listen for the animation of getting up from a chair Event OnAnimationEvent(); do stuffEndEvent Edited September 26, 2020 by TyburnKetch Link to comment Share on other sites More sharing options...
maxarturo Posted September 26, 2020 Share Posted September 26, 2020 (edited) All 'Furniture' can run an "Activate" event, when pressing "E" to sit and to get up, although there is the issue that the 'Furniture' will send 3 activation events instead of 2, if you use the "Forward" key instead of the "E" key to get up from the furniture. This can easily be resolved by doing the next: Auto State WaitingSitting Event OnActivate(ObjectReference akActionRef) if ( akActionRef == Game.GetPlayer() ) GoToState("Busy") Utility.Wait(2.0) GoToState("StandingUp") ; Do Your Stuff EndIf EndEvent EndState State StandingUp Event OnActivate(ObjectReference akActionRef) GoToState("Busy") if ( akActionRef == Game.GetPlayer() ) Utility.Wait(1.5) EndIf ; Do Your Stuff GoToState("WaitingSitting") EndEvent EndState State Busy Event OnActivate(ObjectReference akActionRef) ;Do nothing. EndEvent EndState The time required (Wait) and the order of the "States" is absolutely crucial for the "Activate Event" to work correctly on a furniture, this is an example script taken from my "Add Blessing On Throne Sit" script, which the time requiered for both animation to play on the throne furniture is exactly, On Sit 2 sec and on Get Up 1.5 sec. Have a plesant day. EDIT: Changed the order of the second "GoToState" in "State StandingUp", it was wrongly assigned. Edited September 28, 2020 by maxarturo Link to comment Share on other sites More sharing options...
TyburnKetch Posted September 27, 2020 Share Posted September 27, 2020 Aha! Yes! Thank you for this maxarturo. You have just explained to me why sometimes my scripts work when I call animation events and other times they do not. I knew about states, but not how the animations sometimes have 2 events and sometimes 3. All about the WAY the user leaves! Link to comment Share on other sites More sharing options...
antstubell Posted September 27, 2020 Author Share Posted September 27, 2020 @maxarturoThis almost works for me. I've added necessary properties and a function that should fire when player sits down. It only fires every second activation. Meaning player sits, my notification appears telling me I am in the function. Player stands, waits then sits again - this time no notification so it didn't go to the function. Third time works fine as 1st time Actor Property PlayerRef AutoObjectReference Property ChairMarkerREF AutoAuto State WaitingSittingEvent OnActivate(ObjectReference akActionRef)if akActionRef == PlayerREFChairMarkerREF.Activate(PlayerREF)GoToState("Busy")Utility.Wait(2.0)GoToState("StandingUp"); Do Your StuffCardRead()EndIfEndEventEndStateState StandingUpEvent OnActivate(ObjectReference akActionRef)if akActionRef == PlayerREFChairMarkerREF.Activate(PlayerREF)GoToState("Busy")Utility.Wait(1.5)EndIfGoToState("WaitingSitting"); Do Your StuffEndEventEndStateState BusyEvent OnActivate(ObjectReference akActionRef);Do nothing.EndEventEndState; ----------------------------------------------------------------------Function CardRead()Debug.Notification ("Waiting for Nelly to read cards")EndFunction Link to comment Share on other sites More sharing options...
maxarturo Posted September 27, 2020 Share Posted September 27, 2020 As i explained, the 'Wait' and the order of the 'States' is absolutely crucial for the "Activate" event to work correctly on a sit furniture. The first thing that needs to fire when activated, is the "Busy" state, otherwise a third activation will be send. From the script i posted, the part you can add your functions is only the part that writes " ; Do Your Stuff ". You cannot modify the script structure without encountering issues. Link to comment Share on other sites More sharing options...
Recommended Posts