• 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.

How to check where the dmg came from?

Status
Not open for further replies.
Level 6
Joined
Oct 4, 2011
Messages
226
Hi im using weeps, damage detection system. Making an ability thats triggered with the units attack. 300 AoE 20 damage and a 20% movement speed slow that lasts 2 seconds. The trouble Im having is figuring out how to check if the damage came from the "damage source" attacking, ONLY. Thank you.

  • Tar missles
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Tar Missles (Battle Tank) for GDD_DamageSource) Greater than 0
        • Then - Actions
          • Set TM1_CasterUnit = GDD_DamageSource
          • Set TM1_CasterLoc = (Position of TM1_CasterUnit)
          • Set TM1_OwnerPlayer = (Owner of TM1_CasterUnit)
          • Set TM1_TargetUnit = GDD_DamagedUnit
          • Set TM1_TargetLoc = (Position of TM1_TargetUnit)
          • Set TM1_InitialDistance = (Distance between TM1_CasterLoc and TM1_TargetLoc)
          • Unit - Create 1 Movement slow (Tank) for TM1_OwnerPlayer at TM1_TargetLoc facing TM1_TargetLoc
          • Unit - Order (Last created unit) to Human Mountain King - Thunder Clap
          • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
        • Else - Actions
      • Custom script: call RemoveLocation(udg_TM1_CasterLoc)
      • Custom script: call RemoveLocation(udg_TM1_TargetLoc)
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Damage will always came from Damage Source xD

Remove " Set TM1_CasterUnit = GDD_DamageSource" and use "Damage Source" variable.

Damage will came from the Dummy, not from the Caster.

Add this:
Turn off (this trigger)
Order GDD_DamageSource to damage GDD_DamagedUnit dealing 20.. blah blah
Turn on (This trigger).

That way the same unit that triggered this will be the Damage Source
 
Level 6
Joined
Oct 4, 2011
Messages
226
hmm.. I did my best but it never works so far. this is what I have.
  • Tar missles
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Tar Missles (Battle Tank) for GDD_DamageSource) Greater than 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Custom script: if GetUnitCurrentOrder(udg_GDD_DamageSource)==851983 then
          • Set TM1_CasterLoc = (Position of GDD_DamageSource)
          • Set TM1_OwnerPlayer = (Owner of GDD_DamageSource)
          • Set TM1_TargetLoc = (Position of GDD_DamagedUnit)
          • Unit - Create 1 Movement slow (Tank) for TM1_OwnerPlayer at TM1_TargetLoc facing TM1_TargetLoc
          • Unit - Order (Last created unit) to Human Mountain King - Thunder Clap
          • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
          • Custom script: call RemoveLocation(udg_TM1_CasterLoc)
          • Custom script: call RemoveLocation(udg_TM1_TargetLoc)
          • Custom script: else
          • Custom script: endif
          • Trigger - Turn on (This trigger)
        • Else - Actions
:ogre_frown:
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Space_Ship said:
Hi im using weeps, damage detection system. Making an ability thats triggered with the units attack. 300 AoE 20 damage and a 20% movement speed slow that lasts 2 seconds. The trouble Im having is figuring out how to check if the damage came from the "damage source" attacking, ONLY. Thank you.

What I understand: You wan't the damage source to do an AoE slow that deals 20 damage and slows for 2 secs. If you do it with a dummy, those "20 damage" will be dealt by the dummy unit and not by the initial damage source who triggered this. You can make your dummy do the slow part, and create a function that picks every unit in 300 AoE from the position of the damaged unit, and order the triggering unit to damage them. If you do that without turning off/on the trigger before/after the damage action, it will go into an endless loop what will crash your game, because the damage you deal inside the trigger will trigger again. Turning off/on avoids that and it's pefectly safe.

Sorry if I missunderstood something.
 
Level 6
Joined
Oct 4, 2011
Messages
226
Okay I will use your idea if triggering the damage instead of using the dummy ability, but My trigger hasn't been doing anything for a while now and THIS IS STILL MY PROBLEM = NO EFFECT. I will post the test map for you all, trigger is under the 'Tank" folder. at start of the game type -start :vw_sleep:
 

Attachments

  • Arena Idea 0001C.w3x
    169 KB · Views: 92
