HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Concentrating, then releasing damage?

03-26-2006, 02:15 AM#1
Ignitedstar
Sorry about the title, it was the only thing I could think of without making this sound completely off.

Anyways, I was wondering how you would make something for a technique I wanted to make, but had no idea of making it.

So, what I want to happen is that the hero would stand still for, say, 5 seconds. During that time, any damage that he takes would be stored into a variable or something. And then, after the 5 seconds pass, the caster would then "release" the damage that he had taken into a small AOE around him. The damage released might be double or triple the damage that he had taken.

For people who've played Pokemon(any version), it's basically the same idea as "Bind".

Making the hero stand still and doing nothing for 5 seconds is easy, but I'm not sure on how I would get a variable to hold a number that would increase gradually overtime. Would someone mind helping?

If I'm not being clear enough, then please tell me. Thanks in advance you guys.

Oh right, another question: Even if I use Taunt for enemies to attack a person who does nothing, would they go on attacking him or switch automattically?
03-26-2006, 02:54 AM#2
TaintedReality
Are you using JASS or GUI? If JASS, detect every time a unit is damaged that has the spell buff, and add it to a handle variable attached to that unit. But, you would have probably thought of that already if you were using jass so I'm guessing you're using GUI =P. In that case, it would be hard to get something that worked with all units, but if each player only controls 1 hero, just make an integer/real array so each player has a variable for it.
03-26-2006, 10:03 AM#3
Anitarf
The problem here is with the unit-takes-damage event, as it's a specific unit event. In Jass, you would just create a new trigger with this event whenever the spell was cast and then destroy it when no longer needed, but in GUI, the best you can do is add new events to a premade trigger. Luckily, if you only need it for a hero, that's not too big a problem, as heroes usualy aren't dynamicaly created the way units are; adding a new event to a trigger whenever a unit is trained could be an isssue if the game runs long and many units are trained, but heroes are normaly only summoned at the start of the game.

So, when you summon a new hero that has this spell, add a unit-is-damaged event for that hero to the main spell's trigger: this trigger will then run whenever that hero takes damage (the trigger doesn't need to have any events, since we add them all later). In the trigger, you check if the hero is casting the spell and if he is, increase his damage value by the damage taken.

But, how to know if the hero is casting the spell, and where to get his damage value. Simplest method is with variable arrays. If you can have a maximum of one hero per player, just use the player number of the owner of the hero as the array index. You need two variables, one to store if the hero is currently casting that spell, and one to store the damage.

Now, in a seperate trigger, when the spell is cast, you make the hero stand still and set his is-casting-the-spell-variable, and after five seconds, check the damage taken variable and do the damage... you already have a part of that done.