The trigger works flawlessly without the condition, however I need to know if the "Dying Unit" has a certain behavior on it when it dies. Any and all help will be appreciated. I have tried all conditions involving behaviors (maybe not correctly), I have also tried replacing my behavior with a standard one, but nothing.
I have a feeling (untested) that behavior is lost on death... As an alternative, you could create a global "Flag Carrier" variable (Type: Unit), storing the unit that is currently carrying the flag, and then change that condition to "Triggering Unit == Flag Carrier".
SmokeFX, I just saw your PM (sorry, was AFK for a bit). I set up a quick test with what you described and I agree that it seems that the behavior is lost as soon as the unit dies.
Unfortunately, there is no way to set up the trigger to activate just before the unit dies. I tried setting a trigger for when a unit's life changes and added a condition that the unit's life = 0.0. I hoped that maybe this would get activated just before the unit "died" and lost its behaviors, but alas, it did not.
I think the workaround here is what the other posters have described. In my CTF map I have a global Unit array called "FlagCarriers" and the indices in the array correspond to the player numbers (e.g. the unit that is carrying Player 1's flag is at FlagCarriers[1]). Bear in mind that the flag carrier unit will actually be an enemy of whatever Player it is. This way you can know whose flag was being carried by the unit.
When a unit picks up the flag I set the appropriate entry in the array equal to the unit. When a flag carrier dies I set the corresponding entry to "No Unit". You can use this array in your "Any Unit Dies" trigger to know which flag to reset. Just loop through the array and check to see if the unit that died is in it. If you find a match then you know the player's flag that needs to be reset.
Does that make any sense? I can elaborate with an example if necessary.
The trigger works flawlessly without the condition, however I need to know if the "Dying Unit" has a certain behavior on it when it dies. Any and all help will be appreciated. I have tried all conditions involving behaviors (maybe not correctly), I have also tried replacing my behavior with a standard one, but nothing.
@DirtyDevious: Go
I have a feeling (untested) that behavior is lost on death... As an alternative, you could create a global "Flag Carrier" variable (Type: Unit), storing the unit that is currently carrying the flag, and then change that condition to "Triggering Unit == Flag Carrier".
@TheFallenOne222: Go
I did dabble with the global variable, but I have 4 players all with the same unit, so how do i specify if the dying unit had the flag?
Bump, still stuck
@DirtyDevious: Go
SmokeFX, I just saw your PM (sorry, was AFK for a bit). I set up a quick test with what you described and I agree that it seems that the behavior is lost as soon as the unit dies.
Unfortunately, there is no way to set up the trigger to activate just before the unit dies. I tried setting a trigger for when a unit's life changes and added a condition that the unit's life = 0.0. I hoped that maybe this would get activated just before the unit "died" and lost its behaviors, but alas, it did not.
I think the workaround here is what the other posters have described. In my CTF map I have a global Unit array called "FlagCarriers" and the indices in the array correspond to the player numbers (e.g. the unit that is carrying Player 1's flag is at FlagCarriers[1]). Bear in mind that the flag carrier unit will actually be an enemy of whatever Player it is. This way you can know whose flag was being carried by the unit.
When a unit picks up the flag I set the appropriate entry in the array equal to the unit. When a flag carrier dies I set the corresponding entry to "No Unit". You can use this array in your "Any Unit Dies" trigger to know which flag to reset. Just loop through the array and check to see if the unit that died is in it. If you find a match then you know the player's flag that needs to be reset.
Does that make any sense? I can elaborate with an example if necessary.
@FishbowlPete: Go
That is exactly the way I ended up going, and it works perfectly, I even am still using my behavior on the <flag carrier> so i am very happy