Snippet GUI-Friendly Damage Detection

Mcbeazy

New Member
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.
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
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.
 

Darkrevenger

New Member
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
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
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
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
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
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
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
Convert the real to an integer. Though, this will not round. It'll floor it. (Drop anything after decimal.)
 
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
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
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 The Helper:
    they did not winterize any of the plants and they froze
  • The Helper The Helper:
    it is not that power consumption went up it was available capacity went down with power plants freezing
  • Varine Varine:
    What a fucking disaster. Are all of the Texas people okay? I see TH is, are we the only two?
  • Varine Varine:
    How have the other states held up? I just got power back so I have no idea what's going on, we didn't get warning
  • Varine Varine:
    Why the fuck didn't they fix this ten years ago when it happened?
  • Blackveiled Blackveiled:
    I'm in it with you and TH as well. My power has been in and out, and I have a ruptured pipe that I need to fix, shouldn't be too bad to fix myself.
  • Varine Varine:
    I hope you're staying warm! Apparently the supply is coming up so hopefully we can get back to normal power soon, mine has been on for six hours now.
  • M Mulciberxp:
    My power has been off most of the last 2 days. We had a generator installed 3 years ago though, so we're staying warm. Water is another issue...
  • The Helper The Helper:
    Where I live has a pool so we are using that to get water to flush the toilets. We have enough bottled water to drink and brush teeth and stuff but it has been a few days and no shower though....
  • Varine Varine:
    I had some water in gallon jugs, and got our water back on yesterday. We don't seem to have any leaks, but I haven't crawled down there to look yet.
  • The Helper The Helper:
    still no water I cannot remember when I last showered now I know how they felt in the old west lol
  • Varine Varine:
    My poor plants are happy, they aren
  • Varine Varine:
    aren't used to going this long without water or lights or normal heat. I think a couple of them froze, but they look like they'll make it
  • Varine Varine:
    Well one of them is pretty rough but I think it was sick to begin with, that one always had some problems.
  • jonas jonas:
  • jonas jonas:
    ???
  • Ghan Ghan:
    That is such a Texas thing to say lol
  • midnight8 midnight8:
    a positive could come out of this. So many people trapped at home could put a dent in the covid numbers in Texas
  • Varine Varine:
    That dude, Tom Boyd, is really upset about the backlash from his "it's your fault you're freezing" thing because he claims he resigned before saying it, so it wasn't like he said it in his official capacity or anything.
  • jonas jonas:
    Almost as if he was saying "screw you guys, I'm going home"
  • Varine Varine:
    I'm fairly new here still but that seems to be the analogous message by several of our politicians.
  • vypur85 vypur85:
    Nobody?
  • jonas jonas:
    Hi vypur85, long time no see
  • tom_mai78101 tom_mai78101:
    Hi vypur85, long time no see.
  • The Helper The Helper:
    We are all somebody

    Members online

    No members online now.

    Affiliates

    Hive Workshop NUON Dome
    Top