• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

AoE polymorph

Status
Not open for further replies.
Level 7
Joined
May 11, 2010
Messages
278
Gaaaaaaaaaah. Why did i start making a Polymorph ability with an AoE effect?

K, i tried to do it in my own, but as i happen to be incompetent i'll ask for help.
My Polymorph AoE is based on Rain of Fire, i just want it as a triggerer (?) for the effects.
The image: this is what i was at when giving up. can i make anything out of it or should i just start over? :p
I want all targeted units to be affected, and i just can't get that to work lol.
 

Attachments

  • tillfällig sak igen.jpg
    tillfällig sak igen.jpg
    62.3 KB · Views: 119
Level 10
Joined
Mar 16, 2009
Messages
354
AoE Polymorph Ability


Trigger #1
Un123titled.png

Dummy = invulnerable unit with no model.
Poly(loop) = polymorph ability with no mana cost
AoE Poly = Rain of fire based ability that doesn't do anything but cast onto the targets
*remove the "Art - Target" from the "Rain of Fire" buff

Trigger #2
Un42titled.png


Untit45led.png


If confusing map is attached.
Not MUI/MPI
 

Attachments

  • AoE Poly.w3x
    18.9 KB · Views: 78
Level 37
Joined
Mar 6, 2006
Messages
9,240
XPQJ had some effort put in it, but there were some issues like leaks, the dummy replacing a footman and target filtering. The other trigger is unnecessary.

I improved it a bit:


  • Poly Int
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to AoE Poly
    • Actions
      • Set Temp_Point = (Target point of ability being cast)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 350.00 of Temp_Point matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Triggering player)) Equal to True) and (((Matching unit) is Magic Imm and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy for Neutral Passive at Temp_Point facing Default building facing degrees
          • Unit - Add Poly (loop) to (Last created unit)
          • Unit - Order (Last created unit) to Human Sorceress - Polymorph (Picked unit)
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation (udg_Temp_Point)


It filters dead units, structures, allies and neutrals and magic immunes.

http://www.hiveworkshop.com/forums/pastebin.php?id=6nlovs
 
Last edited:
Level 16
Joined
May 1, 2008
Messages
1,605
I improved it a bit:


  • Poly Int
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to AoE Poly
    • Actions
      • Set Temp_Point = (Target point of ability being cast)
      • Set Poly_Units = (Units within 350.00 of Temp_Point matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 350.00 of Temp_Point matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Triggering player)) Equal to True) and (((Matching unit) is Magic Imm and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy for Neutral Passive at Temp_Point facing Default building facing degrees
          • Unit - Add Poly (loop) to (Last created unit)
          • Unit - Order (Last created unit) to Human Sorceress - Polymorph (Picked unit)
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation (udg_Temp_Point)

But then you don't need Poly_Units anymore and wasn't you the one who told me for longer time, that it isn't good to filter magic immune units?
 
Level 5
Joined
Sep 1, 2022
Messages
86
I need such an ability, maybe someone could make it for me

Name=Polymorph
Tip=Polymorph,level 1,Polymorph, level 2,Polymorph, level 3,Polymorph, level 4
Ubertip=The Sorceress acquires a 20% chance when when pronouncing spells, turn the enemy into a helpless sheep for 1.5 seconds.passive ability ,The sorceress acquires a 25% chance when pronouncing spells to turn an enemy into a helpless sheep for 2 seconds.passive ability ,The sorceress acquires a 30% chance when pronouncing spells to turn an enemy into a helpless sheep for 2.5 seconds.passive ability ,The sorceress acquires a 35% chance when pronouncing spells to turn an enemy into a helpless sheep for 3 seconds.
Researchtip=Polymorph level %
Researchhotkey="E"
Researchubertip="The sorceress gets a chance to turn the enemy into a helpless sheep when pronouncing spells. level - 20% chance and
 
Level 28
Joined
Feb 18, 2014
Messages
3,579
I need such an ability, maybe someone could make it for me

Name=Polymorph
Tip=Polymorph,level 1,Polymorph, level 2,Polymorph, level 3,Polymorph, level 4
Ubertip=The Sorceress acquires a 20% chance when when pronouncing spells, turn the enemy into a helpless sheep for 1.5 seconds.passive ability ,The sorceress acquires a 25% chance when pronouncing spells to turn an enemy into a helpless sheep for 2 seconds.passive ability ,The sorceress acquires a 30% chance when pronouncing spells to turn an enemy into a helpless sheep for 2.5 seconds.passive ability ,The sorceress acquires a 35% chance when pronouncing spells to turn an enemy into a helpless sheep for 3 seconds.
Researchtip=Polymorph level %
Researchhotkey="E"
Researchubertip="The sorceress gets a chance to turn the enemy into a helpless sheep when pronouncing spells. level - 20% chance and
What do you mean by "pronouncing spells"? I suppose you want the Sorceress to gain a chance to turn a unit into a sheep when casting spells. If that's the case then do this:
  • Passive Polymorph
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Slow
          • (Ability being cast) Equal to Invisibility
          • etc...
    • Actions
      • Set TempPoint = (Target point of ability being cast)
      • Set ChanceReal = (0.15 + (0.05 x (Real((Level of (Ability being cast) for (Triggering unit))))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 0.00 and 1.00) Less than or equal to ChanceReal
        • Then - Actions
          • Unit - Create 1 Hydromancer for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
          • Unit - Add Polymorph (Neutral Hostile) to (Last created unit)
          • Unit - Set level of Polymorph (Neutral Hostile) for (Last created unit) to (Level of (Ability being cast) for (Triggering unit))
          • Unit - Order (Last created unit) to Human Sorceress - Polymorph (Target unit of ability being cast)
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
        • Else - Actions
      • Custom script: call RemoveLocation (udg_TempPoint)
 

Attachments

  • PassivePolymorph.w3x
    18.4 KB · Views: 17
Level 5
Joined
Sep 1, 2022
Messages
86
No, I meant that a passive ability is taken as a basis, for example, the aura of a paladin and during an attack there is a chance, depending on the level, to turn a unit into a sheep
I suppose the beginning will look like this.

2022-09-05_215604.jpg


What do you mean by "pronouncing spells"? I suppose you want the Sorceress to gain a chance to turn a unit into a sheep when casting spells. If that's the case then do this:
  • Passive Polymorph
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Slow
          • (Ability being cast) Equal to Invisibility
          • etc...
    • Actions
      • Set TempPoint = (Target point of ability being cast)
      • Set ChanceReal = (0.15 + (0.05 x (Real((Level of (Ability being cast) for (Triggering unit))))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 0.00 and 1.00) Less than or equal to ChanceReal
        • Then - Actions
          • Unit - Create 1 Hydromancer for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
          • Unit - Add Polymorph (Neutral Hostile) to (Last created unit)
          • Unit - Set level of Polymorph (Neutral Hostile) for (Last created unit) to (Level of (Ability being cast) for (Triggering unit))
          • Unit - Order (Last created unit) to Human Sorceress - Polymorph (Target unit of ability being cast)
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
        • Else - Actions
      • Custom script: call RemoveLocation (udg_TempPoint)
 
Last edited:

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,887
What the hell is up with people posting and reviving an old ass thread 1000 times? God... do people even use their brain? Do they even check the date to what they're replying to ? Seems to me a lack of self-awareness.
 
Level 28
Joined
Feb 18, 2014
Messages
3,579
What the hell is up with people posting and reviving an old ass thread 1000 times? God... do people even use their brain? Do they even check the date to what they're replying to ? Seems to me a lack of self-awareness.
I don't blame them, I blame the moderators for leaving these threads open.

Anyway...
No, I meant that a passive ability is taken as a basis, for example, the aura of a paladin and during an attack there is a chance, depending on the level, to turn a unit into a sheep
I suppose the beginning will look like this.
Like @Pyrogasm said, A unit Is Attacked is not accurate so if the Attacking unit misses, it will still count as if the Attacked unit was hit. You will better off using a DDS instead.
Also, your calculations are wrong, you are comparing a result which is higher than the random integer value. (1-100) < +150
 
Level 5
Joined
Sep 1, 2022
Messages
86
JASS:
local unit u=GetSpellAbilityUnit()
local unit t=GetSpellTargetUnit()
local integer i=GetUnitAbilityLevel(u,'A04B')
local unit d=CreateUnit(GetOwningPlayer(u),'h000',GetUnitX(u),GetUnitY(u),0)
call UnitAddAbility(d,'Aply')
call SetUnitAbilityLevel(d,'Aply',i)
call IssueTargetOrderById(d,$D006A,t)
call UnitApplyTimedLife(d,'BTLF',2)
set u=null
set t=null
set d=null
I don't blame them, I blame the moderators for leaving these threads open.

Anyway...

Like @Pyrogasm said, A unit Is Attacked is not accurate so if the Attacking unit misses, it will still count as if the Attacked unit was hit. You will better off using a DDS instead.
Also, your calculations are wrong, you are comparing a result which is higher than the random integer value. (1-100) < +150
 
Level 39
Joined
Feb 27, 2007
Messages
5,012
Yes, Mellstorm, that will dummy cast a polymorph on the unit being targeted by the spell. Warseeker was referring to this line:

(Random integer number between 1 and 100) Less than or equal to (150 + (50 x (Level of Polymorph [Jean] for (Attacking unit))))
 
Level 5
Joined
Sep 1, 2022
Messages
86
Yes, Mellstorm, that will dummy cast a polymorph on the unit being targeted by the spell. Warseeker was referring to this line:

(Random integer number between 1 and 100) Less than or equal to (150 + (50 x (Level of Polymorph [Jean] for (Attacking unit))))
The values were set so that you can make sure it works as soon as possible. The issue remained unresolved.
 
The values were set so that you can make sure it works as soon as possible. The issue remained unresolved.
..... Here
  • Poly
    • Events
      • Game - GDD_Event becomes Equal to 1.00
    • Conditions
    • Actions
      • Set RANDOM = (Random integer number between 1 and 100)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Level of ...Evasion for GDD_DamageSource) Equal to 1
              • RANDOM Less than or equal to 5
              • (GDD_DamagedUnit has buff Polymorph) Equal to False
        • Then - Actions
          • Unit - Order PolyDummy to Human Sorceress - Polymorph GDD_DamagedUnit
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Level of ...Evasion for GDD_DamageSource) Equal to 2
              • RANDOM Less than or equal to 10
              • (GDD_DamagedUnit has buff Polymorph) Equal to False
        • Then - Actions
          • Unit - Order PolyDummy to Human Sorceress - Polymorph GDD_DamagedUnit
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Level of ...Evasion for GDD_DamageSource) Equal to 3
              • RANDOM Less than or equal to 15
              • (GDD_DamagedUnit has buff Polymorph) Equal to False
        • Then - Actions
          • Unit - Order PolyDummy to Human Sorceress - Polymorph GDD_DamagedUnit
        • Else - Actions
 

Attachments

  • sal2.2.w3x
    707.3 KB · Views: 13

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
@LordDracula, Some minor things I figured I'd point out for the sake of clarity.

1) You don't need this Condition:
  • And - All (Conditions) are true
All Conditions need to be true by default. "And" is only necessary if you're using "Or" and want to combine Conditions like:
If Condition A is true OR (Condition B AND Condition C) are true then...

2) The Buff check is unnecessary unless OP wants the spell to act that way but that's not really normal behavior.

Anyway, you don't necessarily need a Damage Engine if you're using up an up to date version of Warcraft 3. The spell can be simplified to this:
  • Polymorph
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Level of Polymorph Passive for (Damage source)) Greater than 0
    • Actions
      • Set VariableSet TempInt = (Level of Polymorph Passive for (Damage source))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 1.00 and 100.00) Less than or equal to (15.00 + (5.00 x (Real(TempInt))))
        • Then - Actions
          • -------- Proc chance: 20/25/30/35% --------
          • Set VariableSet TempPoint = (Position of (Damage source))
          • Unit - Create 1 Dummy for (Owner of (Damage source)) at TempPoint facing Default building facing degrees
          • Custom script: call RemoveLocation (udg_TempPoint)
          • Set VariableSet TempUnit = (Last created unit)
          • Unit - Add Polymorph to TempUnit
          • Unit - Set level of Polymorph for TempUnit to TempInt
          • Unit - Add a 0.40 second Generic expiration timer to TempUnit
          • Unit - Order TempUnit to Human Sorceress - Polymorph (Damage Target)
        • Else - Actions
A variable for the (Damage source) could be used to make it more efficient but it's not a big deal. You may also want to use unique variables here that are specific to this spell in order to prevent any chance of overwriting them.

Lastly, make sure your Dummy unit and the Polymorph ability are setup properly!
The Dummy should be based on a Locust with the following changes: Attacks Enabled: None, Movement Type: None, Speed Base: 0
Polymorph should have 99,999 Cast Range, 0 Mana Cost, no Requirements, and the correct Targets Allowed.
 
Last edited:
@LordDracula, Some minor things I figured I'd point out for the sake of clarity.

1) You don't need this Condition:
  • And - All (Conditions) are true
All Conditions need to be true by default. "And" is only necessary if you're using "Or" and want to combine Conditions like:
If Condition A is true OR (Condition B AND Condition C) are true then...

2) The Buff check is unnecessary unless OP wants the spell to act that way but that's not really normal behavior.

Anyway, you don't necessarily need a Damage Engine if you're using up an up to date version of Warcraft 3. The spell can be simplified to this:
  • Polymorph
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Level of Polymorph Passive for (Damage source)) Greater than 0
    • Actions
      • Set VariableSet TempInt = (Level of Polymorph Passive for (Damage source))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 1.00 and 100.00) Less than or equal to (15.00 + (5.00 x (Real(TempInt))))
        • Then - Actions
          • -------- Proc chance: 20/25/30/35% --------
          • Set VariableSet TempPoint = (Position of (Damage source))
          • Unit - Create 1 Dummy for (Owner of (Damage source)) at TempPoint facing Default building facing degrees
          • Custom script: call RemoveLocation (udg_TempPoint)
          • Set VariableSet TempUnit = (Last created unit)
          • Unit - Add Polymorph to TempUnit
          • Unit - Set level of Polymorph for TempUnit to TempInt
          • Unit - Add a 0.40 second Generic expiration timer to TempUnit
          • Unit - Order TempUnit to Human Sorceress - Polymorph (Damage Target)
        • Else - Actions
A variable for the (Damage source) could be used to make it more efficient but it's not a big deal. You may also want to use unique variables here that are specific to this spell in order to prevent any chance of overwriting them.

Lastly, make sure your Dummy unit and the Polymorph ability are setup properly!
The Dummy should be based on a Locust with the following changes: Attacks Enabled: None, Movement Type: None, Speed Base: 0
Polymorph should have 99,999 Cast Range, 0 Mana Cost, no Requirements, and the correct Targets Allowed.
Thx ok i will not use that "And" condition. Well i put that buff condition because your hero will poly the enemy even if that unit is already poly.
Also is a problem if i use "And" like that?
 
Level 39
Joined
Feb 27, 2007
Messages
5,012
Also is a problem if i use "And" like that?
It's not a problem, it's just unnecessary. These are all equivalent:
  • If - Conditions
    • Condition A
    • Condition B
    • Condition C
  • If - Conditions
    • And - All conditions are true
      • Conditions
        • Condition A
        • Condition B
        • Condition C
  • If - Conditions
    • Condition A
    • And - All conditions are true
      • Conditions
        • Condition B
        • Condition C
 
Level 5
Joined
Sep 1, 2022
Messages
86
@LordDracula, Some minor things I figured I'd point out for the sake of clarity.

1) You don't need this Condition:
  • And - All (Conditions) are true
All Conditions need to be true by default. "And" is only necessary if you're using "Or" and want to combine Conditions like:
If Condition A is true OR (Condition B AND Condition C) are true then...

2) The Buff check is unnecessary unless OP wants the spell to act that way but that's not really normal behavior.

Anyway, you don't necessarily need a Damage Engine if you're using up an up to date version of Warcraft 3. The spell can be simplified to this:
  • Polymorph
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Level of Polymorph Passive for (Damage source)) Greater than 0
    • Actions
      • Set VariableSet TempInt = (Level of Polymorph Passive for (Damage source))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 1.00 and 100.00) Less than or equal to (15.00 + (5.00 x (Real(TempInt))))
        • Then - Actions
          • -------- Proc chance: 20/25/30/35% --------
          • Set VariableSet TempPoint = (Position of (Damage source))
          • Unit - Create 1 Dummy for (Owner of (Damage source)) at TempPoint facing Default building facing degrees
          • Custom script: call RemoveLocation (udg_TempPoint)
          • Set VariableSet TempUnit = (Last created unit)
          • Unit - Add Polymorph to TempUnit
          • Unit - Set level of Polymorph for TempUnit to TempInt
          • Unit - Add a 0.40 second Generic expiration timer to TempUnit
          • Unit - Order TempUnit to Human Sorceress - Polymorph (Damage Target)
        • Else - Actions
A variable for the (Damage source) could be used to make it more efficient but it's not a big deal. You may also want to use unique variables here that are specific to this spell in order to prevent any chance of overwriting them.

Lastly, make sure your Dummy unit and the Polymorph ability are setup properly!
The Dummy should be based on a Locust with the following changes: Attacks Enabled: None, Movement Type: None, Speed Base: 0
Polymorph should have 99,999 Cast Range, 0 Mana Cost, no Requirements, and the correct Targets Allowed.
If you hit the hero, he also turns into a sheep (
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
You never said it shouldn't target Heroes and there's no Condition in that trigger that would prevent such a thing from happening.

Think about how a trigger runs, first the Events happen -> then the Conditions happen -> then if those Conditions are met the Actions happen.

An Event is something that happens in the game. We can then respond to it with our own game logic. So an Event is what causes our Trigger to run:
  • Unit - A unit Takes damage
So this trigger is running whenever any unit takes damage. Once that happens we move on to the Conditions block.

Conditions are used to determine whether or not our Actions should occur. Questions are asked, such as which unit dealt the damage? How much damage was dealt? Did this damaging unit have a specific ability? These are all questions that can be answered with Conditions.

In this case we're checking if our (Damage source), which is the Unit that dealt the damage in the Event, has the Polymorph Passive ability:
  • (Level of Polymorph Passive for (Damage source)) Greater than 0
If that's true then we move on to the Actions. Otherwise, the trigger stops early and never reaches the Actions.

In this case our Actions use an If Then Else statement which is a way for you to ask even more questions throughout your trigger. In this case our If Then Else is generating a random number ranging from 1.00 to 100.00 and then checking if that number is <= the chance to cast Polymorph:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Random real number between 1.00 and 100.00) Less than or equal to (15.00 + (5.00 x (Real(TempInt))))
If that's true then we move on to the Then - Actions part of our If Then Else statement.

Finally, you can see in the Then - Actions part that we're running the logic for casting Polymorph on the (Damage Target), aka the Unit that took the damage.
  • Unit - Order TempUnit to Human Sorceress - Polymorph (Damage Target)
So as you can see, nowhere in this trigger are we asking any questions about the (Damage Target). For example:
Is the (Damage Target) a Hero? Is the (Damage Target) a Building? Is the (Damage Target) owned by an Ally/Enemy?

The trigger is going to do EXACTLY what you tell it to do! Or, in this case, it's going to do something that you never told it NOT to do.

Now also take into consideration the fact that we're using the Polymorph ability which has it's own Targets Allowed field inside of the Object Editor. This also determines which units the ability can target. So you're actually controlling the targets for this ability in both the Trigger AND in the Object Editor as well. With this in mind, it makes sense that Polymorph can target Heroes since nowhere on the Ability (that I made) does it say otherwise. If you look at the ability you can see that I edited the Targets Allowed to be less restrictive since I figured we'd want to handle the target filtering inside of the Trigger instead.

So the solution is simple, add more Conditions to your trigger to filter out unwanted targets:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Random real number between 1.00 and 100.00) Less than or equal to (15.00 + (5.00 x (Real(TempInt))))
      • ((Damage Target) is a Hero) Equal to False
      • ((Owner of (Damage Target) belongs to an Enemy of (Owner of (Damage Source)) Equal to True
Edit: I should also note that this trigger is never checking whether or not the Damage Event came from an Attack or Spell. If you want this to function like Critical Strike, Bash, Cleave, etc... then you'll want to add another Condition which confirms this:
  • Conditions
    • (Level of Polymorph Passive for (Damage source)) Greater than 0
    • (Damage From Normal Attack) Equal to True
Normal Attack just means it came from an Attack instead of a Spell. It has nothing to do with the Normal Damage Type.

  • Polymorph
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Level of Polymorph Passive for (Damage source)) Greater than 0
      • (Damage From Normal Attack) Equal to True
    • Actions
      • Set VariableSet TempUnit = (Damage source)
      • Set VariableSet TempTarget = (Damage Target)
      • Set VariableSet TempPlayer = (Owner of TempUnit)
      • Set VariableSet TempInt = (Level of Polymorph Passive for TempUnit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 1.00 and 100.00) Less than or equal to (15.00 + (5.00 x (Real(TempInt))))
          • (TempTarget is a Hero) Equal to False
          • ((Owner of TempTarget) belongs to an Enemy of TempPlayer) Equal to True
        • Then - Actions
          • -------- Proc chance: 20/25/30/35% --------
          • Set VariableSet TempPoint = (Position of TempUnit)
          • Unit - Create 1 Dummy for TempPlayer at TempPoint facing Default building facing degrees
          • Custom script: call RemoveLocation (udg_TempPoint)
          • Set VariableSet TempUnit = (Last created unit)
          • Unit - Add Polymorph to TempUnit
          • Unit - Set level of Polymorph for TempUnit to TempInt
          • Unit - Add a 0.40 second Generic expiration timer to TempUnit
          • Unit - Order TempUnit to Human Sorceress - Polymorph TempTarget
        • Else - Actions
I'm able to use the TempUnit variable here twice since we no longer need to reference the (Damage source) after the Dummy unit is created. Note that these Temp variables are mainly here to make the trigger run more efficiently. They aren't necessarily required. Although, I highly recommend using them when able, especially for Dummy units.
 
Last edited:
Level 5
Joined
Sep 1, 2022
Messages
86
You never said it shouldn't target Heroes and there's no Condition in that trigger that would prevent such a thing from happening.

Think about how a trigger runs, first the Events happen -> then the Conditions happen -> then if those Conditions are met the Actions happen.

An Event is something that happens in the game. We can then respond to it with our own game logic. So an Event is what causes our Trigger to run:
  • Unit - A unit Takes damage
So this trigger is running whenever any unit takes damage. Once that happens we move on to the Conditions block.

Conditions are used to determine whether or not our Actions should occur. Questions are asked, such as which unit dealt the damage? How much damage was dealt? Did this damaging unit have a specific ability? These are all questions that can be answered with Conditions.

In this case we're checking if our (Damage source), which is the Unit that dealt the damage in the Event, has the Polymorph Passive ability:
  • (Level of Polymorph Passive for (Damage source)) Greater than 0
If that's true then we move on to the Actions. Otherwise, the trigger stops early and never reaches the Actions.

In this case our Actions use an If Then Else statement which is a way for you to ask even more questions throughout your trigger. In this case our If Then Else is generating a random number ranging from 1.00 to 100.00 and then checking if that number is <= the chance to cast Polymorph:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Random real number between 1.00 and 100.00) Less than or equal to (15.00 + (5.00 x (Real(TempInt))))
If that's true then we move on to the Then - Actions part of our If Then Else statement.

Finally, you can see in the Then - Actions part that we're running the logic for casting Polymorph on the (Damage Target), aka the Unit that took the damage.
  • Unit - Order TempUnit to Human Sorceress - Polymorph (Damage Target)
So as you can see, nowhere in this trigger are we asking any questions about the (Damage Target). For example:
Is the (Damage Target) a Hero? Is the (Damage Target) a Building? Is the (Damage Target) owned by an Ally/Enemy?

The trigger is going to do EXACTLY what you tell it to do! Or, in this case, it's going to do something that you never told it NOT to do.

Now also take into consideration the fact that we're using the Polymorph ability which has it's own Targets Allowed field inside of the Object Editor. This also determines which units the ability can target. So you're actually controlling the targets for this ability in both the Trigger AND in the Object Editor as well. With this in mind, it makes sense that Polymorph can target Heroes since nowhere on the Ability (that I made) does it say otherwise. If you look at the ability you can see that I edited the Targets Allowed to be less restrictive since I figured we'd want to handle the target filtering inside of the Trigger instead.

So the solution is simple, add more Conditions to your trigger to filter out unwanted targets:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Random real number between 1.00 and 100.00) Less than or equal to (15.00 + (5.00 x (Real(TempInt))))
      • ((Damage Target) is a Hero) Equal to False
      • ((Owner of (Damage Target) belongs to an Enemy of (Owner of (Damage Source)) Equal to True
Edit: I should also note that this trigger is never checking whether or not the Damage Event came from an Attack or Spell. If you want this to function like Critical Strike, Bash, Cleave, etc... then you'll want to add another Condition which confirms this:
  • Conditions
    • (Level of Polymorph Passive for (Damage source)) Greater than 0
    • (Damage From Normal Attack) Equal to True
Normal Attack just means it came from an Attack instead of a Spell. It has nothing to do with the Normal Damage Type.

  • Polymorph
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Level of Polymorph Passive for (Damage source)) Greater than 0
      • (Damage From Normal Attack) Equal to True
    • Actions
      • Set VariableSet TempUnit = (Damage source)
      • Set VariableSet TempTarget = (Damage Target)
      • Set VariableSet TempPlayer = (Owner of TempUnit)
      • Set VariableSet TempInt = (Level of Polymorph Passive for TempUnit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 1.00 and 100.00) Less than or equal to (15.00 + (5.00 x (Real(TempInt))))
          • (TempTarget is a Hero) Equal to False
          • ((Owner of TempTarget) belongs to an Enemy of TempPlayer) Equal to True
        • Then - Actions
          • -------- Proc chance: 20/25/30/35% --------
          • Set VariableSet TempPoint = (Position of TempUnit)
          • Unit - Create 1 Dummy for TempPlayer at TempPoint facing Default building facing degrees
          • Custom script: call RemoveLocation (udg_TempPoint)
          • Set VariableSet TempUnit = (Last created unit)
          • Unit - Add Polymorph to TempUnit
          • Unit - Set level of Polymorph for TempUnit to TempInt
          • Unit - Add a 0.40 second Generic expiration timer to TempUnit
          • Unit - Order TempUnit to Human Sorceress - Polymorph TempTarget
        • Else - Actions
I'm able to use the TempUnit variable here twice since we no longer need to reference the (Damage source) after the Dummy unit is created. Note that these Temp variables are mainly here to make the trigger run more efficiently. They aren't necessarily required. Although, I highly recommend using them when able, especially for Dummy units.

Other heroes also gained the ability to turn attacking units into sheep without having the polymorph ability. However, when my hero was attacked, his transformation into a sheep really stopped.
 
Last edited:
Status
Not open for further replies.
Top