Does such a thing exist? For clarification, I'm looking for a method to detect when a player clicks a Units portrait, so that instead of centering their screen on that unit, I can center their screen on a different unit instead.
No, there is no event that fires from clicking a portrait.
You could try to create an invisible dialog button above the portrait and just detect if that button is pressed, however it might be possible that this button cant be clicked if there is a portrait below, youll need to test this.
Okay, thank you for your help. I also considered the Dialog Item route, but I ran into two issues without bothering to test it. One: Player resolutions vary, unless that was patched, and so the dialog items would be misplaced on many players screens(?), I believe. Two: Placing the dialog item directly over the portrait would prevent any actual usage of the portrait to occur. I would only want this to happen with a few types of units, not all of them.
Two: Placing the dialog item directly over the portrait would prevent any actual usage of the portrait to occur. I would only want this to happen with a few types of units, not all of them.
You can check if "Unit 1 in Unit Group (Selected units for player x) == (Specific Unit type)", then center on whatever it is you want to center on, and if not, just center on the selected unit/unit group
And yes, resolutions may end up being a problem...
EDIT: Try setting the anchor to the bottom right corner, the portrait is always bordering on the command card I believe, and I think that it never changes size so the portrait should always be the same distance from the bottom right then
Does such a thing exist? For clarification, I'm looking for a method to detect when a player clicks a Units portrait, so that instead of centering their screen on that unit, I can center their screen on a different unit instead.
@Zetal: Go
No, there is no event that fires from clicking a portrait. You could try to create an invisible dialog button above the portrait and just detect if that button is pressed, however it might be possible that this button cant be clicked if there is a portrait below, youll need to test this.
Okay, thank you for your help. I also considered the Dialog Item route, but I ran into two issues without bothering to test it. One: Player resolutions vary, unless that was patched, and so the dialog items would be misplaced on many players screens(?), I believe. Two: Placing the dialog item directly over the portrait would prevent any actual usage of the portrait to occur. I would only want this to happen with a few types of units, not all of them.
You can check if "Unit 1 in Unit Group (Selected units for player x) == (Specific Unit type)", then center on whatever it is you want to center on, and if not, just center on the selected unit/unit group
And yes, resolutions may end up being a problem...
EDIT: Try setting the anchor to the bottom right corner, the portrait is always bordering on the command card I believe, and I think that it never changes size so the portrait should always be the same distance from the bottom right then
Okay. I understand. I'll give that a shot, thank you. =) I'll be back (hopefully) soon.