• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Combat Camera effects when attacked

Status
Not open for further replies.
Level 27
Joined
Dec 3, 2018
Messages
897
I'm trying to make a trigger which should make the screen red and shake it based on how many enemies are attacking a unit and how low that unit is.
I made this trigger but doesn t get the job done
  • Attacked Shake
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Hero Unit for (Triggering unit)) Greater than or equal to 1
    • Actions
      • Set VariableSet Shake[(Player number of (Owner of (Triggering unit)))] = (Shake[(Player number of (Owner of (Triggering unit)))] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Shake[(Player number of (Owner of (Triggering unit)))] Greater than 0
        • Then - Actions
          • Camera - Shake the camera for (Owner of (Triggering unit)) with magnitude (1.00 + ((Real(Shake[(Player number of (Owner of (Triggering unit)))])) / 2.00))
          • Cinematic - Fade out over 5.00 seconds using texture White Mask and color (100.00%, 0.00%, 0.00%) with 95.00% transparency
          • Wait 1.00 seconds
          • Camera - Stop swaying/shaking the camera for (Owner of (Triggering unit)).
        • Else - Actions
          • Wait 2.00 seconds
          • Camera - Stop swaying/shaking the camera for (Owner of (Triggering unit)).
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
"A unit is attacked" runs when a unit begins the windup animation before an attack, not when a unit takes damage. There is no "a unit takes damage" event because it just doesn't exist in the game code. People make Damage Detection Systems (recommended: Damage Engine 5.9.0.0) to overcome this issue, and that's what you need to use to trigger this effect.

That being said I think the problem is just that the magnitude is too low to be noticed, and it only lasts for 1 second while the red fade is over 5s. Also Shake[] is never decreased so what's the point of checking if it's > 0?
 

Uncle

Warcraft Moderator
Level 74
Joined
Aug 10, 2018
Messages
7,961
Use a timer to stop the camera shake.

A unit is attacked -> Increase intensity and start a 2 second timer

Timer expires -> Stop the camera shake

The Timer will get reset each time the unit is attacked, preventing the camera from stopping until your unit hasn't been attacked by anything for a full 2 seconds.

And shouldn't Shake be a Real variable since the shake magnitude uses a Real.
 
Status
Not open for further replies.
Top