Jump to content

Let's talk about NpcBenchChurchSit01


Recommended Posts

As some of you know I have been fleshing out a “working” church concept within a mod that I’ve been laboring over for quite a while. What I’d like to do with this thread is focus a discussion on the furniture object NpcBenchChurchSit01. In my working church concept, I summon the settlers to the church, and seat them into the available pews. I manually summon the pastor to deliver sermon.
Now once the NPCs load into the pews they automatically enter into the prayer animation. But as lee3310 aptly pointed out in the other thread, “I think a normal sitting idle is more appropriate here, you can switch keyword at the end of the sermon but i don't know an easy way to update the idle without making NPCs leave the furniture (exit enter again).” So that is the question for all you creative people: How can we get the NPCs to assume a normal sitting position through the vast majority, then switch to a pray animation on command without leaving and reentering the furniture.
I suppose for the first part of the goal we can remove the AnimFurnPraying keyword and replace it with AnimFurnChairSitAnims. That part seems easy and straight forward. However, the second part not so much. My working hypothesis is that it will likely require a scripting solution, assuming it is even possible. But I wouldn’t artificially dismiss an AI package solution as they seem to be very powerful.
Not a scripting guru by any stretch of the imagination but I would think PlayIdle factors into the solution scripting (e.g., theNPC. PlayIdle(AnimFurnPraying). So for attempt #1, I try something along these lines:
Idle Property FurniturePraying Auto Const
ObjectReference[] Property ActorsAll auto

Function TransitionToPraying()
	int j = 0
	While j < ActorsAll.Length
		WorkshopNPCScript theNPC = ActorsAll[j] as WorkShopNPCScript
		theNPC.PlayIdle(FurniturePraying)
		j += 1
	EndWhile

EndFunction

and call the function from the action in the dialogue scene via a fragment.

Link to comment
Share on other sites

What FurniturePraying Idle does - issues idleLoopingStart when ActionIdle fires after npc takes seat, also has condtions. Chair doesn't have Pray as idleLoop either way.

Looking at how Pew functions is the key, i'd rather won't spoil anything else.

Edited by hereami
Link to comment
Share on other sites

Okay, I swapped out the keywords and the settlers now sit in a normal position. To the best of my knowledge, the above function did nothing so I need to continue researching. hereami has provided a cryptic hint so I'll try to follow the bread crumbs. Perhaps watching kinggath's video tutorial would be useful as well.

 

Edited by pepperman35
Link to comment
Share on other sites

 

As some of you know I have been fleshing out a “working” church concept within a mod that I’ve been laboring over for quite a while. What I’d like to do with this thread is focus a discussion on the furniture object NpcBenchChurchSit01. In my working church concept, I summon the settlers to the church, and seat them into the available pews. I manually summon the pastor to deliver sermon.
Now once the NPCs load into the pews they automatically enter into the prayer animation. But as lee3310 aptly pointed out in the other thread, “I think a normal sitting idle is more appropriate here, you can switch keyword at the end of the sermon but i don't know an easy way to update the idle without making NPCs leave the furniture (exit enter again).” So that is the question for all you creative people: How can we get the NPCs to assume a normal sitting position through the vast majority, then switch to a pray animation on command without leaving and reentering the furniture.
I suppose for the first part of the goal we can remove the AnimFurnPraying keyword and replace it with AnimFurnChairSitAnims. That part seems easy and straight forward. However, the second part not so much. My working hypothesis is that it will likely require a scripting solution, assuming it is even possible. But I wouldn’t artificially dismiss an AI package solution as they seem to be very powerful.

 

When a furniture has an AnimFurn keyword, it usually has more actual idle animations. There should be several "PoseA_IdleFlavor.hkx", "PoseB_IdleFlavor.hkx" files in the animation folders of the "Characters" that can use the furniture. Unfortunately, only one idle animation is played on the sitting NPC.

 

How to change the animation while an NPC is sitting in it is an interesting question. Simply swapping the AnimFurn keywords doesn't work as fas as I remember.. One thing I can think of (but I haven't tried it) is that it may work if one checks the "Random Anim Start" flag on the Furniture form as that should force the game to start an idle flavor anim randomly (unfortunately unpredictably) just like the "Random" flag on Idle Markers which have multiple IdleAnims.

