Jump to content

How i can change Animation, that NPC plays on Furniture


Recommended Posts

Hi,
I have a mod that is supposed to show 'steak eating at the table' when the NPCs are eating. But with me only the animation 'Writing at the table' is played.

In the Furniture Idles Window (CK)
under FurnitureUseItemRoot is also the 'Eating in Furniture' animation in the first place, further below is FurnitureWriting, but only that is played.

How can I force the NPC to play only the 'Eating in Furniture' animation and what criteria is used to select the animation? The table Furniture has the keyword 'AnimFurnAllowEating', but still the writing animation is played.

Link to comment
Share on other sites

is this what youre looking for ?

Just make sure you duplicate and rename the furniture and use the copy if you want to edit the base

Just add or delete the animation you want...

wkLVBX.jpg

Link to comment
Share on other sites

Problem solved.

Thanks! You have given me the idea.

I just set the keyword condition for the write animation to 0.
Works.

tableanimation_nnes_sgbkpy.jpg

 

Still the question remains, which animation is played when multiple conditions match?

Could I use a script command to select which animation to play?


Edited by EagleFour
Link to comment
Share on other sites

Can play LOOSE idles by PlayIdle. For some example DefaultAliasReadWhileSittingScript.

 

But i'm curious now how does the above "work". This idleEatStart is default thing they do while sitting - drink from a glass, not eating at table.

Second, have changed the condition in Animation tree for entire game instead of fixing a single object.

 

I suppose only first successfully matching animation entry in tree is picked (e.g. may be observed in a tree consisting from GetRandomPercent conditioned entries), there is no "multiple match", although one time i had a weird issue when multiple entries were played for same Action call and it was somehow triggered by certain combination of conditions higher in this custom Action's tree, fixed that, but still don't understand exact cause.

Edited by hereami
Link to comment
Share on other sites

Hmm, you're right.
I just tried this again and to my surprise the 'Write' animation is used again. But not for all companions. Heather uses the 'Steak' animation, Piper uses the 'Write' animation. Yesterday I tried it about 10 times and it always used the 'Steak' animation.
I checked again in the CK and the condition for the FurnitureWriting animation is set back to 1. Which is logical, if the condition does not refer to the single object, but to the animation. I have only saved the single object (table). I thought the condition would only refer to the table.


 

Can play LOOSE idles by PlayIdle. For some example DefaultAliasReadWhileSittingScript.

I have looked at the script and added it to my library. You get an idea how it works.

What I still do not understand: The condition for FurnitureIdleEatingRoot is:
GetIsUsedItemType Potion == 1
I can't find a description for GetIsUsedItemType.

But this seems to be crucial. Where does the Potion value come from? From the script? From the package?
I can't find any reference to it there.

The animation script looks like this:

;---> When Steaks are in the Companion Inventory 
							  if wIsSteak == true || wAct.HasKeyword(ActorTypeDog)	;Dogmeat is always 2.0.
								
								wAct.SetValue(NNES_AV_PackageControlFlag, 2.0)

								if wAct.HasKeyword(ActorTypeDog)
									Fnc_PlayAnimation(ii, NNES_DogmeatSniffEat, false)
								elseif wAct.HasKeyword(ActorTypeSuperMutant)
									Fnc_PlayAnimation(ii, SupermutantCookingCauldron, false)
								elseif wAct.HasKeyword(ActorTypeCat)
									Fnc_PlayAnimation(ii, NNES_CatEating, true)
								else
									
;------------------------------------------------------------------------------------------------------									
									;Debug.Notification ("Table Flag = "+NNES_AnimationPlay_NpcChairWithTable_Flag.GetValue() as Int)
									If (NNES_AnimationPlay_NpcChairWithTable_Flag.GetValue() as Int) == 1
										;Debug.Notification ("Play Animation Table")
;----> Start Table Animation here
									Fnc_PlayAnimation(ii, NNES_NpcChairWithTable, true)
									Elseif (NNES_AnimationPlay_NpcChairWithTable_Flag.GetValue() as Int) == 2
										;Debug.Notification ("Play Animation Noodle Standing")	
										wAct.SetValue(NNES_AV_PackageControlFlag, 1.0)
										Fnc_PlayAnimation(ii, NPCEatingNoodlesStanding, false)
									Endif
;------------------------------------------------------------------------------------------------------								
								endif

							else
								wAct.SetValue(NNES_AV_PackageControlFlag, 1.0)

								if wAct.HasKeyword(ActorTypeDog)
									Fnc_PlayAnimation(ii, NNES_DogmeatSniffEat, false)
								elseif wAct.HasKeyword(ActorTypeSuperMutant)
									Fnc_PlayAnimation(ii, SupermutantCookingCauldron, false)
								elseif wAct.HasKeyword(ActorTypeCat)
									Fnc_PlayAnimation(ii, NNES_CatEating, true)
								else
									Fnc_PlayAnimation(ii, NPCEatingNoodlesStanding, false)
								endif

							endif

 

 

 

 


