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

Evasion and distance

Status
Not open for further replies.
Level 2
Joined
Jun 8, 2014
Messages
15
Hi guys! Is there a way where as the distance between 2 units increases, the evasion of both units, when attacking each other, increases?

E.g. A to B is about 500/1000/1500 range -- 10%/15%/20% evasion

EDIT: I mean like linear/exponential increase in evasion, not a locked increase in percentage.

Thank you!
 
Well, two ways.

Either you use Evasion ability and give it to the units via Spellbook, so that it doesn't show up (and look like it's game mechanics), then calculate the distance between the units' locations, convert that distance from real to integer and through a formula increase or decrease the level of Evasion for both units.

Otherwise, you could code the evasion effect yourself, by using a damage detection system. Once damage is received, use a formula based on their distance and generate the % chance of dodging the damage (by dodging it means that you would have to heal the damaged target for the damage dealt). However, this is a bit more complicated, since you need to distinguish the damage originating from regular attacks only and not spells or abilities.

Therefore, you could have something like LevelOfAbility = (Integer((Distance between Point1 and Point2)/500)).
 
Level 2
Joined
Jun 8, 2014
Messages
15
If 2 oncoming projectiles are attacking the unit, wouldn't method 1 not work? I mean that there is a possibility that the attacked unit was attacked by 5-6 projectiles simultaneously. Hence only method 2 is feasible in this case?

Sorry if I didn't make it clearer. Thanks for quick reply!
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
in case of ranged units with projectiles both methods are rather exploitable, because even when you check the distance with Damage Detection System, you can only check the distance of units when the damage is landed, not when you launch the missile.

This problem is however almost impossible to evade, unless you use something like predicting with Unit - A unit is Attacked or Unit - A unit Attacks unit(I dont know if this even exists) and then wait for the damage instance to land on unit and then calculate the distance stored in some hashtable for the unit when it was attacking and the unit that was attacked when the damage landed. Otherwise I could just launch a projectile and run away, maybe leap with some spell or teleport, and you would not hit anything with both methods

Detecting damage type is "easy" if you use Looking_for_help's damage detection system, and dont worry if you dont know vJass/Jass, it has GUI counterpart.
 
Level 8
Joined
Jan 8, 2013
Messages
348
soo this works but only if you trigger it. if you add the evasio per spellbook to the units you have to heck more like anything else and you have to make 100000000000000000000 evasions with every value.

if you want then i can trigger it for you. well im just doing it right now
wait me for edit this post
 
Level 12
Joined
Nov 3, 2013
Messages
989
in case of ranged units with projectiles both methods are rather exploitable, because even when you check the distance with Damage Detection System, you can only check the distance of units when the damage is landed, not when you launch the missile.

Well it should work to check the distance with "a unit is attacked" and then see if the attack was interrupted or not, if it were not then when the damage is dealt you do the evasion roll.
 
