As you might know, pets don't seem to work with proximity triggers. Either they don't trigger them at all, or randomly as if their's a defective contact.
I did some empirical research on the subject and I have found a possible explanation about what is going on.
I made a small map with 2 bases, 4 mines and 6 proximity triggers. The first 3 triggers were used as spawn positions for 3 identical pets; one at each trigger:
The remaining 3 triggers were used to give out a text message when a pet would enter the trigger radius:
- Trigger A (Message: Entered Trigger A)
- Trigger B (Message: Entered Trigger B)
- Trigger C (Message: Entered Trigger C)
The goal here was to spawn the 3 pets and let them move to the triggers to see if they would get triggered:
- Pet A ->Trigger A
- Pet B ->Trigger B
- Pet C ->Trigger C
The result of the test was that A and B failed, whereas C worked. I was able to repeat this over and over again, always with the same result. This made me wonder why, because the pets and triggers were practically identical.
To make sure the triggers were identical, I opened the map with winrar and extracted the "entitylist" file. And indeed, the triggers were identical. However, I also noticed that Trigger C was the last entity I had placed, and therefore had the largest index:
- Trigger A -> Index 12
- Trigger B -> Index 13
- Trigger C -> Index 14
Out of curiosity I switched out the numbers between A and C:
- Trigger A -> Index 14
- Trigger B -> Index 13
- Trigger C -> Index 12
Then I repeated the test and guess what...Trigger A worked and B and C didn't! So I made another test: I reverted the indexes back their original and then added a 4th trigger on the map. This 4th trigger had no purpose though, and the pets wouldn't even come close to it to trigger it. However, the result was that none of the 3 triggers worked.
This leads me to the following explanation:
Only the last proximity trigger (or to be precise: the trigger with the largest index) works for pets. I don't know why that is, but I think my tests have proven this well enough.
I made some more tests to see if this behavior could be influenced or changed in any way and I came to the following results:
Making use of this knowledge
- The proximity trigger must be placed in the editor so that it is present in the entitylist file right from the start.
- The game does not take dynamically spawned (from script) triggers into consideration.
- Having other entities, such as buildings or trees with a higher index in the entitylist file does not matter. The only thing that matters is that the last proximity trigger you place in the map editor works.
- Not tested, but assuming from other experiences: Other proximity triggers may also work, but not guaranteed. Just the last one you place seems to work 100%.
With the "SetPosition" command, you could dynamically move the last working trigger around the map. The trigger radius will move with the entity and the functionality remains intact (I have tested this). You can make the trigger move to all the locations you need to cover in a self-repeating loop. For example, place Trigger A, B, C and D and let D jump between the other 3 triggers infinitely.