Modified Interact Ability stops before ButtonUp

shirohige

New member
I have interactions where you have to hold the button to keep it running, if you release it, it stops.

My idea was to start an animation in DoInteract and stop it in AbilityStopped and set the StopType to ButtonUp.

The problem is, that it stops directly after starting the animation.

The lines of interest are

C#:
//The interactive will decide whether it stops or not.
            m_InteractiveItem.InterruptInteraction();

and

C#:
interactions.interactInteraction.interactionDelegate.Invoke(character);

My modified version is attached:
 

Attachments

  • InteractAsCharacter2.cs
    15.5 KB · Views: 2
  • config.png
    config.png
    48.5 KB · Views: 4
Not sure what some of the stuff in that script refers to e.g. InteractiveItem so it's kinda hard to debug it.

But if you want to do a hold+release key ability, you should use the Button Down Continuous start type (like the Speed Change ability), or you could use Long Press depending on which one suits your needs better. Also in general you shouldn't be manually controlling animations from within abilities, but rather use animator parameters (e.g. the ability's AbilityIndex) to control animation transitions.
 
Hi,

the first thing that I was missing was Button Down Continuous, thank you for the hint.

The second thing was that I didn't properly set up the animation events:

animation_event.png

I noticed this when comparing it to the "Speed Change " ability which is a hold+release ability (and thus a good template).
 
Top