Snippet GUI-Friendly Damage Detection

Discussion in 'Systems and Snippets' started by Weep, Oct 2, 2009.

  1. Avaleirra

    Avaleirra Is back. Probably.

    Ratings:
    +127 / 0 / -0
    quick question: does this detect spell damage?
     
  2. kingkingyyk3

    kingkingyyk3 Visitor (Welcome to the Jungle, Baby!)

    Ratings:
    +216 / 0 / -0
    quick question: does this detect spell damage?
    Yes.
     
  3. Mcbeazy

    Mcbeazy New Member

    Ratings:
    +2 / 0 / -0
    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?
     
  4. Sui-cookie

    Sui-cookie You can change this now in User CP.

    Ratings:
    +50 / 0 / -0
    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...
     
  5. Chaos_Knight

    Chaos_Knight New Member

    Ratings:
    +39 / 0 / -0
    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.
     
  6. Weep

    Weep Godspeed to the sound of the pounding

    Ratings:
    +400 / 0 / -0
    Yep, use Convert Integer to String and Convert Real to Integer, instead of Convert Real to String.
     
  7. Darkrevenger

    Darkrevenger New Member

    Ratings:
    +1 / 0 / -0
    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?
     
  8. Chaos_Knight

    Chaos_Knight New Member

    Ratings:
    +39 / 0 / -0
    Use Hardened Shell.
     
  9. Darkrevenger

    Darkrevenger New Member

    Ratings:
    +1 / 0 / -0
    That doesn't work for returning spell damage, though
     
  10. Weep

    Weep Godspeed to the sound of the pounding

    Ratings:
    +400 / 0 / -0
    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.
     
  11. Darkrevenger

    Darkrevenger New Member

    Ratings:
    +1 / 0 / -0
    It appears to run, the only thing is it doesn't do the damage to the damage source(?!?!) :banghead:
     
  12. jim7777

    jim7777 New Member

    Ratings:
    +0 / 0 / -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!
     
  13. Weep

    Weep Godspeed to the sound of the pounding

    Ratings:
    +400 / 0 / -0
    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.
     
  14. najrasaam

    najrasaam New Member

    Ratings:
    +0 / 0 / -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
     
  15. Sevion

    Sevion The DIY Ninja

    Ratings:
    +423 / 0 / -0
    Convert the real to an integer. Though, this will not round. It'll floor it. (Drop anything after decimal.)
     
  16. DuelPlayer

    DuelPlayer Member

    Ratings:
    +21 / 0 / -0
    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.
     
  17. 13lade619

    13lade619 is now a game developer :)

    Ratings:
    +399 / 0 / -0
    this detects any damage. there is no filtering if it's either spell damage or attack damage.
     
  18. DuelPlayer

    DuelPlayer Member

    Ratings:
    +21 / 0 / -0
    Is there any ways to detect spell damage or normal attacks?
     
  19. Weep

    Weep Godspeed to the sound of the pounding

    Ratings:
    +400 / 0 / -0
    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.
     
  20. tommerbob

    tommerbob Minecraft. :D

    Ratings:
    +110 / 0 / -0
    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?
     

Share This Page