• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Unit becomes red when damage received

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
Hi!

I want every unit in my map to become red for 0.25 seconds each time it takes damage. With "red" I mean "DotA's Alchemist Stun no thrown"-Red color. How can I trigger this?
 
Level 17
Joined
Feb 11, 2011
Messages
1,860
  • Trigger
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 0.00%, 0.00%) with 0.00% transparency
      • Wait 0.25 seconds
      • Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Works great!

There's a small time-gap between detecting "Unit is being attacked" and The animation/sound/effect of the attack, wich is different for every unit, but I set "Wait" before the first animation change to make the change more accurate and realistic :). Also reduced the "Red time" to 0.20.

Question: Does this work for each Damage Tick of poison, burning, and that kind of buff/skills/effects/, or just the common "Attack"?

Question: Is it possible somehow to make the event "Unit takes damage" or "Unit HP is reduced"? This way it would work under any HP-loss situation (poison, burning, lifesteal, etc.)
 
Again, Mr_Bean987 - this trigger can easily bug with Waits usage. Either use timer/loop/hashtable or locals.

@Spartipilo EVENT_UNIT_DAMAGED exists in GUI too. However, there are systems which can help you with this stuff making your job piece of cake.
Bribe's DamageEvent or Weep's GDD are recommended for GUI users.

Your trigger can look somewhat like (uses Bribe's one):
  • Trigger
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • //stuff here if needed
    • Actions
      • Custom script: local unit u = GetTriggerUnit()
      • Custom script: call SetUnitVertexColor(u, 255, 50, 50, 255)
      • Wait 0.25 seconds
      • Custom script: call SetUnitVertexColor(u, 255, 255, 255, 255)
      • Custom script: set u = null
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Spinnaker has the best solution.

By combining Weep's GDD and a use of local variable, everything will goes accordingly to each unit.

Mr. Bean's trigger is not MUI lol, but Spinnaker is.

So, use Spinnaker's instead.

@Spinnaker
Lol, once you've used Custom script (mostly on the trigger), it's better to make it fully custom script :)

Wait is changed to TriggerSleepAction(0.250)
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
I Choosed Weep's GDD, but i'm not sure on how to use it.

  • Damage Detector
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
    • Actions
      • Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 0.00%, 0.00%) with 0.00% transparency
      • Wait 0.20 seconds
      • Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
Just copy/paste the trigger as Weep's GDD says, and then this trigger y posted before?
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
I said, follow Spinnaker's Custom script, it will make your trigger to support all units in that map at once instead of bugging each, for a unit.

The:
  • Actions
    • Custom script: local unit u = GetTriggerUnit()
    • Custom script: call SetUnitVertexColor(u, 255, 50, 50, 255)
    • Wait 0.25 seconds
    • Custom script: call SetUnitVertexColor(u, 255, 255, 255, 255)
    • Custom script: set u = null
This
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Thanks! Works great! I'm using -Triggering Unit- Since the Tutorial says that it's better to use it if "Wait" actions are going to be used.

SOLVED
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
I have one more issue.

I have dummy skills based on Unholy Frenzy, wich does 0 damage, but when the skill's triggered it becomes red, though its not receiving any damage.

Is there a way to set a minimum value so the trigger gets activated? Lets say "1 damage"?
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
If you set Unholy Frenzy to 0 damage, it is considered as damage lol
0 is a value, and not an unknown for the trigger to detect
0 damage IS in fact, a damage too.

So, you must put an exception to this situation like putting Conditions to it:

  • Conditions
    • Events
      • Use your appropriate Event (either Weep's GDD or Bribe's)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has buff Unholy Frenzy) Equal to True
        • Then - Actions
          • -------- This is where the red-chaning-unit action does not occur if the unit has specific buff on it --------
        • Else - Actions
          • -------- Here your "red-changing-unit action is" --------
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Hehe, i Got the answer.
Using "Unit has Buff" didn't worked, because... I don't know, but didn't work. Worked with "Unit is in region", but after hero leaving region, it became red (Even having the Has Buff Unholy Frenzy condition, in "or" or common "If" condition list.

Solution: REAL COMPARISON: GDD_DamagedUnit (The Weep's GDD variable for DamagedUnit) LIFE is Greater tan 1.00 :)

This is another step for an awesome RPG i'm making... =)
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Oh yeah, GDD from Weep can do that by manipulating the Event, GDD_Event LOL.

Change the GDD_Event to Not equal to 0.00 (this will ignore Unholy Frenzy of damage 0). A damage can be either negative or positive, so that's why use Not equal to 0.00, this means that if it detects a 0 damage (does nothing), the trigger will obey the condition to only detect damage not equal to 0.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Nop... Answers relies on "GDD_Damage" since it refers to the amount of damage taken. =)

This works
  • Color change
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GDD_Damage Equal to 0.00
        • Then - Actions
          • Skip remaining actions
        • Else - Actions
          • Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 0.00%, 0.00%) with 0.00% transparency
          • Wait 0.19 seconds
          • Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
This doesn't
  • Color change
    • Events
      • Game - GDD_Event becomes Not equal to 0.00
    • Conditions
    • Actions
      • Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 0.00%, 0.00%) with 0.00% transparency
      • Wait 0.19 seconds
      • Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
And this is the best way
  • Color change
    • Events
      • Game - GDD_Event becomes Not equal to 0.00
    • Conditions
      • GDD_Damage Not equal to 0.00
    • Actions
      • Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 0.00%, 0.00%) with 0.00% transparency
      • Wait 0.19 seconds
      • Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Okay...
I'm not master the usage of that system yet... but that will work, right ?

For mckill
you dont need weep's damage detection on this...just use >>> starts te effect on ability :p...
The ability is damage per second (default mechanism), you cannot use Starts the effect of an ability, LOL.

Don't know if he use Unholy Frenzy to just borrow the mechanics of "Target-unit" only and doesn't make use of the advantage of damage per second.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Its a dummy ability based on Unholy Frezy :) And, i'm not a master neither xD I'm just sharing what i've learned through 6 days of 13 hours/day of making my first RPG system/terrain/units, etc. Was the first time I opened the World Editor :p Never made a map b4
 
it will work but you dont need GDD really...
  • Untitled Trigger 002
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Unholy Frenzy
    • Actions
      • Animation - Change (Target unit of ability being cast)'s vertex coloring to (100.00%, 0.00%, 0.00%) with 0.00% transparency
      • Wait 0.19 seconds
      • Animation - Change (Target unit of ability being cast)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
EDIT:
or making it MUI

  • Untitled Trigger 003
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Unholy Frenzy
    • Actions
      • Custom script: local unit u = GetSpellTargetUnit()
      • Custom script: call SetUnitVertexColor(u, 255, 0, 0, 0)
      • Wait 0.19 seconds
      • Custom script: call SetUnitVertexColor(u, 255, 255, 255, 255)
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
@mckill2009: I want exactly the opposite of that :)

@defskull: I'm using Unholy Frenzy because it had some sparks over the head, changed the Spark for other model, and done, I have a great effect. It isn't even an Hero Ability, its a dummy ability that creates a rune, gives it to the hero, and Rune Ability is based on a Custom made skill based on Unholy Frenzy, only that I havent modified the buff icon/tooltip :) I also know that there are several abilities I can use, without a buff, to make the effect over the head... but this way works fine 'till now :)
 
Status
Not open for further replies.
Top