Function Fnc_PlayAnimation(Int vCompRefIdx, Furniture vFurn, Bool vSit)

	Actor wAct = NNES_CompanionRefs[vCompRefIdx].GetActorReference()

	if wAct.GetCombatState() == 1
		return
	endif

	if EatingMarker[vCompRefIdx] != none
		EatingMarker[vCompRefIdx].delete()
		EatingMarker[vCompRefIdx] = none
	endif

	EatingMarker[vCompRefIdx] = wAct.PlaceAtMe(vFurn)

	
	Int ii = 0
	while ii < 20
		if (EatingMarker[vCompRefIdx].Is3DLoaded())
			ii = 20
		else
			Utility.Wait(0.2)
		endIf

		ii += 1
	EndWhile


	wAct.EvaluatePackage(true)

	if vSit == true
		wAct.SnapIntoInteraction(EatingMarker[vCompRefIdx])
		Utility.Wait(0.2)
		wAct.EvaluatePackage(true)
	else
		wAct.MoveTo(EatingMarker[vCompRefIdx])
	endif

EndFunction

 


Link to comment
Share on other sites

Wait.. Think i understand finally what's that jazz. Never used this furn before and couldn't figure out how a Loose only unused animation entry becomes used by default in idleEatStart, now guess it's embedded in BehaviourGraph for this exact AnimFurnChairWithTable keyword (which name gives poor clue about Eating btw) and replaces default drinking animation seen everywhere else.

 

Probably a phantom potion is generated randomly when Sandbox Allows eating and actor decides to Idle a bit and fires ActionIdle. The condition checks if some potion was provided to actor in a Package, it's all random. Though really curious, where does it come from, possibly a DefaultObject, but most likely is hardcoded.

 

What i understand, no other easy choices other than patching Animation tree to modify conditions (potentially pita), or using PlayIdle and OnSit in any suitable manner to ensure eating fact. May try to create specific custom furniture entry, which only has Eating animation, inside HumanSubGraph. Also may try Eat package/procedure maybe, but not sure if would fire ActionIdle.

 

ps. Not sure why script needs to deal with package, but if a custom package is involved, then could try to add EatingOnTable loose anim to its Idles list, might need to update conditions perhaps to play in Sitting and suitable furniture only.

Edited by hereami
Link to comment
Share on other sites

The script does nothing else than setting the package and then activating it via evaluate. The decision which animation must therefore come from the package. The condition Eat is already set to true, but nevertheless, as it seems by chance, the Write animation is played sometimes and I can't control it.

This package is started when steak is eating:

 

tableanimation_nnes_p1bjt8.jpg

But here I can't find any reference to what makes the difference between Eat or Write Animation either.

The mod in question is this one:
https://www.nexusmods.com/fallout4/mods/55908

I have already released an extension for it:

https://www.nexusmods.com/fallout4/mods/61337/


Edited by EagleFour
Link to comment
Share on other sites

 

But here I can't find any reference to what makes the difference between Eat or Write Animation either.

 

I'm pretty sure the game time governs when it runs the eating animation. I think it must be hardcoded in the animation itself, because the animation manager doesn't have any time conditions in it.

Link to comment
Share on other sites

> But here I can't find any reference to what makes the difference between Eat or Write Animation either. <

From ActionIdle processing logic in default case it stays up to game's decision whether a potion is donated to actor when he's firing ActionIdle in a furniture. If yes, then he eats, if no, then farther entries in tree are processed, because he's not consumed anything - nothing to wonder about here i guess :smile:. Try to actually feed him OnSit (i.e. EquipItem(any long-lasting potion)). By the way, https://geckwiki.com/index.php?title=GetIsUsedItemType

 

ps. That Eat procedure, does it create FakeFood once momentarily, once and for all time of being current, or periodically though? Also to solve problem with having exact food type inside inventory it could be exploited if CreateFakeFood is disallowed (instead of having conditions elsewhere). Rather curious. Meself was going to tinker with all that closer some time, but haven't yet.

 

>game time governs when it runs the eating animation<

ps. Indeed by the way, there is lunch, dinner timing https://www.creationkit.com/index.php?title=Procedure_Sandbox , but shouldn't things like Eat procedure override it and process whenever is active? But companions seem to drink (aka eat) while sitting at any time of day, some confusing.

Edited by hereami
Link to comment
Share on other sites

  • Recently Browsing   0 members

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