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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Is there any other way to check a variable constantly without using even tick?

right now im using a custom event to check a character health but in event tick but then it creating a problem that i cant play the montage that the character should play when the health hit 0

Product Version: UE 4.22
Tags:
more ▼

asked May 18 '19 at 10:51 PM in Blueprint Scripting

avatar image

son564
1

avatar image Ronnie Olive May 21 '19 at 09:44 PM

There should be no instance where you need to check something like that constantly. It should only be checked WHEN it needs changed, or read, etc...

But there ARE ways to do this. Shadowriver's first sentence is wrong.

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

2 answers: sort voted first

Like ShadowRiver said, make it so only the getter and setter functions you write for that Blueprint class can change the variable, then in the function that sets it you can also have it signal other actors or objects that the variable changed, for example by calling an Event Dispatcher or some other way.

more ▼

answered May 19 '19 at 03:19 AM

avatar image

mightyenigma
3.8k 18 20 20

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

No in native way, UE4 is strongly tied to C++ which is quite low level and because CPU does not react to memory changes, there for it can not tell the program that variable changed and program is not only one who can change that variable (and even not CPU is only one that can do this) and engine it self cant really track that.

But this can be solved by programming policies and using encapsulation principle of object orientated programming. Make variable private (eye icon on variable shut down) and only accessible via get or set function, so other classes (blueprint or C++, but in case of C++ you can hack it) need to use those function to modify that variable, this way you can treat set function as make on variable modified event function as you force other code (Except class that variable is in) to use that function and other code can't bypass that because you made varable private and you are 99% sure that that code will execute when variable is changed, engine code does that a lot.

Other more soft way is to make a function in class to do something and other code can call after can call then it's update the variable, so action would be more optional.

There also

more ▼

answered May 19 '19 at 12:10 AM

avatar image

Shadowriver
36.5k 930 169 1111

(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