Jump to content

Triggering a 'hug' animation from dialogue


Recommended Posts

OK so I'm further now. It's not working yet, but it's doing a lot more than before! :smile:

Ideally, still, I'd just like to add an Idle Anim to the idle anims list in the dialogue drop down. If only I knew how to do that!

 

But what I have so far is starting to look like it. First I was setting the keyword wrong. I need to set it per entrypoint in the furniture. So I created a second keyword and added that to the second entrypoint in the furniture.

 

 

 

Then I adjusted the script to reflect the second keyword, so that the player is forced to slot (0) which is where the furniture is spawned, and Ivy walks to the second spot. The SetPlayerAIDriven was a game.xxx command so I changed it, then that works as well. It's better that way, so that works! :smile:

 

But the anim is not activating. The player just stands there for a couple of seconds, then control is released back and the game continues.

Furniture Property p_ivy_Hugging_Furn Auto Const
Keyword Property p_ivyHugAnimKW Auto Const
Keyword Property p_ivyHugAnimKW1 Auto Const
ObjectReference  MyMarkerRef ;  this must be outside of functions and events so it can be accessed from different functions and events

Function DoHugging()
        
    Actor IvComp = pIVYCOMP.GetActorRef()
    Actor pPlayer = Game.GetPlayer()

    p_ivy_IsHugging.SetValueInt(1)

    MyMarkerRef = pPlayer.PlaceAtme(p_ivy_Hugging_Furn)
    IvComp.SetLinkedRef(MyMarkerRef, p_ivyHugAnimKW1)
    MyMarkerRef.Activate(IvComp, true)

    Game.SetPlayerAIDriven(true)
    IvComp.EvaluatePackage()

    pPlayer.SetLinkedRef(MyMarkerRef, p_ivyHugAnimKW)
    pPlayer.EvaluatePackage()

    MyMarkerRef.Activate(Game.GetPlayer(), true)

    Utility.Wait(1)
    
    IvComp.Say(p_IvySpontChatter, IvComp, False, pPlayer)

    Utility.Wait(5)

    MyMarkerRef.Activate(IvComp, true)
    IvComp.SetLinkedRef(None, p_ivyHugAnimKW1)
    IvComp.EvaluatePackage()

    MyMarkerRef.Activate(pPlayer, true)
    pPlayer.SetLinkedRef(None, p_ivyHugAnimKW)

    Game.SetPlayerAIDriven(false)
    pPlayer.EvaluatePackage()

    MyMarkerRef.Delete()
    MyMarkerRef = none

    p_ivy_IsHugging.SetValueInt(0)

EndFunction
Edited by Reginald001
Link to comment
Share on other sites

You can find this animation in the Fallout4 - Animation.Ba2 (character-animations-furniture-CoupleHolding) archive with the BAE tool. But it's a furniture animations and it consists of separate "EnterFromStand", "ExitToStand" , "Idle" and "Sync" .hkx files.

 

Does it work for the companion? I did not have to add additional keywords to make multiple settlers shoot at the same target ...Maybe it's not the same with the furniture.

Make sure your marker has the animation keyword , it also might be usefull to use MoveToTheNearestNavmeshLocation function or use SetPosition and SetAngle on the marker. When you PlaceAtMe objects, they can end up in some weird position and especially angle and it might prevent actors from using them. I'd also set a longer pause to see what happens. Five seconds is not always enough to calculate the path and it's definitelly not enough for testing purpose.

 

When I was testing different anims, I tested this one too. Wanted to add it as a craftable object for my mod. The animation worked, the problem was that one settler could enter the marker and just stand hug the air until another settler decided to go use the second slot.

Link to comment
Share on other sites

You can find this animation in the Fallout4 - Animation.Ba2 (character-animations-furniture-CoupleHolding) archive with the BAE tool. But it's a furniture animations and it consists of separate "EnterFromStand", "ExitToStand" , "Idle" and "Sync" .hkx files.

 

Does it work for the companion? I did not have to add additional keywords to make multiple settlers shoot at the same target ...Maybe it's not the same with the furniture.

Make sure your marker has the animation keyword , it also might be usefull to use MoveToTheNearestNavmeshLocation function or use SetPosition and SetAngle on the marker. When you PlaceAtMe objects, they can end up in some weird position and especially angle and it might prevent actors from using them. I'd also set a longer pause to see what happens. Five seconds is not always enough to calculate the path and it's definitelly not enough for testing purpose.

 

When I was testing different anims, I tested this one too. Wanted to add it as a craftable object for my mod. The animation worked, the problem was that one settler could enter the marker and just stand hug the air until another settler decided to go use the second slot.

 

