0
Answered

Setting/Switching Player Focus with Multiple Targets Present

Dante 5 months ago in Melee updated by Marti (Lead Developer) 5 months ago 1

Hello,

I have been running into an issue when I have multiple Characters in the scene. I am using the Melee Module's Focus Action to have the player focus on characters with a key down triggering the action. The issue I have been having is when I have more than one character in the scene. I currently have the trigger focus set up close to the same way it is set up in the melee example scene. The issue with this method is that it has a predetermined target, and there is no way to change the targets. 

So my question is, what is the best way to set up the Player's focus trigger so that the player can focus on a character if more than one Character is present in the scene, and what would be the best way to set up a trigger that would allow the character to change their current focus to another character.

Thank you in advance!

PS Great work on the product! GC is one of the best assets i have ever used.

Unity version:
2019.3.3f1
Game Creator version:
1.1.6
GOOD, I'M SATISFIED
Satisfaction mark by Dante 5 months ago
+2
Answered

Thanks Dante for your kind words :-) We'll cover this in more detail on the video tutorial we're preparing. However, here's the idea:

You need to have an empty List Variables that will contain the list of targets. To fill this list, you use the Gather Components by Distance action, which will fill the list based on the distance of characters to the player.

Then, all you have to do is to set the 2nd element (because the Player is always the closest to the Player) as the target. Here's an example of this we did during the Messy Coder's livestream. it's right at the hour time mark.

https://www.twitch.tv/videos/599228541

Hope this helps!