| 09-01-2006, 06:56 PM | #1 |
I have just noticed an interesting bug (maybe you didn't know about it). If you try the following code on an unit with 0.00 life, you will get the "Unit is not dead" message. Same goes for GetUnitState(u, UNIT_STATE_LIFE). JASS:if GetWidgetLife(u)<=0.00 then call BJDebugMsg("Unit is dead") else call BJDebugMsg("Unit is not dead") endif It seems that checking on an unit with 0.00 if its life is less than or equal to 0.00, the value of the expression is "false".However changing the "<=" with "==" will evaluate true. And no, don't tell me about 0.405 stuff, I know about it. I know why I'm using 0.00. ~Daelin |
| 09-01-2006, 07:50 PM | #2 |
I am unable to replicate this. |
| 09-01-2006, 08:03 PM | #3 |
You can test it with any unit (I tried with archer). Store it into u, kill it, and then do this code. ~Daelin |
| 09-02-2006, 08:33 AM | #4 |
JASS:local unit u = CreateUnit(Player(0), 'earc', 0, 0, 0) call KillUnit(u) if GetWidgetLife(u)<=0.00 then call BJDebugMsg("Unit is dead") else call BJDebugMsg("Unit is not dead") endif I get "Unit is dead". ![]() |
| 09-02-2006, 08:50 AM | #5 |
Hahaha forget about unit state. Use IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD)==false Cause only this check will never return wrong values. I can make DEAD tree with 900 life, just set its life to 900 with no restore life native. Same with units. Also max unit life 0 not mean unit is deleted. GetUnitTypeId() if return 0 mean unit is deleted. 405 stuff is fake. |
| 09-02-2006, 10:23 AM | #6 |
Very interesting stuff. Thanks for pointing it out DioD. +rep ;) Oh sorry guys, I forgot to mention that I tried this in a filter function, so that may have been the problem. ~Daelin |
| 09-02-2006, 10:48 AM | #7 |
JASS:if GetUnitTypeId(UNIT) == 0 then THIS UNIT IS REMOVED JUST STOP TRIGGER endif if IsUnitType(UNIT,UNIT_TYPE_DEAD) == TRUE then THIS UNIT IS DEAD THIS UNIT CAN BE REMOVED SAFE endif if IsUnitLoaded(UNIT) == TRUE then THIS UNIT IS LOADED DO NOT REMOVE OR DAMAGE IT endif |
