• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Damage Bubble Ability

Status
Not open for further replies.
Level 4
Joined
Aug 17, 2014
Messages
102
Does anyone have any idea on how to make or get started on an ability that function almost exactly as Power Word: Shield from World of Warcraft?

I essentially wish to make a spell that upon activation it places a bubble around a character that would shield them for x damage (damage of all types). Once that x damage threshold is met the buff/bubble is destroyed.

Also, I would prefer if this were done using GUI
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,195
There are a dozen such abilities in the spell section. It is even easy to make one yourself now thanks to new functions added in recent patches.

The current approach is to use a damage detection system and in response to damage modify the damage taken using the recently added functions. The shield itself is tracked like any old instanced effect, possibly using a unit indexing system to give each unit a unique array index to hold the instance data. When the unit takes damage, reduce the damage to damage taken minus the minimum of damage taken and shield remaining and reduce shield remaining by the same amount. When shield remaining is 0 or when the buff expires, clean up.

The old approach was more complex since damage events fire before the damage is dealt to the units health pool but after it is scheduled to be dealt to the units health pool. To stop the unit dying one had to temporarily raise the units health to absorb all the damage, then using a 0 second timeout or other JASS thread deference system, set the units life to the appropriate combat damage amount. Things were made more difficult by multiple damages being able to occur before the thread deference system could fire meaning that a data structure was needed to track the appropriate life the unit should be left with. One could still get other damage based systems bugging out due to receiving incorrect damage or health amounts due to this trick. Some damage detection systems had this functionality built in to help reduce the occurrence of such errors.
 
Status
Not open for further replies.
Top