Moderator
M
Moderator
12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.
20:09, 10th Apr 2013
Magtheridon96:
Comments
IcemanBo: Too long as NeedsFix. Rejected.
20:09, 10th Apr 2013
Magtheridon96:
Comments
- You can get rid of the
SquareRoot
call in your distance calculation in theTrig_WateryHeal_ProjTimer
function. Instead of comparingcurDistance
toWateryHeal_CollideDistance()
, you would compare it toWateryHeal_CollideDistance()*WateryHeal_CollideDistance()
. - You should probably move these:
JASS:set healingProjectile = null set healProjTimer = null set healGroup = null
- If you want, you can implement a dummy recycler to allow for more efficient execution (Way better than creating a ton of units. CreateUnit is a very slow function call as we all know)
- You should be able to use a global group variable created once instead of a local group inside the
Trig_WateryHeal_ProjTimer
function. - Since you're repeating
GetOwningPlayer(abilityCaster)
,GetUnitX(waterElemental)
, andGetUnitY(waterElemental)
inside the loop, you should cache them into variables. It's a waste to call them again and again and again for all created projectiles. You should probably only cache them inside the "Then" code block though. You don't need those cached variables unless that block of code actually runs. - In the function that runs upon casting the spell, you should only cache the triggering unit and the spell target coordinates inside the if block because you don't need them outside of it. You would also null them inside of it after caching them inside.
- The
Trig_WateryHeal_Stacks
functions runs every second even if the spell was never learned. Moreover, it iterates over all units in the map. This is terribly inefficient. You can speed this up greatly by having a static global group variable. Register an Ability-Learn event. Whenever a unit learns the right ability, add him to the group. The code may still run every second, but at least it wouldn't be as intensive as it was before. In fact, you don't even need a group for this. You can use a unit array and a count. Whenever a unit learns the right ability, add him to the array. Iterate over the units in the array every second and do what you have to do. This is WAY better in performance than doing a group enumeration over every single unit in the map every second. -
GetHandleId(GetExpiredTimer())
will return a constant value in the Stacks function because you're creating the timer once on map initialization. This means that you can totally get rid of this call and just use any constant value like$ffffff
(Yes, I believe that's valid JASS)