Level 8
Joined
Jan 8, 2013
Messages
348
well here we go
hope its okay for you that i made the evasion with this calculation of course you can change it if you think its to high/low
btw i hope the code is correct and works fine xD
edit: wel just testet it, it works perfect
  • Init
    • Ereignisse
      • Zeit - Elapsed game time is 1.00 seconds
    • Bedingungen
    • Aktionen
      • Set Evasion_Unitgroup = (Units in (Playable map area))
      • -------- -- --------
      • Einheitengruppe - Pick every unit in Evasion_Unitgroup and do (Actions)
        • Schleifen - Aktionen
          • -------- -- --------
          • Auslöser - Add to Damage Take <gen> the event (Einheit - (Picked unit) Nimmt Schaden)
          • -------- -- --------
      • -------- -- --------
      • Sichtbarkeit - Disable fog of war
      • Sichtbarkeit - Disable black mask
      • -------- -- --------
      • Custom script: call DestroyGroup(udg_Evasion_Unitgroup)
      • Custom script: call DestroyTrigger( GetTriggeringTrigger() )
  • Init 2
    • Ereignisse
      • Einheit - A unit enters (Playable map area)
    • Bedingungen
    • Aktionen
      • Auslöser - Add to Damage Take <gen> the event (Einheit - (Triggering unit) Nimmt Schaden)
  • Attack
    • Ereignisse
      • Einheit - A unit Wird angegriffen
    • Bedingungen
    • Aktionen
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Bedingungen
          • Index_Size_Evasion_1 Gleich 0
        • 'THEN'-Aktionen
          • -------- =+=+=+=+=+=+=+=+=+=+=+=+ --------
          • Auslöser - Turn on Damage Take <gen>
          • -------- =+=+=+=+=+=+=+=+=+=+=+=+ --------
        • 'ELSE'-Aktionen
      • -------- =+=+=+=+=+=+=+=+=+=+=+=+ --------
      • Set Index_Size_Evasion_1 = (Index_Size_Evasion_1 + 1)
      • -------- =+=+=+=+=+=+=+=+=+=+=+=+ --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Bedingungen
          • Index_Size_Evasion_1 Größer als Index_maxSize_Evasion_1
        • 'THEN'-Aktionen
          • Set Index_Evasion_1[Index_Size_Evasion_1] = Index_Size_Evasion_1
          • Set Index_maxSize_Evasion_1 = Index_Size_Evasion_1
        • 'ELSE'-Aktionen
      • -------- =+=+=+=+=+=+=+=+=+=+=+=+ --------
      • Set TempInt_Evasion_1 = Index_Evasion_1[Index_Size_Evasion_1]
      • -------- =+=+=+=+=+=+=+=+=+=+=+=+ --------
      • Set Evasion_Attacked[TempInt_Evasion_1] = (Triggering unit)
      • Set Evasion_Attacking[TempInt_Evasion_1] = (Attacking unit)
      • -------- =+=+=+=+=+=+=+=+=+=+=+=+ --------
      • Set Evasion_Point_1[TempInt_Evasion_1] = (Position of Evasion_Attacked[TempInt_Evasion_1])
      • Set Evasion_Point_2[TempInt_Evasion_1] = (Position of Evasion_Attacking[TempInt_Evasion_1])
      • Set Evasion_Distance[TempInt_Evasion_1] = (Distance between Evasion_Point_1[TempInt_Evasion_1] and Evasion_Point_2[TempInt_Evasion_1])
      • -------- =+=+=+=+=+=+=+=+=+=+=+=+ --------
      • Set Evasion_Chance[TempInt_Evasion_1] = (Evasion_Distance[TempInt_Evasion_1] / 50.00)
      • -------- =+=+=+=+=+=+=+=+=+=+=+=+ --------
      • -------- =+=+=+=+=+=+=+=+=+=+=+=+ --------
      • Custom script: call RemoveLocation(udg_Evasion_Point_1[udg_TempInt_Evasion_1])
      • Custom script: call RemoveLocation(udg_Evasion_Point_2[udg_TempInt_Evasion_1])
      • -------- =+=+=+=+=+=+=+=+=+=+=+=+ --------
  • Damage Take
    • Ereignisse
    • Bedingungen
    • Aktionen
      • For each (Integer Loop_Evasion_1) from 1 to Index_Size_Evasion_1, do (Actions)
        • Schleifen - Aktionen
          • -------- =+=+=+=+=+=+=+=+=+=+=+=+ --------
          • Set TempInt_Evasion_1 = Index_Evasion_1[Loop_Evasion_1]
          • -------- =+=+=+=+=+=+=+=+=+=+=+=+ --------
          • Set Evasion_RandomNumber[TempInt_Evasion_1] = (Random integer number between 1 and 100)
          • -------- =+=+=+=+=+=+=+=+=+=+=+=+ --------
          • -------- =+=+=+=+=+=+=+=+=+=+=+=+ --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Bedingungen
              • (Real(Evasion_RandomNumber[TempInt_Evasion_1])) Kleiner gleich Evasion_Chance[TempInt_Evasion_1]
            • 'THEN'-Aktionen
              • -------- =+=+=+=+=+=+=+=+=+=+=+=+ --------
              • Einheit - Set life of (Triggering unit) to ((Leben of (Triggering unit)) + (Damage taken))
              • -------- =+=+=+=+=+=+=+=+=+=+=+=+ --------
              • Schwebender Text - Create floating text that reads (|cffFF0000+ + Evasion!) above (Triggering unit) with Z offset 5.00, using font size 8.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
              • -------- - --------
              • Schwebender Text - Set the velocity of (Last created floating text) to 150.00 towards 85.00 degrees
              • -------- - --------
              • Schwebender Text - Change (Last created floating text): Deaktivieren permanence
              • Schwebender Text - Change the lifespan of (Last created floating text) to 1.40 seconds
              • Schwebender Text - Change the fading age of (Last created floating text) to 0.40 seconds
              • -------- - --------
            • 'ELSE'-Aktionen
              • -------- =+=+=+=+=+=+=+=+=+=+=+=+ --------
              • Set Index_Evasion_1[Loop_Evasion_1] = Index_Evasion_1[Index_Size_Evasion_1]
              • Set Index_Evasion_1[Index_Size_Evasion_1] = TempInt_Evasion_1
              • Set Index_Size_Evasion_1 = (Index_Size_Evasion_1 - 1)
              • Set Loop_Evasion_1 = (Loop_Evasion_1 - 1)
              • -------- =+=+=+=+=+=+=+=+=+=+=+=+ --------
      • -------- -- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Bedingungen
          • Index_Size_Evasion_1 Gleich 0
        • 'THEN'-Aktionen
          • Auslöser - Turn off (This trigger)
        • 'ELSE'-Aktionen
      • -------- -- --------
 