Level 20
Joined
Jul 14, 2011
Messages
3,213
I see tank with 40 dmg dealing 40 (Natural) + 20 (Triggered) damage.
  • Tar missles
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Tar Missles (Battle Tank) for GDD_DamageSource) Greater than 0
        • Then - Actions
          • Set TM1_CasterLoc = (Position of GDD_DamageSource)
          • Set TM1_OwnerPlayer = (Owner of GDD_DamageSource)
          • Set TM1_TargetLoc = (Position of GDD_DamagedUnit)
          • Unit - Create 1 Movement slow (Tank) for TM1_OwnerPlayer at TM1_TargetLoc facing TM1_TargetLoc
          • Unit - Order (Last created unit) to Human Mountain King - Thunder Clap
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Set TM1_AreaGroup = (Units within 300.00 of TM1_TargetLoc matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an ally of TM1_OwnerPlayer) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((Race of (Matching unit)) Not
          • Trigger - Turn off (This trigger)
          • Unit Group - Pick every unit in TM1_AreaGroup and do (Actions)
            • Loop - Actions
              • Unit - Cause GDD_DamageSource to damage (Picked unit), dealing 20.00 damage of attack type Hero and damage type Normal
          • Trigger - Turn on (This trigger)
          • Custom script: call DestroyGroup(udg_TM1_AreaGroup)
          • Custom script: call RemoveLocation(udg_TM1_CasterLoc)
          • Custom script: call RemoveLocation(udg_TM1_TargetLoc)
        • Else - Actions
 
Level 6
Joined
Oct 4, 2011
Messages
226
Either way Spartipilo this doesn't help me!! It will work if the unit does ANY damage ok but I plan on having items, and even abilities for this unit that will do damage it needs to only work on attacks and your trigger doesnt even involve the "Custom script: if GetUnitCurrentOrder(udg_GDD_DamageSource)==851983 then" order... I need to make it as a response to attacks only. currently this script doesnt even work because it doesnt detect any damage not even from attacks.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Oh... I forgot that part. Well. The trigger as I posted works. Deals the desired amount of damage, and creates the dummy that claps and slows units.

The hard part of what you want is the small time gap between the Unit order and the damage dealt. You give your unit another order while the missile is in the air, and it wouldn't trigger since the unit order wouldn't be "attack". Anyway, most players won't do that. The following trigger will work only if the current order of the DamageSource is still "attack" when the damage is dealt.

  • Tar missles
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Level of Tar Missles (Battle Tank) for GDD_DamageSource) Greater than 0
          • Then - Actions
            • Custom script: if GetUnitCurrentOrder(udg_GDD_DamageSource)==851983 then
            • Set TM1_CasterLoc = (Position of GDD_DamageSource)
            • Set TM1_OwnerPlayer = (Owner of GDD_DamageSource)
            • Set TM1_TargetLoc = (Position of GDD_DamagedUnit)
            • Unit - Create 1 Movement slow (Tank) for TM1_OwnerPlayer at TM1_TargetLoc facing TM1_TargetLoc
            • Unit - Order (Last created unit) to Human Mountain King - Thunder Clap
            • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
            • Set TM1_AreaGroup = (Units within 300.00 of TM1_TargetLoc matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an ally of TM1_OwnerPlayer) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((Race of (Matching unit)) Not
            • Trigger - Turn off (This trigger)
            • Unit Group - Pick every unit in TM1_AreaGroup and do (Actions)
              • Loop - Actions
                • Unit - Cause GDD_DamageSource to damage (Picked unit), dealing 20.00 damage of attack type Hero and damage type Normal
            • Trigger - Turn on (This trigger)
            • Custom script: call DestroyGroup(udg_TM1_AreaGroup)
            • Custom script: call RemoveLocation(udg_TM1_CasterLoc)
            • Custom script: call RemoveLocation(udg_TM1_TargetLoc)
            • Custom script: endif
    • Else - Actions
 
Level 6
Joined
Oct 4, 2011
Messages
226
Well this still doesn't work when I test it as is so I think you are mistaken. Also lol I would think this is doable but I am starting to move on with this idea and forget about it.
 
it will work dude...
  • Untitled Trigger 001
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
    • Actions
      • Custom script: if GetUnitCurrentOrder(udg_GDD_DamageSource)==851983 then
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Critical Strike for GDD_DamageSource) Greater than 0
        • Then - Actions
          • Game - Display to (All players) the text: (Name of GDD_DamageSource)
        • Else - Actions
      • Custom script: endif
BUG: This will not work if auto-engage attack so you have to make it order to attack, like...
  • Untitled Trigger 002
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Custom script: local unit u = GetAttacker()
      • Custom script: local integer order = GetUnitCurrentOrder(u)
      • Custom script: if order==null or order==0 then
      • Custom script: call IssuePointOrderById(u, 851983, GetUnitX(u), GetUnitY(u))
      • Custom script: endif
      • Custom script: set u = null
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
I tested your map with exactly the same trigger and the Tank deals the 40+20 damage, the dummy appears, claps, and slows. And works whenever the tank is attacking. You can add the condition "Current order of Triggering Unit equal to "attack"" instead of using the If/then/Else but it's the same.
 
Status
Not open for further replies.
Top