Thx for the replies all.
The code I was trying to get to work can be seen in attachments. The gist of what i'm trying to do is that every so often the enemy sprites will check to see who has the highest agro and update their tarX,Y variables. I cannot seem to get the event to return ether a hero or gate so that the enemy can update its variables.
This is not what I think my final code will be, instead of tarX,Y it will be tarUID but have not tried this until I get this running.
Thank you.
Isn't that what I did, but I did it in a function? Anyway good you got a solution.