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"

How to run a event on a class from an array.

Hey Guy's not sure if my philosophy is correct in this one so some guidance would be nice!

I have a level that is filled with blue orbs, when the use looks at a orb a timer fills and when it is filled an event should be triggers.

How I thought it would work is not working for me because of my. Probably because of my limited knowledge of blue prints or just my limited knowledge of how programming works in general.

How I thought it would work:

  1. Create main blueprint actor with the orb and the timing mechanics.

  2. Create a child object from the main object with unique event named Test wit some functionality attached to it.

  3. In the player blueprint create a array and fill in with the child blueprints on event begin play.

  4. Once the player looks at an orb, compare the name of orb with the array and this gives you an index.

  5. Use the index to get the right class out of the array and run the event called test to activate the functionality.

What works:

Step 1 works

Step 2 works

Step 3 cant seem to fill the array with child blueprints on begin play. however i can fill the array manually in the blueprint.

Step 4 works

Step 5 cant seem to reach the Custom event called Test form the array. And thus not able to run the event.

I could fix all of this by creating the selection process in a waterfall flow, but this is not really scalable.

Any help would be nice!!

Marcel

Product Version: Not Selected
Tags:
more ▼

asked Mar 18 '19 at 10:05 AM in Blueprint Scripting

avatar image

Macler
52 3 6 9

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

2 answers: sort voted first

If you have your "trigger something on being seen" logic working, then a simple function call to the seen object setting the timer should suffice. What tool are you using for checking visibility? If you're using a line trace from the player character's eyes then there should be a hit actor/component output you could use to see if the hit actor was of the correct type.

Another way you could go about it is by checking the the angle of the character's forward vector against the a vector that starts at the sphere origin and points towards the player. This is often done in AI. It's call dot product. Here's a forum post that seems like it deals with it:
https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/74282-get-angle-offset-from-forward-vector-need-help

more ▼

answered Mar 18 '19 at 11:20 AM

avatar image

Lakuenza
7 1 2

avatar image Macler Mar 18 '19 at 04:31 PM

BlockquoteIf you have your "trigger something on being seen" logic working, then a simple function call to the seen object setting the timer should suffice. What tool are you using for checking visibility? If you're using a line trace from the player character's eyes then there should be a hit actor/component output you could use to see if the hit actor was of the correct type.

I am working with a line trace. Timer is working but somehow I cant acces the specific Child BP to start an event.

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

Instead of using array, you may only call an inherited event inside child class. Create a function inside your main bp, call it when needed (overlap, hit...) Now inside you child bp, click on override, then you can customize the event for each child. alt text

orb.jpg (100.1 kB)
more ▼

answered Mar 18 '19 at 11:41 AM

avatar image

Ego Studio
606 4 4 5

avatar image Macler Mar 18 '19 at 04:28 PM

Nice, will look into that!

(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