• 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!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Quick Question about Location Leak

Status
Not open for further replies.
Level 3
Joined
Oct 31, 2010
Messages
32
Hey guys so I'm new to making spells and I wanna know if I removed the leaks on my spell correctly.


Uploaded with ImageShack.us

This is only the portion that has the leak remover. There is a variable called Ninja_Loc and thats what I wanna remove.

And here is the question... Did I do it right?:ogre_haosis:

The Spell is a passive slow. Your hero is attacking a unit and it has a % chance to slow the unit. If I removed the leaks right I might upload it to the spells section... but I dont think the mods will like it because it a bit to simple.



Skill is up and it is her

EDIT-LOG:
1)Removed Do nothing and created variable Ninja_Dummy_Unit
2)Moved variable Ninja_Loc and leak remover into the Than
 
Last edited:
Level 12
Joined
Dec 10, 2008
Messages
850
Looks good, but (and I might be wrong, I'm not 100% sure for I/T/E's) Last Created Unit may not be remembered through it, and if you have a wait above it then it wont be remembered if 2 are cast at the same time.

You can also remove the Do Nothing in Else, as it is useless and wastes time. (Calls a function, runs it, and takes what it returns, which is nothing, were having nothing there wont do that. Same thing, but faster)
 
Level 3
Joined
Oct 31, 2010
Messages
32
so I should create a variable to store the last created unit and instead of the built in "Last created unit" use the variable and also get rid of the do nothing. ok thanks :thumbs_up:


EDIT:
Ok so I did what you suggested and now here is another question do unit variables have leaks or am I ok with that?
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
You don't need to use a variable for last created unit unless you are passing through any sort of delay (notably, a wait) or are creating another unit in between (obviously). Internally, Last Created Unit is just a global variable, so storing it in another global variable is kind of pointless unless, as mentioned, you are trying to carry it through a wait or the creation of another unit.
 
Level 3
Joined
Oct 31, 2010
Messages
32
Alright so I have 3 approvals:thumbs_up:

And now that I created the variable I dont feel like changing it (it does the same thing), but in the future I will know thanks.

I will create a map and upload it into the spell section. I will post the link here. thanks again guys.:ogre_haosis:
 
Status
Not open for further replies.
Top