| 02-18-2007, 10:00 PM | #1 |
I would like to design a power word: shield spell. I have seen one in a map before. For those of you who have not played WoW, Power Word: Shield is an ability that is cast upon an ally. That unit then gains a shield with an amount of life. When the shield is broken, the unit is once again vulnerable. If anyone has already designed this spell or would like to tell me how to design this spell, let me know. I do prefer GUI, if possible, but I will not require it. +rep to anyone who helps. |
| 02-18-2007, 11:23 PM | #2 |
My guess is use the ability hardened skin, a spellbook, and a timer. set the first level of hardened skin to do 0 damage reduction. put the hardened skin into a spellbook to hide it (disabling/enableing the spellbook ability). when someone casts a dummy ability (channel) on a unit enable the spellbook and change the level of the hardened skin ability on the unit to level 2 or something. Somehow make a timer for each unit so you know when to set the ability hardened skin back to level 1 |
| 02-19-2007, 12:45 PM | #3 |
Ya, but Power Word: Shield doesn't exactly work like that. It will do something like "Absorbs 300 damage". Once the 300 damage has been taken (or the buff timer runs out), the hero's life will be vulnerable once again. It doesn't simply subtract a portion of the damage from every attack. |
| 02-19-2007, 12:53 PM | #4 |
Your right sorry. It's been a while since I've played wow. My new idea is to use the AttackDetect Engine, a dummy spell and a trigger to calculate damage from hits and add the life back. http://www.wc3campaigns.net/showthread.php?t=79545 It's not perfect but I have to run. no time. |
| 02-20-2007, 07:01 PM | #5 |
The problem with calculating damage and giving health back is that you could still end up dead upon taking enough damage in one strike. I would suggest using a dummy spell and add a mana-shield buff to the target that uses 0 mana per point of damage. Then have a variable that is set to the amount of damage the shield can take and subtract from it whenever the affected unit takes damage and remove the shield when the variable is <= 0. Then of course a timer. Or you could do it his way but things always seem to work better when you have multiple suggestions to work off of... in my opinion. |
| 02-20-2007, 07:23 PM | #6 |
This is really simple spell (similar to Aphotic Shield from DotA, Defensive Matrix from Starcraft etc). The absorbing damage problem is really simple. Just link to the target the current life of the shield (real). Have a local trigger which detects everytime the target is damaged (therefore, 100% accuracy upon moment when damage received, not to mention that you have native to retreive the damage received). Now, the trick is to heal the unit for the amount of damage received, and reduce it from the shield's life. It would go like this (this is a small sketch, not an actual of code) Code:
shield_life = shield_life-damage
if shield_life<0 then
- remove shield
- heal=-shield_life
else
- heal = damage
endif
hm=(damage+cur_unit_life)-max_unit_life
if hm<=0
set cur_unit_life = cur_unit_life+hm
else
set cur_unit_life = max_unit_life
create a timer
link hm to timer
start timer with 0.00 delay, non-repetitive and upon execution just heal the target for hm
endifThat's kinda it. Why the timer? Because the trigger is fired right before the unit actually receives the damage. So practically if your unit had 20/30 life and you would have to "heal" it for 15 damage, it would do 20+15/30=30/30 and AFTER that, the damage will be dealt, resulting in 15/30. On the other hand, if the unit has 20/30 life and it should receive 5 damage then right when the trigger is fired it would be 25/30 and a moment after, it would be reverted to 20/30. Hope it is clear! And mana shield? Hell no! That ability is simply obnoxious and there is no such thing as "passive mana shield" (unless triggered of course ;) - Vexorian made one once). It would be far too complicated to do it that way. Go for the method mentioned above. It is stable and shouldn't cause any problems if implemented correctly. ~Daelin |
| 02-20-2007, 07:45 PM | #7 |
Wouldn't it also be possible to use harden skin making reducment to a very high number and min damage taken to 0.00, then detecting when the unit takes damage adding it to a real and when it becomes >= 300.00 removing harden skin from the unit. But there are other ways too, as Daelin already said. Give me some time to test this, i'll post the result tomorrow. |
| 02-20-2007, 08:00 PM | #8 |
Have you actually tried intercepting the total damage received by a "hardened skin unit" before the reduction of the skill? If it does, yes, this would be highly effective (as you don't need to filter the damage yourself), yet you should be careful to actually inflict the damage passing through the shield (fatal damage). E.g: Shield still has 20 life, you receive 40 damage. The hardened skin will filter the whole damage, but the unit must receive 20. You will have to trigger that after removing the skill. -Daelin |
| 02-20-2007, 09:35 PM | #9 |
Thanks for the help! |
