Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
So the best solution is to just make variables different from trigger to trigger.. Thats bogus considering using array could be efficient and time-saving when making variety of spells
If it's just when the ability effect starts, then you can use one caster variable for those provided they are not used after waits or timer loop triggers.
It's not really bad. However do note that arrays (no matter what size you set them) have 8192 (or so) slots. Unless you need it really much, it's probably better to use different variables.
You would also have to have a system for managing all this so that your code doesn't replace one unit by another inside the array by accident.
I do advise using temporal variables tho. Temporal variables are variables that get something assigned into them, that something is used immediately and then discarded - they do not save stuff for any period of time.
An example is creating unit at location:
Set loc = *somewhere* //create location
Unit - Create unit at loc //immediately use it
Custom script: call RemoveLocation(udg_loc) //destroy it to prevent memory leak
The advantage of this? You can use these temporal variables anywhere in your code, because they don't save anything for any length of time, there is no need to worry about accidently overwriting what's inside them.
You should recycle variables whenever possible. An example is what I refer to as "register variables" which are global variables that are used instantly in place of locals. They are perfectly safe to use everywhere as long as any actions run while they are in use will not result in their use in another thread.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.