How to run a event on a class from an array

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

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

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.

Nice, will look into that!

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.