Snippet GUI-Friendly Damage Detection

Mcbeazy

New Member
Reaction score
2
Hey, I am having trouble getting this to display just the damage taken and given above the heads. I don't want it to say *name of unit* damages *name of enemy* for X dmg, I jsut want Xdmg. Any ideas?
 

Sui-cookie

You can change this now in User CP.
Reaction score
49
Trigger:
  • damage text base
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
    • Actions
      • Set Tempoint = (Position of (Attacked unit))
      • Floating Text - Create floating text that reads ((String(GDD_Damage)) + <Empty String>) at Tempoint with Z offset 0.00, using font size 7.00, color ((Random real number between 0.00 and 100.00)%, (Random real number between 0.00 and 100.00)%, (Random real number between 0.00 and 100.00)%), and (Random real number between 10.00 and 50.00)% transparency
      • Floating Text - Set the velocity of (Last created floating text) to 70.00 towards (Random angle) degrees
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds


is what im using atm, but i do have a question. this goes into thousandths >.> if i remember right, is there a way to make it round to simple whole numbers? a small purple 8.021 looks like just 8021 when the text size is 7 and moving...
 

Chaos_Knight

New Member
Reaction score
39
When i say this i am totally serious.

JASS:
AWSOME!!


I think this gotta be one of the most useful and good Snippets ever(for GUI's). Awsome. Very useful when creating "15% chance to Effect Spell". Good Job.
 

Weep

Godspeed to the sound of the pounding
Reaction score
401
if i remember right, is there a way to make it round to simple whole numbers?
Yep, use Convert Integer to String and Convert Real to Integer, instead of Convert Real to String.
 

Darkrevenger

New Member
Reaction score
1
Trigger:
  • Reflection
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (GDD_DamagedUnit has buff Reflect ) Equal to True
    • Actions
      • Unit - Cause GDD_DamagedUnit to damage GDD_DamageSource, dealing (GDD_Damage x 0.50) damage of attack type Spells and damage type Normal


D: why doesn't this work?
 

Chaos_Knight

New Member
Reaction score
39
Trigger:
  • Reflection
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (GDD_DamagedUnit has buff Reflect ) Equal to True
    • Actions
      • Unit - Cause GDD_DamagedUnit to damage GDD_DamageSource, dealing (GDD_Damage x 0.50) damage of attack type Spells and damage type Normal


D: why doesn't this work?

Use Hardened Shell.
 

Weep

Godspeed to the sound of the pounding
Reaction score
401
D: why doesn't this work?

I don't see any reason that it shouldn't work, so check the usual things: you've specified the correct buff, the damage source is not spell immune (since you are reflecting as spell damage), the trigger is enabled... Try putting in a "display text" action for debugging, to see if the trigger is even running.

Be aware that if two units have the Reflection buff and one hits the other, you'll end up with an infinite loop as they reflect damage back and forth. You may want to disable the trigger as the first action and re-enable it as the last, to disallow recursion.
 

Darkrevenger

New Member
Reaction score
1
I don't see any reason that it shouldn't work, so check the usual things: you've specified the correct buff, the damage source is not spell immune (since you are reflecting as spell damage), the trigger is enabled... Try putting in a "display text" action for debugging, to see if the trigger is even running.

Be aware that if two units have the Reflection buff and one hits the other, you'll end up with an infinite loop as they reflect damage back and forth. You may want to disable the trigger as the first action and re-enable it as the last, to disallow recursion.

It appears to run, the only thing is it doesn't do the damage to the damage source(?!?!) :banghead:
 

jim7777

New Member
Reaction score
0
I have some problems in your system. Warcraft always disappears after Maybe because I try to add some math into the conditions because I want it to check if the attack is a backstab one or not. But it disappears. Here's the trigger:

Trigger:
  • Display Damage
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (GDD_DamageSource is A Hero) Equal to True
      • (Cos((GDD_FacingAngle - (Angle from GDD_BackstabPoint1 to GDD_BackstabPoint2)))) Less than (Cos(90.00))
    • Actions
      • Floating Text - Create floating text that reads (|cffffcc00 + (String((Integer(GDD_Damage))))) above GDD_DamageSource with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the fading age of (Last created floating text) to 2.00 seconds
      • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
      • Floating Text - Show (Last created floating text) for GDD_EnabledPlayers


Trigger:
  • Display Damage BackStab
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (GDD_DamageSource is A Hero) Equal to True
      • (Cos((GDD_FacingAngle - (Angle from GDD_BackstabPoint1 to GDD_BackstabPoint2)))) Greater than (Cos(90.00))
    • Actions
      • Floating Text - Create floating text that reads |c00ff8000Back Atta... above GDD_DamageSource with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the fading age of (Last created floating text) to 2.00 seconds
      • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
      • Floating Text - Show (Last created floating text) for GDD_EnabledPlayers
      • Unit - Cause GDD_DamageSource to damage GDD_DamagedUnit, dealing (GDD_Damage / 2.00) damage of attack type Hero and damage type Enhanced


Sir, if possible, If you can put an inline function regarding the backstab because I really need it. To check if the attacking unit is backstabbing or not or any help on how to prevent it or optimize my triggers.

Thanks!
 

Weep

Godspeed to the sound of the pounding
Reaction score
401
Warcraft always disappears after

Trigger:
  • Display Damage BackStab
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (GDD_DamageSource is A Hero) Equal to True
      • (Cos((GDD_FacingAngle - (Angle from GDD_BackstabPoint1 to GDD_BackstabPoint2)))) Greater than (Cos(90.00))
    • Actions
      • Unit - Cause GDD_DamageSource to damage GDD_DamagedUnit, dealing (GDD_Damage / 2.00) damage of attack type Hero and damage type Enhanced
You've created a classic "infinite loop" situation - when you deal damage in this trigger, it causes the trigger to run again, ad infinitum. The solution is to turn off the trigger before dealing the backstab damage, and turning the trigger back on afterward.
 

najrasaam

New Member
Reaction score
0
Heey question on the damage detection system

it displays the damage done in 5 digits or more like : (89.213)
I just want 89. nothing more. How to make this?

i just want 2 or more digits but nothing behind the dot.

tnx in advance
 

Sevion

The DIY Ninja
Reaction score
424
Convert the real to an integer. Though, this will not round. It'll floor it. (Drop anything after decimal.)
 

DuelPlayer

Member
Reaction score
21
Does GDD include spell damage or only normal attacks?
It happened once when I casted a spell on a unit. The unit got knockback which is in another trigger.
 

Weep

Godspeed to the sound of the pounding
Reaction score
401
Is there any ways to detect spell damage or normal attacks?
If all spells in your map deal damage by triggers, you can temporarily set a boolean variable to true when dealing spell damage. Therefore, if the boolean is false when a unit takes damage, it must have come from an attack.

Otherwise, if you are comfortable triggering all buff-on-attack abilities, every unit can be given a hidden buff-on-attack ability which will let you determine whether the damage came from an attack by checking whether the damaged unit has that buff.

As far as I'm aware, these are the only reliable methods for discerning attack damage apart from spell damage in WC3.
 

tommerbob

Minecraft. :D
Reaction score
110
I guess this is an FYI more than anything.

I've been using the GDD damage detection in my spell, and referencing the GDD_DamageSource as "triggering unit" in my hashtable Key Handle. I didn't think it would work because the custom variable cannot be referenced in a Handle, but it seems to being working just fine.

Is this a bug, or was I misinformed, or what?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top