Hey, I was wondering how to check if a unit had a particular behavior (in triggers) upon its death. It seems when it relates to a dying unit, behaviors aren't recognized in conditions. I also tried adding the behavior flag "Enabled while dead". Also tried adding a death time to units after that didn't work. Still doesn't work. The condition I'm using is unit has behavior. It works fine on living units.
I suppose in theory that would work for my map if I had a trigger that recognized the death effect, then altered a global variable that my condition could rely on instead of the behavior check. Bit of a workaround, but sounds like it would work.
Sorry if it is considered as a necro. But I found this topic and I want to complete the answer for anybody who could need it.
abvdzh trick above works for me. Some of my units can have a behavior, which is removed only when they die. I don't remove it manually. When the unit dies, the behavior is automatically destroyed, so it can activate a specific trigger.
I am very sorry to resurrect this thread but I have an important piece of information related to this topic.
After the recent updates, you can actually do just that: A trigger with the event that any unit dies. Then when you try to access the behavior (or in my case the stacks of a certain behavior) on that particular unit, it always returns 0 or false. The key is, you need to set the flags "permanent" and "enabled while dead" in the data tab of your behavior. For me, this worked.
I am posting on this quite aged thread because I was struggling with this problem for a good week and pretty much only stumbled upon this thread. I thought I could help out others with similar problems.
Have a nice day.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hey, I was wondering how to check if a unit had a particular behavior (in triggers) upon its death. It seems when it relates to a dying unit, behaviors aren't recognized in conditions. I also tried adding the behavior flag "Enabled while dead". Also tried adding a death time to units after that didn't work. Still doesn't work. The condition I'm using is unit has behavior. It works fine on living units.
since no1 answers, isn't it possible to add a death response effect and use this effect as event in your map?
I suppose in theory that would work for my map if I had a trigger that recognized the death effect, then altered a global variable that my condition could rely on instead of the behavior check. Bit of a workaround, but sounds like it would work.
you probably could just use behaviour state changed event and then validate if triggered unit is dead.... didn't test it myself tho
Sorry if it is considered as a necro. But I found this topic and I want to complete the answer for anybody who could need it.
abvdzh trick above works for me. Some of my units can have a behavior, which is removed only when they die. I don't remove it manually. When the unit dies, the behavior is automatically destroyed, so it can activate a specific trigger.
I am very sorry to resurrect this thread but I have an important piece of information related to this topic. After the recent updates, you can actually do just that: A trigger with the event that any unit dies. Then when you try to access the behavior (or in my case the stacks of a certain behavior) on that particular unit, it always returns 0 or false. The key is, you need to set the flags "permanent" and "enabled while dead" in the data tab of your behavior. For me, this worked.
I am posting on this quite aged thread because I was struggling with this problem for a good week and pretty much only stumbled upon this thread. I thought I could help out others with similar problems.
Have a nice day.