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"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

Communicate in given example

Hi at all,

I've watched the 2+ hours Blueprints Communication Video made by EpicGames.
After that and many research, I couldn't even get a clue, how to solve my Problem.
I want to create a mobile Game.
I've got 2 Gates, each has a different Type (1. MainGateActor and 2. GoatGateActor).
From the left side, there comes 1 goatherd, which contains 1-N Goats.

What i want to archieve:
I want to past the Amount of Goats the goatherd has, without letting the goatherd come near the "GoatGateActor". I want, that the MainGateActor tells the GoatGateActor, that Something aproched the MainGateActor, without being able to get any Reference of "`GoatGateActor`".

My Question:
How can I inform my "`GoatGateActor`", which have no chance of getting any Reference to "`MainGateActor`" and neither "`MainGateActor`" to get any Reference of "`GoatGateActor`", that something specific (Like X Goats passed through the "`MainGateActor`") happend at the "`MainGateActor`".

Example of my Current Situation: Gates

What did I tried so far:

  1. Used Interfaces (Needs a Reference, that's why it isn't suitable for this)

  2. Used Event Dispatchers (Receiver needs a Reference to MainGateActor, that's why it isn't suitable for this)

  3. Watched tons of Youtube Vids about "Blueprint Communication", but all of these tutorials shows a "`ThirdPersonCharater`" Example... which doesn't fit my Problem.

  4. Smashed at the Keyboard, but it doesn't solve it either :p

I really don't want to use "`GetAllActorsOfClass`" or the "`GetAllActorsOfInterface`" method, cause it doesn't look like a common way, to handle this kind of Problem.

Just to make it sure:
The Goats are getting "stored" in between the MainGate and the GoatGate (The Grey Field).
I just want to inform any Butchers, which are waiting on the right side of the GoatGate, to receive something like "Goats are there, you can now grab 1 and do your work".
This is a full automatic Process, where a User cannot interfere.
Which means, that there is no "Player" you can Control, just Upgrading the max amount of Goats which can be stored. etc.

Thanks in advance for any kind advice.

Product Version: UE 4.19
Tags:
fields-red.png (138.5 kB)
more ▼

asked Mar 28 '18 at 08:19 PM in Blueprint Scripting

avatar image

Halki
7 1 5 7

avatar image Nebula Games Inc Mar 29 '18 at 12:26 AM
  1. Super, super confusing question.

  2. Why don’t you want to use "references"?

  3. You are going to need a reference by some means for one blueprint to communicate with another

  4. Not sure what exactly you are trying to achieve but I feel like there is a simple way to do it I just don’t really get this whole main gate and goat gate scenario you are creating. So some clarification from your end would be great. Thanks

avatar image Halki Mar 29 '18 at 04:06 AM

I'm currently working on how to describe my specific Problem.
1. Could you explain, which Section is unclear or confusing?
2. In General I want to use them, but I have no clue, how to to it if I have 0 chance of getting any Reference from "`GoatGateActor`" to "`MainGateActor`" without using Trick (As Hidden Volumens etc.).
3. I'm aware of that.
4. Could you explain, which part of my "What I want to archieve" is unclear? I'm sure, that there is a simple Solution for my specific Problem.

In Addition:
I would like to tell the "`GoatGateActor`", that X Goats approched the "`MainGateActor`".
The only way, that I know, how to archieve this behavior is to use "`GetAllActorsOfClass`" to get a Reference to "`GoatGateActor`" at BeginPlay. Is there a better solution for this?

Isn't there a possibility to "Boradcast" a Information to a specific "Group" (Class) without getting any Reference of the specific Object, which is Part of the "Group" (Class) I want to pass the information through?

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

you could have a collision volume that covers the are between the gates then use a get overlapping actors on a timer to see whats within. or you could set it up so that on begin overlap each goat is added to an array then when its taken by the butcher you remove it from the array. of course this is all based on understanding your question so i may be off a bit in what your aim is.

alt text

alt text

capture.png (180.5 kB)
capture2.png (263.5 kB)
more ▼

answered Mar 29 '18 at 01:21 AM

avatar image

ThompsonN13
10.1k 33 9 23

avatar image Halki Mar 29 '18 at 04:15 AM

Is it a common way, to use "Hidden" Objects to pas Information through other Blueprints which are not in "Range"? It could work, but it looks like a "dirty" way of doing it to me.

Could you explain, what excatly is unclear to you?
For Example (Speaking for you now):
Hey, I know that you want to inform the GoatGateActor, that something passed through the MainGateActor,but ....

avatar image ThompsonN13 Mar 29 '18 at 03:14 PM

using volumes in the way shown above is a perfectly fine thing to do and it doesnt need to be a separate actor either, it could be part of either gate (if you wanted you could even have both gates in one blueprint). theres nothing dirty going on here whatever that means. you mentioned in your question that you didnt want to / couldnt use references which makes no sense because to have communication between any blueprints there has to be references. also there is always a way to get references, you mentioned all actors of class which is one way but there is also setting a public variable, or using tags, or many other ways. theres a bunch of other small details that arent exactly clear either like is the herd one blueprint or is it individual blueprints for each goat ( i assume the latter).

anyways in the picture below you will find another example of how this can all be done and implemented. heres how it works when a goat passes through the main gate (which will need some sort of overlap) it get added to an array named goats and if of type goat, then you call the event butcher with the target being another variable but this time of the type goat gate (this variable is a public variable so that once its placed in the scene you can set the value in the details panel, this is also how you get a reference to the other gate). ok now onto the goatgate blueprint. to begin here we create a custom event named butcher (which you will actually have to do before the steps on the previous blueprint). next we will add a small delay which will control how often the script can be called within a given period. then i added in a another check to make sure this script needs to be run (this is optional in this case), the check basically just gets the array goats from a reference of the main gate (same public variable based method used here) then checks the length against 0

alt text alt text

capture.png (82.6 kB)
capture2.png (233.2 kB)
avatar image ThompsonN13 Mar 29 '18 at 03:23 PM

the next step is to then complete the script of the butcher being spawned and the gate opening and all that (which is up to you and not really described in the question) then once thats done you remove the index that that goats was in from the array. the last step is another check of the length of the array (this one matters). if the length of the array is greater than 0 then we call this event again, if its zero then we do nothing. this way the script will repeat over and over until there are no more goats in the holding area. this is another area which you didnt really describe, you didnt say how often or how many goats were to be taken so i did a bit of guesswork here and went with take them at a fairly regular interval until they are all gone. this could also be done with forloops or a reverse foreach but this method is simpler.

thats basically how its done using two blueprints (main gate and goatgate) and also the goat itself. it allows basic direct communication between the two blueprints (by using the variable based references you can have multiple sets of gates and pens if you wanted to).

avatar image Nebula Games Inc Mar 29 '18 at 04:34 PM

What @ThompsonN13 said. There are a million ways to do what you want. And aside from a few poor performance choices (like checking things on tick that don't change very often) how you go about it is really up to you and what makes sense to you based on your game mechanics and the rest of your code.

(comments are locked)
10|2000 characters needed characters left
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