Moderator
M
Moderator
12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.
16:01, 8th Sep 2012
Magtheridon96:
Since you have a loop inside a loop inside a loop, I'm going to urge you to optimize it as much as possible
- Get rid of the 0.405 life check. The IsUnitType check is accurate enough, and the life check makes it less accurate because the life could be pretty much anything while a unit is dead. If it reaches 0.405 or less just once, the unit is dead and any changes to life will not make it live, so it is technically possible to have a unit with more than 0.405 HP that is dead.
- Instead of comparing something to false, change the expression from the form (expression == false) to (not expression). Apply this transformation across all your code for a nice little optimization.
- Make the damage/attack types configurable.
- Instead of (not IsUnitAlly(...)), just use IsUnitEnemy.
- In the Init function, use TriggerRegisterAnyUnitEventBJ. It's actually one of the few BJs that are good.
- Don't use the trigger global variable, use a local trigger in the Init function because the global variable is useless anyway. It's cleaner with the local trigger too ^.^
IcemanBo: Too long as NeedsFix. Rejected.
16:01, 8th Sep 2012
Magtheridon96:
Since you have a loop inside a loop inside a loop, I'm going to urge you to optimize it as much as possible
- Get rid of the 0.405 life check. The IsUnitType check is accurate enough, and the life check makes it less accurate because the life could be pretty much anything while a unit is dead. If it reaches 0.405 or less just once, the unit is dead and any changes to life will not make it live, so it is technically possible to have a unit with more than 0.405 HP that is dead.
- Instead of comparing something to false, change the expression from the form (expression == false) to (not expression). Apply this transformation across all your code for a nice little optimization.
- Make the damage/attack types configurable.
- Instead of (not IsUnitAlly(...)), just use IsUnitEnemy.
- In the Init function, use TriggerRegisterAnyUnitEventBJ. It's actually one of the few BJs that are good.
- Don't use the trigger global variable, use a local trigger in the Init function because the global variable is useless anyway. It's cleaner with the local trigger too ^.^