Just trying to think of a way to achieve this.
I want each character (of the same character) to aim towards the nearest object, if that object has already been aimed at by one of the characters I want them to aim at the next closest available object of the same type.
So far:
I have a number of the same characters trying to pick up the same item (i dont want this because...). For example in a room full of chests 3 identical characters try to take one treasure chest. I need to reduce the chest count when collected but instead of just taking a -1 since all 3 characters get to it at the same time they –3 from the count instead of -1. this leaves just one chest removed and -3 from the count.
In short i am doing this:
For each character on the screen i am picking the closest chest and moving the character to it. If that chest goes before the character arrives (e.g. player collects it) then the character picks the next closest chest etc. The problem happens when several characters overlap and get close to a chest. I have the events triggered on a distance the character gets to the chest, so when they are a certain distance it triggers certain events, and when very close the chest is seen as picked up so destroyed and minus the chest count etc.
i am using the pick nearest for character movement but this is where the problem lies in that more than one character can pick the same chest to aim at causing the issue. I was trying to think of a way to use the UID of the chests and not to let the characters pick it if the previous character has already spotted it and assigned it to an instance variable, but cant seem to see how to work that in construct.
If anyone has any ideas, would be helpful.
Thanks