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"

Cast event when (Variable change)

My question is simple how Custom Event in this case (Event 1) Can be casted whenever Variable change for example. Integer (100) When it comes 99,98,97 etc.. cast Event 1 for every change cast my event ..

Product Version: UE 4.15
more ▼

asked Jan 30 '18 at 09:52 PM in Blueprint Scripting

avatar image

84 4 6 13

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

1 answer: sort voted first

Your wording is a little confusing, but I'm assuming you actually want to trigger or fire an event when the variable is changed? Casting is a whole other thing, which you may or may not be aware of, but you do not cast to events, you cast to classes.

In any case, there are different ways of going about doing this, depending on what you're trying to do. You could set the replication of your variable to 'RepNotify' which will create a function for you that will fire every time the variable is changed. Though this method is typically used with networking, so I'm not sure what the result would be if your game is local only. Never thought to try.

If you're using UMG you can 'Bind' a function to a variable, but as far as I'm aware that will call the function every frame, which will get a little heavy depending on what you're doing.

You could also store the current value of the variable in a second variable, then on tick check to see if they are the same. If your variable changes, call your event and set the second variable to match the first again.

What exactly are you trying to achieve? There may or may not be a better way to accomplish whatever you're trying to do.

more ▼

answered Jan 30 '18 at 10:45 PM

avatar image

138 1 6 6

(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