How to make a circle w/ triggers

Status
Not open for further replies.
Level 27
Joined
Dec 3, 2018
Messages
906
How Do I chance the coordonates in the image in order to create a circle around the unit?
 

Attachments

  • Region Circle.png
    Region Circle.png
    44.9 KB · Views: 58
Do you want to find units in a circle? Affect some objects inside the circle? Just create a circle out of special effects? Static position or should it move with a target/unit? Generally you start with a for loop and "point with polar offset":
  • Set Center = (Position of (Triggering Unit))
  • Set R = 200.00
  • Set N = 15
  • Set Ang = (360.00/N)
  • Set Start = (Facing angle of (Triggering Unit))
  • For each (Integer A) from 1 to N do Actions
    • Loop - Actions
      • Set P = (Center offset by R towards Start degrees)
      • Set Start = (Start + Ang)
      • Special Effect - Create an effect at P using ...
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_P)
  • Custom script: call RemoveLocation(udg_Center)
 
There is the "units in range" function whose output you can assign to a unit group variable. This takes a point, radius, and conditional unit filter (to only get non-structure units, for example) and then gives you the group full of the units inside. Then you use the "unit group - pick" action and do things to all the units.

It doesn't fully take collision into account and only gets units whose center coordinates are within the circle (so a big unit just outside whose model overlaps the circle wouldn't be counterd). If you want to be 'better' but not 'accurate' you can add 'whatever approximately half of the average collision size of all units on your map is' to the search radius. Or use +32 as a best guess instead.
 
Last edited:
Rects can only be square in Warcraft III. Regions can only consist of cells.

What you probably want to do is enumerate units around the immolation caster and then filter if they are in area of effect range. This is done by enumerating the units in the area of effect range plus the maximum collision radius and then using the is unit in range function to filter if they are in the area of effect range. Enumerating units in range of a point only factors in origin position and not collision radius, as such is unit in range is required to accurately emulate area of effect damage. Other filters are required as well, such as to filter out the caster so they do not damage themself.
 
Status
Not open for further replies.
Back
Top