Edited by LarannKiar
Link to comment
Share on other sites

So I wonder if one could combine the sit anims with the pray anims into a custom one and somehow condition the respective poses (maybe with a global variable)?

 

Combining two animations into one seems pretty difficult but playing two Idle Animations (since there are different types of animations I mean the ones here: Creation Kit >> Gameplay >> Animations... >> Idle Animations) that both have FurnitureBehavior is a bit simpler.

 

For reference, take a look at the vanilla animation root FurnitureIdleBarberRoot. It has two idle animations: BarberMirrorPass and BarberCutHair. In the vanilla game, which idle animation will be played is based on the condition GetRandomPercent >= 30. Image if it was GetGlobalValue "MyModAddedGlobal" == 1. So, to switch between the two idle animations, you would only need to add a Sit AI package to the NPC that uses the furniture (the barber), then you can control the animations with a Global as you like.

 

Note that condition check happens when an idle animation is about to start so you can't "skip" the rest of a playing idle animation simply by changing the Global. Once the animation ends, the next one will be played based on the conditions that idle animations in the animation root have. There are also loop and delay options in the "Idle Animations" window, could be useful for fine-tuning.

Edited by LarannKiar
Link to comment
Share on other sites

LarannKiar, thanks for this. I will have to ponder this for a spell. Well, I have the easy part done (i.e., sit packages already assigned to the NPCs) lol

 

But if I am reading the post correctly, achieving this may be possible, which is encouraging.

Edited by pepperman35
Link to comment
Share on other sites

So I wonder if one could combine the sit anims with the pray anims into a custom one and somehow condition the respective poses (maybe with a global variable)?

Well, that's what Pew already does and what bread crumbs say (haha..). Praying subset is engaged separately and overrides default Chair idles, but problem is that's "hardcoded" in Anitamion tree and has no flexible control as it could, unless we patch FurniturePraying idle. Basically, any animation can be played anytime, e.g. Meshes\Actors\Character\Animations\Furniture\Pray\IdleLoop.hkx (which is praying pose under disguise), it just won't have smooth Start/End transition but will pop-in.

 

There's one thing to try - use Request Block Idles flag in package. If not obsolete, supposedly might prevent Pray pose from been imposed by ActionIdle immediately after and randomly during sitting. And if it doesn't block manual calls along the way, then life is easy. Though possibly, npc will sit paralized most of time, hard to say, i never used this flag.

 

Full method would be to duplicate AnimFurnPraying Furniture entry and append it to HumanSubgraph under own keyword (i suppose, Kinggath should explain how to make additive subgraph), then call Pray Loop by custom loose Idle at desired time as properly suggested by script.

Link to comment
Share on other sites

hereami and LarannKiar, thank you both for the input and help. Been experimenting, but nothing solved. Sounds a bit like the 60's...haha. Learning curve is a bit steep here for me as this is one area where I have not dabbled. But I am giving it the ole college try.

Link to comment
Share on other sites

Finally, as fastest test variant, might do the following. Assuming there is duplicated bench used in church (and it needs be, AnimFurnPraying should stay on it), add condition to FurniturePraying idle like Target.GetIsId(myPew)==0. Duplicate FurniturePraying as loose Idle (XEdit: no Parent, no Sibling) and remove all conditions, or just create new Loose with idleLoopingStart command. Then PlayIdle(myFurniturePraying) as necessary.

I'd still tried BlockIdles flag first, sounds promising and isn't fully inert, at least from what i've tried it's the only one that is detected by corresponding condition IsPackageRequestingBlockIdles, while AllowWorldInteractions and OffersServices seem be ignored by their conditions.

 

LarannKiar, Are these options - Loop and Delay - really working? Looks like they have no effect, npc either plays once (dyn_Activation) or indefinitely (dyn_ActivationLoop).

Link to comment
Share on other sites

  • Recently Browsing   0 members

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