0
\$\begingroup\$

I have the following situation:

1 NPC that follows a path containing 3 parts. Target Point 1, Tower and Target Point 2.

It turns out that the first NPC that passes through the tower destroys it.

This destruction is not instantaneous. The tower has 100 hit points and while in contact with the NPC, it loses 10 life points every second.

With this, the next NPCs will only have to go to Target Point 1 and finally to Target Point 2.

I created a boolean variable for target control (varTowerDestroyed). So if it is false, the second target becomes the tower, otherwise it becomes the target point 2.

Blueprint showing the variable (varTowerDestroyed) being set to true, right after the tower's destruction:

enter image description here

Display of the control in the target definition:

enter image description here

It turns out that each NPC has its own variables, so there's no use in defining the value of the variable of just one of them. I would need a variable that would control all at the same time.

I thought of doing the verification based on a variable of the own tower, but as the tower will be destroyed, I imagine the variable will disappear. Impossible to verify:

enter image description here

At the Level Bueprint I created an event that will be called soon after the tower's destruction. This event will set the Boolean variable to true, setting all Boolean variables of the NPCs that are created and still generated to be true:

enter image description here

I would calmly call an event if the event was in the blueprint of the tower, but being on the blueprint level I was unsuccessful.

I thought about using the sleep function. I also thought about creating an actor who was sort of an actor manager (I still want to, but only when I start using HUD). I also thought about doing a check of the existence of tower actors, but this I do not know how to do.

Links from places I searched:

https://answers.unrealengine.com/questions/78622/how-can-i-call-an-event-in-my-level-blueprint-from.html

https://answers.unrealengine.com/questions/702964/how-can-i-call-a-event-from-actor-blueprint-in-lev.html


EDIT 1 (Attempt made based on 2 videos I've seen)

Link of videos:

https://www.youtube.com/watch?v=k-MAALv3P-Y

https://www.youtube.com/watch?v=IbiocEDwosw

I tried to use the Event Dispatcher.

I created an Event Dispatcher called Disp, in the NPC blueprint.

enter image description here

Soon after I set it on the Level Blueprint.

Level Blueprint:

enter image description here

Nothing happens, nor the impression.

\$\endgroup\$
  • \$\begingroup\$ I got it! Using a Blueprint Intergace. Tomorrow I post the answer on how to do it. \$\endgroup\$ – Boneco Sinforoso May 30 at 1:02
0
\$\begingroup\$

Create a Interface Blueprint:

enter image description here

Create a function in the Blueprint Interface:

enter image description here

Add the interface to the actors you want to communicate with the Level Blueprint:

enter image description here

Calling the event (NPC blueprint):

enter image description here

Defining the event (Level Blueprint):

enter image description here


I've also tried using the event, but it's not possible to use it in this case since there is no NPC already entered at the level, they are spawned. In this way, an error in referencing occurs.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.