• 🏆 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!

adding blood effect to wounded heroes

Status
Not open for further replies.
Level 11
Joined
Jul 17, 2013
Messages
544
Hi my map is rpg so i would like to make a system where hero is bleeding after his hp is bellow 25% how can i do that? i also must remove the effect when hero dies? and i surley want the effect to be gone after he heals
 
Level 8
Joined
May 21, 2019
Messages
435
Special effects. Create a trigger that fires when a hero's HP drop below 25% then create the special effect and remove it after he dies or when he's healed up.
What he said, but if you're new to special effects, I wanna remind you that the bleeding animations don't usually loop. There's probably an appropriate way to make that the case, but from what I know, I'd focus on 2 things:

  1. Make sure that you delete the animations right after playing them. Otherwise, they will leak memory, even if they aren't visible anymore.
  2. To create a fake loop of sorts, you can make the bleed effect periodical, using a unit group of bleeding units. Then you loop through this group periodically, check if they have been healed above 25% hp or not, remove them from the group if they have, and play the bleed animation on them if they haven't.
 
Level 11
Joined
Jul 17, 2013
Messages
544
What he said, but if you're new to special effects, I wanna remind you that the bleeding animations don't usually loop. There's probably an appropriate way to make that the case, but from what I know, I'd focus on 2 things:

  1. Make sure that you delete the animations right after playing them. Otherwise, they will leak memory, even if they aren't visible anymore.
  2. To create a fake loop of sorts, you can make the bleed effect periodical, using a unit group of bleeding units. Then you loop through this group periodically, check if they have been healed above 25% hp or not, remove them from the group if they have, and play the bleed animation on them if they haven't.
What about making ability and giving this ability blood animation on chest? Then making it invisible and requiring upgrade
 
Level 8
Joined
May 21, 2019
Messages
435
What about making ability and giving this ability blood animation on chest? Then making it invisible and requiring upgrade
Pretty sure that the animation still just fires once when the ability is learned, and then never plays again. Looping animations is kind of a bitch in Warcraft 3, and I have no idea if there's an easy fix other than editing the model of the effect itself, which I have zero proficiency in.
 
Level 11
Joined
Jul 17, 2013
Messages
544
Pretty sure that the animation still just fires once when the ability is learned, and then never plays again. Looping animations is kind of a bitch in Warcraft 3, and I have no idea if there's an easy fix other than editing the model of the effect itself, which I have zero proficiency in.
Can you give me example how to store effect into value then remove it? For location i know its easy since u do temploc add effect at temploc then remove but specail effect part is kinda confusing for me
 
Level 8
Joined
May 21, 2019
Messages
435
Can you give me example how to store effect into value then remove it? For location i know its easy since u do temploc add effect at temploc then remove but specail effect part is kinda confusing for me
Actually, special effects are amongst the easiest things to clean!
You can literally call the GUI function "Destroy special effect" right after playing it. This will still allow the special effect to finish its animation, but will clean up the memory leak.
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
You can literally call the GUI function "Destroy special effect" right after playing it. This will still allow the special effect to finish its animation, but will clean up the memory leak.
Kinda. It will play the death animation of the model if it has one, otherwise it will play out its default animation for as long as it lasts.
 
Level 11
Joined
Jul 17, 2013
Messages
544
Actually, special effects are amongst the easiest things to clean!
You can literally call the GUI function "Destroy special effect" right after playing it. This will still allow the special effect to finish its animation, but will clean up the memory leak.
But i mean i want effect to last untill unit dies or gets healed so i guess i shouldnt remove him insta after adding?
 
Level 17
Joined
Mar 21, 2011
Messages
1,597
You can do sth like this if you dont have a permanent bleeding effect. destroying an effect right after you create it will still play its (death) animation


trigger 1:
Unit takes damage

if (hp below 25% and unit is not in unit group)
then
add unit to unitgroup



trigger 2:
every x seconds

pick every unit in unitgroup
if (hp of picked unit above 25%)
then
remove unit from unitgroup
else
play bleeding effect
destroy effect
 
Level 11
Joined
Jul 17, 2013
Messages
544
Pretty sure that the animation still just fires once when the ability is learned, and then never plays again. Looping animations is kind of a bitch in Warcraft 3, and I have no idea if there's an easy fix other than editing the model of the effect itself, which I have zero proficiency in.
You can do sth like this if you dont have a permanent bleeding effect. destroying an effect right after you create it will still play its (death) animation


trigger 1:
Unit takes damage

if (hp below 25% and unit is not in unit group)
then
add unit to unitgroup



trigger 2:
every x seconds

pick every unit in unitgroup
if (hp of picked unit above 25%)
then
remove unit from unitgroup
else
play bleeding effect
destroy effect


i think i will just base it on ability which adds special attachment give ability to unit then remove, since this way seems the simplest for me do you think it can cause memory leaks?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,538
@emil23
Remember that Damage Detection System that I used for your Greater Bash skill? You can use that same system to find when your Heroes drop below 25% health. Something like:
Event
DamageEvent Becomes Equal to 1.00
Actions:
If DamageEventTarget is a Hero equal to True and DamageEventTarget's life is less than or equal to 25.00% then Add the Bleed Effect ability to DamageEventTarget.

Then do what GIMLI_2 said and add the unit to a Unit Group so you can detect when it's life is > 25.00% and remove the Bleed Effect ability from it.
 
Status
Not open for further replies.
Top