Both player and companion are not activating the furniture. If I set the angle, what angle do I set it to? (90? Or do I get the playerAngle if such a thing exists?)

I think the furniture is set up correctly.

 

Also, in order for the 'couple' furniture to work you need to tick the 'Play Anim When Full' option, then it won't play the anim unless both positions are filled.

This is how my current furniture is setup (I just disabled the Play Anim When Full option and am trying again -- Tried, didn't work).

 

I know the furniture is activating, because I'm being forced into 3rd person. It's just.. the anims aren't playing.

 

 

Edited by Reginald001
Link to comment
Share on other sites

Zero angle. If you use any furniture marker mods, you can notice how settlers need to calculate the path and they can get stuck calculating if the marker is slightly above the ground. That's is just all clunky. What particular package do you use? If it happens during some dialogue make sure you ticked "can move while greeting". I might try to experiment with this if I have some time.

 

Edit.: to check if your package actually works you can use console commands. Click on the actor in console and type :GetPackageTarget

If your package is active, it should return Ref ID of your marker. Though you don't know the id so you can't compare. But you can use the id to try and check what it might be and use the command to check if they have any package target at all.

Edited by kitcat81
Link to comment
Share on other sites

 

Ideally, still, I'd just like to add an Idle Anim to the idle anims list in the dialogue drop down. If only I knew how to do that!

 

 

1. Extract the animations from the Fallout4 - Animations.ba2 file.

 

2. In the CK, in the top navigation, go to GamePlay > Animations...

 

3. In there, go to 'actors\Character\Behaviors\RaiderRootBehavior.hkx'

 

4. Under that, right click on "LOOSE" and "Insert Child"

 

5. Give the idle a unique name. Change the "Anim Event" to "dyn_ActivationLoop"

 

6. Edit the Animation File field and point it to the location of the animation you want to be able to play.

 

That's it.

 

Now, you can store a reference to that idle and play it in Papyrus with PlayIdle.

 

BUT, the hugging animation might be a paired animation. So, PlayIdle may not work with it. And if it is two separate animations, one for each character, you will still need to do something to lock the actors in position while playing it. Otherwise, they will push each out of the way while hugging which isn't very romantic.

 

I am working on a framework that will make interactions like this easier to deploy as it handles the positioning, playing, organizing of animations, etc. It's like a Fallout 4 version of this: https://www.nexusmods.com/skyrim/mods/76744

Link to comment
Share on other sites

Zero angle. If you use any furniture marker mods, you can notice how settlers need to calculate the path and they can get stuck calculating if the marker is slightly above the ground. That's is just all clunky. What particular package do you use? If it happens during some dialogue make sure you ticked "can move while greeting". I might try to experiment with this if I have some time.

 

Edit.: to check if your package actually works you can use console commands. Click on the actor in console and type :GetPackageTarget

If your package is active, it should return Ref ID of your marker. Though you don't know the id so you can't compare. But you can use the id to try and check what it might be and use the command to check if they have any package target at all.

 

I can set it to 0 angle.

 

I think I'm missing something. You speak of a package, but none is applied anywhere, I think. I did make a package before, tried to add it to the scene, but the scene doesn't do anything other than call the script (doHugging).

 

Do I apply the package through script to the actor?

 

 

 

 

Ideally, still, I'd just like to add an Idle Anim to the idle anims list in the dialogue drop down. If only I knew how to do that!

 

 

1. Extract the animations from the Fallout4 - Animations.ba2 file.

 

2. In the CK, in the top navigation, go to GamePlay > Animations...

 

3. In there, go to 'actors\Character\Behaviors\RaiderRootBehavior.hkx'

 

4. Under that, right click on "LOOSE" and "Insert Child"

 

5. Give the idle a unique name. Change the "Anim Event" to "dyn_ActivationLoop"

 

6. Edit the Animation File field and point it to the location of the animation you want to be able to play.

 

That's it.

 

Now, you can store a reference to that idle and play it in Papyrus with PlayIdle.

 

BUT, the hugging animation might be a paired animation. So, PlayIdle may not work with it. And if it is two separate animations, one for each character, you will still need to do something to lock the actors in position while playing it. Otherwise, they will push each out of the way while hugging which isn't very romantic.

 

I am working on a framework that will make interactions like this easier to deploy as it handles the positioning, playing, organizing of animations, etc. It's like a Fallout 4 version of this: https://www.nexusmods.com/skyrim/mods/76744

 

 

I will try this out. I can set the player in place, have Ivy move close, then have her play the hug anim for some seconds, then release her again. Still, ideally, she hugs up to you while you are in her chat menu... so that in first person, it looks like she's holding you close. This is my ideal scenario, but with a dialogue wheel:

 

https://youtu.be/XldnDCQPueM?t=140

Edited by Reginald001
Link to comment
Share on other sites

It seems you are missing something important. You need to give packages to both player and companion to use the funiture. You can use sit package for it. Take a look at the Slot Machine quest. It has travel and sit packages added to the scene. I think this way fits your purpose better because you want it to be a scene. Probably, you can skip the travel package, you spawn your marker next to the actors so they don't need to travel anywhere.

 

There is also another way that can be used outside of a scene. You can attach a package to some reference alias and then use ForceRefTo() function to apply the alias to your actor. In this case the quest with the alias must have higher priority than the follower quest.

 

How to adjust the package :

In the package settings select target. And in the setting window select "linked ref" and your keyword. Add a new condition for the package (HasLinkedRef - YourKeyword ==1) . The keyword must be the same you use to link the actor to the marker. This will tell the actor to use the linked furniture. This way is used to point at spawned objects.

Edited by kitcat81
Link to comment
Share on other sites

 

I can set it to 0 angle.

 

I think I'm missing something. You speak of a package, but none is applied anywhere, I think. I did make a package before, tried to add it to the scene, but the scene doesn't do anything other than call the script (doHugging).

 

Do I apply the package through script to the actor?

 

 

 

 

I will try this out. I can set the player in place, have Ivy move close, then have her play the hug anim for some seconds, then release her again. Still, ideally, she hugs up to you while you are in her chat menu... so that in first person, it looks like she's holding you close. This is my ideal scenario, but with a dialogue wheel:

 

https://youtu.be/XldnDCQPueM?t=140

 

 

 

There could be packages running on the actors that prevent them from using the furniture you want. You will probably need to run a custom package on the actors that at least over-rides other game packages while you try to get them to use the furniture.

 

My framework is more focused on a 3rd person view. That hugging affect during dialogue would be pretty cool. It might be possible. But, there are definitely some pitfalls. For instance, if you try to change the players angle, the game will invoke a fade-to-black or worse a loading screen. So, you would need to work around that.

Link to comment
Share on other sites

 

 

Ideally, still, I'd just like to add an Idle Anim to the idle anims list in the dialogue drop down. If only I knew how to do that!

 

 

1. Extract the animations from the Fallout4 - Animations.ba2 file.

 

2. In the CK, in the top navigation, go to GamePlay > Animations...

 

3. In there, go to 'actors\Character\Behaviors\RaiderRootBehavior.hkx'

 

4. Under that, right click on "LOOSE" and "Insert Child"

 

5. Give the idle a unique name. Change the "Anim Event" to "dyn_ActivationLoop"

 

6. Edit the Animation File field and point it to the location of the animation you want to be able to play.

 

That's it.

 

Now, you can store a reference to that idle and play it in Papyrus with PlayIdle.

 

BUT, the hugging animation might be a paired animation. So, PlayIdle may not work with it. And if it is two separate animations, one for each character, you will still need to do something to lock the actors in position while playing it. Otherwise, they will push each out of the way while hugging which isn't very romantic.

 

I am working on a framework that will make interactions like this easier to deploy as it handles the positioning, playing, organizing of animations, etc. It's like a Fallout 4 version of this: https://www.nexusmods.com/skyrim/mods/76744

 

 

This is what I needed. Can't believe I read over this!

I implemented this as you said, and can now reference it in a dialogue scene, without having to resort to scripting or packages. I can add multiple idle anims for all the phases of the hug. I should be able to make it pretty seemless.

 

Regardless of this, I learned a great deal about packages, scripting and other things while on this deep dive into animation and I'll continue experimenting with both ways. I feel that adding idles like this might add more incompatibilities with other mods than going the scripted route. So this topic is not done by a long shot. :smile:

 

(edit) Ok by adding it to the idle anims, it now works. But of course the players are out of alignment and the anim doesn't seem to play on the player (as it's not a 1st person anim). I'll try to find an animator that can help me with proper animations, now that I know how I want to implement it. The player will need a 1st person and 3rd person anim, Ivy a 3rd person anim.

Edited by Reginald001
Link to comment
Share on other sites

You can edit the list of animations. The problem is that there is no idle animations that you want. There is only furniture animation . Technically you can take the .hkx and add it to the idle list. But it will crash the CK.

 

I can't tell you why it does not work now without seeing all files. Have you set the package target - linked ref - your keyword in the package? Also have you tried to use console command "GetPackageTarget" to see if they have any target while running your scene ?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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