Hello!
I am currently working on an idle game (Cookie Clicker, Clicker Heroes, etc) in UE4 to try and practice working in Blueprint more.
My game is set up as a war game, where there are many different territories you can click on to subtract their health. They passively heal as well. Eventually you will be able to allocate units to different territories to increase damage per second in that territory (but that’s not the problem I’m having, just providing context because this problem will apply later). The territories are all instances of the same “Territory” blueprint, copied and pasted next to each other. Right now I’m trying to set it so that when you hover over a territory and press “U”, it upgrades that specific territory and it starts taking damage per tick.
I currently have it set so that when the cursor is over the Territory actor, it sets a Boolean “IsCursorOver” to true, and it toggles the visibility of the “Upgrade?” text component. This works fine, as “Upgrade?” is toggled on when the cursor is over the actor.
When the “U” key is pressed, it tests if the cursor is over, and if it is, then it sets another Boolean “Upgraded” to true. I only want to upgrade that one instance.
Every tick, it tests if the actor is upgraded, and if so, it takes damage.
Currently, the upgrade is only working on the last instance of the blueprint. There are 30 Territories total, and pressing “U” on Territory30 upgrades it. It does not work on any other instance, instead returning false for “IsCursorOver” when “U” is pressed. Territory 30 is the only actor where the upgrade actually works.
Could anyone help me figure out how to affect a specific instance of an actor?
Here are some screenshots to show the blueprint I have created:
The above picture leads into the one below.