pepperman35 Posted May 19, 2023 Share Posted May 19, 2023 Okay, working on a barber shop for my settlement. I have made an animated barber shop pole FO4_BarberShopPole01.nif) and I would like to play its animation “Play01” when the assigned NPC loads into the station (i.e., DLC06WorkshopBarberChair). Likewise, I would like to stop its animation when the assigned NPC leave the station. The animated barber shop pole would signify that the barber shop was either open or closed, depending on whether an NPC was manning the station or not.From a scripting perspective what would be the best way to implement this? I suppose I could put a trigger box around the DLC06WorkshopBarberChair and when the NPC enters or leave it, the barber pole animation could play or not. Event OnActivate might be another option but I don’t readily see a way to turn off the animation via that option. Event Actor.OnSit and Actor.OnGetUp might be a third option. How does one determine if an NPC is assigned to and manning the station? Link to comment Share on other sites More sharing options...
lee3310 Posted May 19, 2023 Share Posted May 19, 2023 (edited) Okay, working on a barber shop for my settlement. I have made an animated barber shop pole FO4_BarberShopPole01.nif) and I would like to play its animation “Play01” when the assigned NPC loads into the station (i.e., DLC06WorkshopBarberChair). Likewise, I would like to stop its animation when the assigned NPC leave the station. The animated barber shop pole would signify that the barber shop was either open or closed, depending on whether an NPC was manning the station or not.From a scripting perspective what would be the best way to implement this? I suppose I could put a trigger box around the DLC06WorkshopBarberChair and when the NPC enters or leave it, the barber pole animation could play or not. Event OnActivate might be another option but I don’t readily see a way to turn off the animation via that option. Event Actor.OnSit and Actor.OnGetUp might be a third option. How does one determine if an NPC is assigned to and manning the station?when NPC is assigned to a furniture ownership should change accordingly, so HasActorRefOwner() could be a way to know that.If BarberChair.HasActorRefOwner() Edited May 19, 2023 by lee3310 Link to comment Share on other sites More sharing options...
pepperman35 Posted May 19, 2023 Author Share Posted May 19, 2023 Good copy lee3310, I shall give that a try. Thank you. Link to comment Share on other sites More sharing options...
pepperman35 Posted May 20, 2023 Author Share Posted May 20, 2023 First attempt: Tried OnActivate with the following script applied to the barber chair. NPC is assigned to the station and manning post. Log file shows no evidence of it being activated and of course the barber pole doesn't animate. Scriptname Bart:BarberShopMannedScript extends ObjectReference Const ObjectReference Property pFO4_BarberShopPole01 Auto Const Mandatory Event OnActivate(ObjectReference akActionRef) Debug.Trace("Bart:WorkshopBarberMannedScript Barber shop activated by " + akActionRef) If (AkActionRef == Game.Getplayer() as ObjectReference == False) If self.HasActorRefOwner() Debug.Trace("Bart:WorkshopBarberMannedScript Barber shop has changed ownership") pFO4_BarberShopPole01.PlayAnimation("Play01") EndIf EndIf EndEvent Link to comment Share on other sites More sharing options...
niston Posted May 20, 2023 Share Posted May 20, 2023 You could listen to OnSit and OnGetUp (but it's on the Actor):https://www.creationkit.com/fallout4/index.php?title=OnSit_-_Actorhttps://www.creationkit.com/fallout4/index.php?title=OnGetUp_-_Actor You could register/unregister for remote OnSit/OnGetUp events when the station is assigned/unassigned, by listening for WorkshopActorAssignedToWork and WorkshopActorUnassigned events.Those two custom events are raised by WorkshopParentScript; ; assign Var[] kargs = new Var[2] kargs[0] = assignedObject kargs[1] = workshopRef wsTrace(" sending WorkshopActorAssignedToWork event") SendCustomEvent("WorkshopActorAssignedToWork", kargs) ; unassign Var[] kargs = new Var[2] kargs[0] = theObject kargs[1] = workshopRef wsTrace(" sending WorkshopActorUnassigned event") SendCustomEvent("WorkshopActorUnassigned", kargs) So, when NPC is assigned to barber, you register for OnSit/OnGetUp events from the NPC.When NPC gets OnSit event, check that refFurniture is proper, start the animation.When NPC gets OnGetUp event, check that refFurniture is proper and stop the animation.When NPC is unassigned from barber object, stop listening for OnSit/OnGetUp and stop animation.IIRC if the NPC dies/gets moved to another workshop/etc, an unassigned event is generated. Link to comment Share on other sites More sharing options...
pepperman35 Posted May 20, 2023 Author Share Posted May 20, 2023 Copy all niston, thank you. I tried a trigger box approach with good results Link to comment Share on other sites More sharing options...
niston Posted May 20, 2023 Share Posted May 20, 2023 Yeah that'll do fine for CK placed stuff.Just saw the video. Good work pepperman35! Have you planned to turn off the light on the barberpole, when anim is stopped? Link to comment Share on other sites More sharing options...
pepperman35 Posted May 20, 2023 Author Share Posted May 20, 2023 (edited) Yeah that'll do fine for CK placed stuff.Just saw the video. Good work pepperman35! Have you planned to turn off the light on the barberpole, when anim is stopped?I think that is an excellent suggestion, and fairly easy to implement. Edited May 21, 2023 by pepperman35 Link to comment Share on other sites More sharing options...
niston Posted May 21, 2023 Share Posted May 21, 2023 Superb! Link to comment Share on other sites More sharing options...
lee3310 Posted May 22, 2023 Share Posted May 22, 2023 Nice, after watching the video i realized that i didn't understand your question. I thought that you want an NPC to man the barber chair and another one (a client) will sit in the chair, similar to how furniture bar works and only then, the pole animation will play (like a no vacancy sign). Link to comment Share on other sites More sharing options...
Recommended Posts