Attachments

  • Evasion.w3x
    19.1 KB · Views: 58
Level 23
Joined
Apr 16, 2012
Messages
4,041
sorry to disappoint you, but this is terrible. You want to know why?

because:

  • Unit Group - Pick every unit in Evasion_Unitgroup and do (Actions)
    • Loop - Actions
      • -------- -- --------
      • Trigger - Add to Damage Take <gen> the event (Unit - (Picked unit) Takes damage)
      • -------- -- --------
and

  • Init 2
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Trigger - Add to Damage Take <gen> the event (Unit - (Triggering unit) Takes damage)
Just never try to write this, just pick up DDS from this website and go with it. Do you think we would need such complicated systems if it was so easy to do such a thing? Obviously not
 
Level 8
Joined
Jan 8, 2013
Messages
348
hmmmm DDS... i thought it wasnt necessary here. well nevermind :D then he should use the DDS.
just send him your pro dds system, becasue i dont know which you mean he should use..
 
Level 8
Joined
Jan 8, 2013
Messages
348
When you keep adding an event to a trigger it will eventually crash the map. Only so many events can be associated with a single trigger.


realy? i didnt know that, what do you mean with crash? you mean critical error or a freeze?
 
Level 12
Joined
Nov 3, 2013
Messages
989
When you keep adding an event to a trigger it will eventually crash the map. Only so many events can be associated with a single trigger.

Actually, a bit off topic, considering that there's a function to add events to a trigger it's a bit weird that you can't remove events. I mean I think you could basically make it work like with any indexing if there was one or if you could make the function in jass.
 
i did this with 43 triggers for my spells and item effects ..... (a unit enters the map, add to the trigegr the event, trigegring unit gets damage)
i think i found my probelm of my map freeze?

can you show me the best dds atm out there? for me and Drakonaut
so Drakonaut can use it too for the trigger i made.

is it this? http://www.hiveworkshop.com/forums/...1-1-0-0-a-231846/?prev=search=dds&d=list&r=20

I have actually never used a DDS myself.
But I have heard this mentioned plenty of times:
http://www.hiveworkshop.com/forums/...earch=Damage%20detection%20system&d=list&r=20

And the one you linked yourself is supposed to be really good as well.
I don't know what the difference is though.
 
Level 12
Joined
Nov 3, 2013
Messages
989
I have actually never used a DDS myself.
But I have heard this mentioned plenty of times:
http://www.hiveworkshop.com/forums/...earch=Damage%20detection%20system&d=list&r=20

And the one you linked yourself is supposed to be really good as well.
I don't know what the difference is though.

The reason people use Weeps is because it lets you use two different DDS system, itself and the GDD. However weeps does not let you detect if the damage is from an attack, spell or trigger which the physical DDS do and that is pretty neat.
 
Status
Not open for further replies.
Top