x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Calling function in state machine transition rule?

I am creating a fighting game, and I want to check inputs in my animation state machine's transition rules to figure out whether I should execute new moves. The player's inputs are stored in a buffer in a character blueprint, and I made a blueprint interface function that checks whether the player's current inputs match a given input sequence. I added that function to the state machine transition rule, but the problem is I can't find anything to hook up the exec pin of my function, so that function never actually executes during gameplay.

Below is an example of what I mean. Is there something that I can hook up to the exec pin? Or if this requires C++ code, I'd be happy to look at that as well. alt text

As a side note, I know I can execute the function in the Event Graph of the animation blueprint, but it seems more convoluted, at least to my understanding. If I wanted to add a new move that starts from the "Idle" state, I'd need to 1) keep track of a "state" variable, 2) check the input in the event graph when state = Idle, and 3) add the animation for my move in the anim graph. Using my current approach, if I can get this function to work then I can do everything in the anim graph....

Of course, if what I'm trying to do isn't the optimal way of doing things, I'd love to hear from someone more experienced. Thanks!

Product Version: Not Selected
Tags:
more ▼

asked Jul 23 '14 at 12:28 AM in Blueprint Scripting

avatar image

jefdongus
6 1 1 1

avatar image gameme Feb 24 '15 at 07:03 PM

Can someone show me a screenshot? I am not able to follow. I aded "Custom Blueprint Event" that I have created in the event graph in Notifications-->Start Transition Event text box. The event is not being called.!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

You should make your InputMatches function a "pure" function. A pure function is a function that promises not to change anything in the object it operates on, which means it only retrieves data. Pure functions do not have execution pins, and thus are called automatically when then input is requested, thus in this case it will automatically call the function when the state machine checks the transition, as long as you hook up the output bool of your function to the "Can enter transition" bool. An example of a pure function is Actor's "GetVelocity" function; you'll notice it doesn't have an execution pin.

To make your function pure go to where you have it defined, which it sounds like is your character blueprint, then select the function from the functions list in the My Blueprint tab. When the function is selected you should see some options on the right in the Details panel, including stuff like description, inputs, outputs, etc. In the Details panel you should see a "Pure" checkbox. Click that box, recompile your character blueprint, then call the function from the transition rule and pass its "Match" output bool into the transition rule's "Can enter transition" pin.

more ▼

answered Jul 28 '15 at 04:24 AM

avatar image

FakeEnema
121 7 13 20

avatar image RyanVanVliet Aug 29 '16 at 10:15 PM

Perfect! This removes the white execution arrow and solves the issue.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

You need to go to the state machine graph and select your transition. Then on the properties tab you will find a notifications section where you can define an event to be fired before or after the transition. Then on the transition page you will be able to add the created event and wire it to the "Input Matches" node or whatever you need.

more ▼

answered Oct 08 '14 at 11:57 AM

avatar image

Gatherer
71 6 8 17

avatar image gameme Feb 24 '15 at 07:03 PM

Can someone show me a screenshot? I am not able to follow. I aded "Custom Blueprint Event" that I have created in the event graph in Notifications-->Start Transition Event text box. The event is not being called.!

avatar image Onoa Mar 03 '15 at 08:35 AM

Similar issue, I have added a custom event in the Notifications-->Start Transition Event text box. But when I right click inside a transition graph, the option to add the event doesn't show up...

avatar image WixZ Dec 07 '16 at 09:43 PM

Thanks Gatherer. Although you made a small mistake. You will not find your defined event on the transition page but on the event graph.

avatar image Sasquatchist Apr 28 '18 at 10:28 PM

Thank you, Gatherer! Super helpful. I've been searching for how to just fire off some event from a state machine.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question