1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  4. Travel to distant realms and encounter scenes unknown to the common folk. The Greatest of Adventures is upon us with the 8th Cinematic Contest. Join in on a fun ride.
    Dismiss Notice
  5. The 18th Icon Contest is ON! Choose any ingame unit and give him/her Hero abilities. Good luck to all.
    Dismiss Notice
  6. Contestants are to create a scene set in the Stone Age. Come and see what you can come up with. We wish you the best of luck!
    Dismiss Notice
  7. Colour outside the lines! Techtree Contest #13 is a go. The contest is optionally paired.
    Dismiss Notice
  8. Greetings cerebrates, our Swarm needs new spawners that will have numerous children. Join the HIVE's 31st Modeling Contest - Spawners and Spawned! The contest is optionally paired.
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Questions about damage detection

Discussion in 'Triggers & Scripts' started by Krogoth, Oct 26, 2012.

  1. Krogoth

    Krogoth

    Joined:
    Apr 5, 2011
    Messages:
    247
    Resources:
    0
    Resources:
    0
    Since I have no PC but want to take a thought before, there are:
    1. Does unit takes damage event detect negative damage?
    2. Are there normal ways to identify spell damage upon unit takes damage event?
    3. If (1) is YES and (2) is NO, is it adequate if I make all spell damage negative to detect it and inverse sign upon unit takes damage event with my damage engine?
     
  2. Mr_Bean

    Mr_Bean

    Joined:
    Feb 11, 2011
    Messages:
    1,823
    Resources:
    6
    Maps:
    2
    Spells:
    4
    Resources:
    6
    Are you talking about the normal Warcraft 3 damage detection or about systems that people have made?
    1. I would imagine it does.
    2. No, only with the use of an advanced damage detection system. It will most likely require ALL spell damage to be triggered.
    3. Not sure, sorry.
     
  3. Krogoth

    Krogoth

    Joined:
    Apr 5, 2011
    Messages:
    247
    Resources:
    0
    Resources:
    0
    Does it separate spell damage from physical? How? o_O
     
  4. ap0calypse

    ap0calypse

    Joined:
    Jan 26, 2007
    Messages:
    4,780
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    There are several methods, but all of them have flaws. I believe the most common method is with an orb ability. This ability applies a 0.01-second buff on the target when hit, thus if the target has that buff, it is probably a physical attack.
    The flaw is that, I believe, those buffs collide with others (maybe poison arrow will work, but I cannot say for sure)

    3) My brain says no, but I don't know what Warcraft's going to say :p
    The reason is that, say the unit has 100% HP, the detected damage will be 0. It cannot receive any negative damage anymore. (-2 * 0) = 0, so spells won't do any damage at all.
    Even if the unit has, say, 800/1000 HP. If you use a spell with 300 damage (-300), it will only do 200 because of that max HP limit.


    Triggering all spells is actually the easiest method to differentiate between physical and magical damage with 100% accuracy.
     
  5. Krogoth

    Krogoth

    Joined:
    Apr 5, 2011
    Messages:
    247
    Resources:
    0
    Resources:
    0
    I tested it.) I made Chain Lightning with negative damage = no detection. Heal but not detected.) Only >= 0. But then I reset it and make magic reduction of Elune's Grace = -1 and give it to Robe of the Magi. And yeah, odd number of Robe = heal, even = damage. Both damage is detected, with correct numbers. The single wrong is the sign.)

    Screenshot of Bladestorm with my damage engine.

    What do you think, guys? Should I use it for spell damage detection?

    Offtopic: what ability is better to use for magic resistance item? (Planewalker's Cloak)
     
  6. ap0calypse

    ap0calypse

    Joined:
    Jan 26, 2007
    Messages:
    4,780
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    Hm, I tested it myself and came across 1 flaw in that system (aside from that, it's actually pretty sweet as far as I've seen).
    My unit had 1000 HP left and I cast a spell that did 500 damage (-500 in the object editor).
    Since the unit heals every spell, I need to do double damage (1000 damage), so the outcome would be correct.
    The problem is that it deals damage first, and then heals the target. So a 500 damage-spell would kill a 1000 HP-unit.

    A very simple workaround would be to use 1/100th of the actual damage (like -5.00 instead of -500) and then multiplying the damage by -101. (This still has that flaw, but it's less obvious).
    Another workaround can be achieved by adding a DOT on the target, one that ends in 0.01 seconds.
    Maybe you know of something else? :)


    For magic resistance, I'd use the "Spell Damage Reduction"-ability.
     
  7. Krogoth

    Krogoth

    Joined:
    Apr 5, 2011
    Messages:
    247
    Resources:
    0
    Resources:
    0
    You can add "survival ability" before damage is dealt and remove after. "Unit takes damage" event is before, timer expired 0.0 - right after that. "Survival ability" is just a huge hp boost to prevent death. You just remember hp before and set (old_hp - damage) for hp after.
    If you don't want to use damage engine, it's hard to do. There may be several damage sources at one moment and if you left 1 hp from one, second may kill him. So, that ^ manipulations aren't safe.
     
  8. ap0calypse

    ap0calypse

    Joined:
    Jan 26, 2007
    Messages:
    4,780
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    You're right about the 1/100th of the actual spell damage, but I already knew that (I just said it was a very simple solution).
    But adding/removing HP after a short time span is pretty much the same solution as dealing damage after a short time span (it's actually exactly the same idea).

    I think my option of the DOT would be as safe as your option to increase HP.
    The reason being that you do not deal damage until after the unit received the heal (negative damage). If the unit dies right after that (due to the DOT), then it is rightly so.
     
  9. Vladadamm

    Vladadamm

    Joined:
    Apr 19, 2011
    Messages:
    1,255
    Resources:
    9
    Maps:
    5
    Spells:
    3
    Tutorials:
    1
    Resources:
    9
    2. Hmm, this or using Orb Effects. Every unit as a basic orb effect which does nothing except applying a buff. Now in your Damage Detection trigger, you check if the unit has this buff, if yes, the damages were done by an attack and you remove the buff, if no, the damages were done by a spell.
    You can also put an orb effect for unit and another one for heroes to do a difference between them.
    The only problem of that, is that every "orb effect" abilities will need to be triggered.
     
  10. Krogoth

    Krogoth

    Joined:
    Apr 5, 2011
    Messages:
    247
    Resources:
    0
    Resources:
    0
    ^That is a bad way. At first, it is inefficient. At second, it does not give sharp information if damage source is multiple: one buff - many sources.
    My solution is better. This:
    1. Index every unit and give him spellbook with Elune's Grace (-1 magic resistance koef).
    2. Disable spellbook for all players.
    3. Check negative damage and inverse sign.
    Easy.
     
  11. Vladadamm

    Vladadamm

    Joined:
    Apr 19, 2011
    Messages:
    1,255
    Resources:
    9
    Maps:
    5
    Spells:
    3
    Tutorials:
    1
    Resources:
    9
    You should avoid negative damages. Use instead real heals (so, you set the current life of unit to current life of unit + amount of hp healed)

    One specific buff = Comes from a normal attack.
     
  12. Krogoth

    Krogoth

    Joined:
    Apr 5, 2011
    Messages:
    247
    Resources:
    0
    Resources:
    0
    No, I should not. It's a part of the system, it's a solution.
    Heal does not fire damage event.
    No, it does not. Buff is single, but source is multiple. (ex.: Rifleman (physical) and Gryphon (magic) damages the same time) Buff => normal attack by your logics, but some of them may be magic => gryphon's damage was determined as physical.
     
  13. Vladadamm

    Vladadamm

    Joined:
    Apr 19, 2011
    Messages:
    1,255
    Resources:
    9
    Maps:
    5
    Spells:
    3
    Tutorials:
    1
    Resources:
    9
    Y, but heal isn't reduced by armor while negative damages are.

    Nothing obligates you to use the same buff for Rifleman and Gryphon.