HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Check it out mana leach!

08-18-2004, 01:45 AM#1
weaaddar
I have done what many have claimed impossible. I have made a non ability which will "leach" mana when a unit attacks another unit.

I have made it fairly customizable. Allowing you to specify the conditions that the unit will be able to steal mana, the condition that will specify what percentage of the damage induced will he steal, and most importantly, if the Unit will leach (steal the mana from attacked unit) or merely convert damage inflicted on others into mana.
http://weaaddar.wc3campaigns.com/manaleach.w3x
How it works...Well there is a global Unit is Attacked trigger running. Whenever a unit is attacked It does a check to see if the unit is capable of Mana Leaching. If the unit is indeed capable the it will create a timer for that unit. Then it will create a trigger and a triggeraction,The event is Unit Is Damaged. (ConvertUnitEvent(52)) . It stores the timer on the attacked unit, the trigger and triggeraction and the attacked unit on the timer, and the attacking unit on the trigger.
Now when the damage capture trigger fires, it checks that the unit dealing damage is the one the trigger specified. If it is the right unit then it will check if ML merely converts damage inflicted into mana. If it only converts it to mana then it merely adds The Percentage specified*the damage dealt. Otherwise it determines if the unit has enough mana to be leached from, if he does then it leaches mana, otherwise whatever mana the attacked unit has is given to the attacker, and the attacked units mana is set to 0. Finally, I clean up memory.
There are three potential issues...
A memory leak:
If the unit is attacked event fires I create all the object regardless of if your attack finishes (i.e. I run up to you and am about to strike but at the last moment hit stop on the attacking unit...this fires the event). THis generally isn't a problem because if he attacks again it destroy the old object stored on the attacked unit and makes a new one. But if you never attack him again then they will remain (worse case you die before I can ever get back to it. THis would really suck.) I could potentially tell the thread to sleep for like 5 seconds and then call the clear mem function, but if you have some ridiculously high cooldown it would mean mana leach wouldn't work.

Leaching mana for something you shouldn't:
If you were to cause the attacked event to fire, but didn't actually get the attack off and instead casted a damage spell you would get mana for it. I don't exactly know how I would go about fixing this one.

Too fast to capture:
If you are using a ranged unit that can attack many times the same unit before the first projectile hits the attacked unit then the captures will not work correctly. It will only capture for some of the attacks and not all of them. Because I can only reserve one capture trigger per each attacking unit.

Finally feedback related gunk :
What do you think of it in its current form? Does it need some snazzy effect? Any idea on which issue should be fixed, or how?
08-18-2004, 02:02 AM#2
Toxicseaweed
sounds very cool. But ahhh for the rest of us can you tell us in laymen terms what this does that couldn't be done before?
08-18-2004, 02:07 AM#3
weaaddar
If the unit has the requirements to use this non ability he will upon attacking a unit steal a percentage of the damage he inflicts and convert it into mana (or if the flag is off he will convert damage he dealt into mana regarldess of teh mana bank of the unit he attacks). Until 1.17 this could not of been done because there was no way to tell he was dealing the damage. And even with 1.17 it requires seriously skilled triggering or else you will be leaking memory like a whore.
08-18-2004, 02:56 AM#4
Pesmerga
Looks like a nice trigger for mappers to use in conjunction with an unholy aura of sorts. Weaaddar continues to amaze me with his ingenuis ideas and limitless potential in crafting and expanding the boundaries of Warcraft 3.

</suckup>
08-18-2004, 03:16 AM#5
weaaddar
I appreciate people liking my work, but can you possibly try to address the question at hand?

[sub]or rep me[/sub]
08-18-2004, 03:19 AM#6
Pesmerga
Quote:
Originally Posted by weaaddar
I appreciate people liking my work, but can you possibly try to address the question at hand?

[sub]or rep me[/sub]

Snazzy effects? Well, you definitly need a new model for the effect, over the units head when he leaches. To erase confusion and let the player see that the spell or skill or whatnot is taking effect. No one likes spells that have a gradual effect, or one not noticed easily.
08-18-2004, 12:52 PM#7
weaaddar
yeah but what effect. I suck at modelling and would perfer some effect thats already in the game. I have no problem with spawning and destroying effects that easy work.
08-18-2004, 02:42 PM#8
SpadeZ
wand of mana steal sfx would look pretty good. There are two in fact, so you have a choice between 2. OR you could use both, one for the caster, the other for the target.

Just a crazy suggestion.

08-18-2004, 02:49 PM#9
Vexorian
this uses 1.17 ? or you found a way with 1.15-1.16?
08-18-2004, 02:52 PM#10
weaaddar
1.17. No way around it. You can't get away with it without the damage source. ANyway I've updated it to fix some of the issues. (most of them except the one with the rapid attack) I'll upload after I give it a bit more of a test.
08-18-2004, 03:00 PM#11
Vexorian
then it was impossible but it is now possible, thank blizzard they used their mind a little this time and made such an useful native, I wonder if they will make GetEventDamageType though , I can make some use of that
08-18-2004, 04:47 PM#12
weaaddar
I don't believe this version belongs in the repository. Its barely explicable for usage as it is too quirky and still leaves you if not knowing better going "Zuh, what happened?". This thread is also searching for feedback on the special effect to use and is pretty much doomed to obscurity here.