0
\$\begingroup\$

I have a project, and it has: 1 NPC (actor X), 2 target points and 1 tower (actor Y).

Image of components in level:

enter image description here

These rose arrows demonstrate part of the NPCs path.

I added a Event Begin Overlap in the blueprint of the NPC so that when it collides with the tower it loses 10 of life every second:

enter image description here

Image of print of variable life:

enter image description here

When the NPC gets 0 life, it goes to the next target point.

But I would like to know how to also modify the life of the tower by the same blueprint (NPC).

The code is already in my mind, it is kind of obvious to speak the truth.

"Code" of NPC blueprint:

enter image description here

I do not want to have to create a new Event Begin Overlap on the blueprint of the tower.

And I think using the blueprint level would not be a good idea.

One of the links below indicated something like Blueprint Interface, but I'd like to know if I can do what I want for the NPCs own blueprint.

Links:

https://forums.unrealengine.com/international/brazil/89438-pegar-vari%C3%A1vel-de-outro-blueprint

https://answers.unrealengine.com/questions/21386/communication-between-2-blueprints.html?sort=oldest

https://answers.unrealengine.com/questions/24773/how-to-call-a-blueprint-variable-from-another-blue.html

https://docs.unrealengine.com/en-us/Engine/Blueprints/UserGuide/Types/Interface

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

The simplicity won!

I had given up for a moment to solve this problem and I went to learn other things.

Viewing this video about arrays (https://www.youtube.com/watch?v=0otLohaPkXk&list=PLnwVxZ2WVVpl1sOPaEzK--4fXzq2ZQvE-&index=44), I can develop a very simple solution to my problem.

Just add a Custom Event to the Tower blueprint:

enter image description here

In the NPC blueprint, after the Cast To Tower just call and write the name of the Custom Event:

enter image description here

Another way, which would be what I thought at the time I asked the question.

Also using the Cast To Tower (NPC blueprint):

enter image description here

To be able to use the result in the While Loop.

From this second method you do not need to create an Custom Event.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .