• 🏆 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!

Trigger Editor and Object Editor Range

Status
Not open for further replies.
Level 3
Joined
Dec 21, 2019
Messages
30
I was wondering, is there a difference between the range between Trigger Editor and Object Editor?

I was trying to make an ability that boosts movement speed and attack speed to nearby units, and I thought that using the Scroll of Speed as initial ability and then followed by a Unholy Frenzy Dummy ability would be fine.

However, there are units that are not affected by the Unholy Frenzy Dummy ability which seems to be outside the range. The range amount in both the ability and trigger is the same, so I was wondering if are they using different units?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,510
Pick every unit within range doesn't take into consideration unit collision. AoE abilities in the object editor do.

Size Of Units

Here's an example of what you could do using the IsUnitInRange function. This function requires the use of Custom script in GUI:
  • Cast Roar
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Roar
    • Actions
      • Set VariableSet Point = (Position of (Triggering unit))
      • Set VariableSet AoE = 500.00
      • Set VariableSet AoE_Extra = 800.00
      • Unit Group - Pick every unit in (Units within AoE_Extra of Point.) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is hidden) Equal to False
              • ((Picked unit) belongs to an ally of (Triggering player).) Equal to True
            • Then - Actions
              • Custom script: if IsUnitInRange(GetEnumUnit(), GetTriggerUnit(), udg_AoE) then
              • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Human\DispelMagic\DispelMagicTarget.mdl
              • Special Effect - Destroy (Last created special effect)
              • Custom script: endif
            • Else - Actions
      • Custom script: call RemoveLocation (udg_Point)
Roar has a 500 AoE in the Object Editor. So what I do is pick every unit within 800 range of the position of the caster (300 more than Roar) and check if that unit is a legal target (alive, allied, etc...).

If it's a legal target then I move onto the important step which is the IsUnitInRange() function. IsUnitInRange works exactly like a normal AoE ability, in that it takes unit collision into consideration.

So in my example it checks if our Picked unit ( aka GetEnumUnit() ) is within 500 range of our Caster ( GetTriggerUnit() ).

The reason AoE_Extra is needed is because the Pick every unit within range function DOESN'T take into consideration unit collision, so I needed a larger AoE to compensate for this. I made it 300 AoE larger because I assume no unit in the game has more than 300 collision size.
 

Attachments

  • AoE Example.w3m
    17.1 KB · Views: 31
Last edited:
Level 3
Joined
Dec 21, 2019
Messages
30
Pick every unit within range doesn't take into consideration unit collision. AoE abilities in the object editor do.

Size Of Units

Here's an example of what you could do using the IsUnitInRange function. This function requires the use of Custom script in GUI:
  • Cast Roar
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Roar
    • Actions
      • Set VariableSet Point = (Position of (Triggering unit))
      • Set VariableSet AoE = 500.00
      • Set VariableSet AoE_Extra = 800.00
      • Unit Group - Pick every unit in (Units within AoE_Extra of Point.) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is hidden) Equal to False
              • ((Picked unit) belongs to an ally of (Triggering player).) Equal to True
            • Then - Actions
              • Custom script: if IsUnitInRange(GetEnumUnit(), GetTriggerUnit(), udg_AoE) then
              • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Human\DispelMagic\DispelMagicTarget.mdl
              • Special Effect - Destroy (Last created special effect)
              • Custom script: endif
            • Else - Actions
      • Custom script: call RemoveLocation (udg_Point)
Roar has a 500 AoE in the Object Editor. So what I do is pick every unit within 800 range of the position of the caster (300 more than Roar) and check if that unit is a legal target (alive, allied, etc...).

If it's a legal target then I move onto the important step which is the IsUnitInRange() function. IsUnitInRange works exactly like a normal AoE ability, in that it takes unit collision into consideration.

So in my example it checks if our Picked unit ( aka GetEnumUnit() ) is within 500 range of our Caster ( GetTriggerUnit() ).

The reason AoE_Extra is needed is because the Pick every unit within range function DOESN'T take into consideration unit collision, so I needed a larger AoE to compensate for this. I made it 300 AoE larger because I assume no unit in the game has more than 300 collision size.

I understand most of the parts except for this script. (Sorry, I'm new to triggers)
Custom script: if IsUnitInRange(GetEnumUnit(), GetTriggerUnit(), udg_AoE) then

Furthermore, My map is simply an altered melee game, and there are no units who has a collision size of more than 48. Except for the vanilla races, custom units (except dummy who has 0 collision size) uses Footman, Rifleman, Knight, and Paladin collision sizes
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,510
GetEnumUnit() = Picked Unit
GetTriggerUnit() = Triggering unit (the caster)

That custom script is an If Then Else statement. It says: "If the picked unit is within 500 range of the triggering unit (caster)", and if it is then any Actions that you put between that line and "endif" will happen.

I created a Special Effect on the picked unit as an example. In your case you'd want your Dummy to cast a spell on the picked unit instead.

And you can set AoE_Extra to be whatever size it needs to be. It just needs to be AT LEAST the spell's AoE + the maximum collision size in your map. As long as it isn't too small it will work. The only downside of making it "too large" is performance, which is rather negligible (unless you mistakenly make AoE_Extra pick every unit in the entire map or something).
 
Last edited:
Status
Not open for further replies.
Top