• 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 detect units inside a shape

Status
Not open for further replies.
Level 6
Joined
Feb 5, 2012
Messages
1,685
For example i have an ability that will create a square shape using lightning.,.. now how i can damage enemies inside the square and how to detect them

For example i have an ability that will create a triangle shape using lightning.,.. now how i can damage enemies inside the triangle and how to detect them


For example i have an ability that will create a irregular shape using lightning.,.. now how i can damage enemies inside the irregular shape and how to detect them

Cause Unit - Group uses Circle
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
About Square ... CLEAN LEAKS AFTER!
  • Actions
    • Set TempPoint_Caster = (Position of TempCaster)
    • Region - Center PlayerSquare <gen> on TempPoint_Caster
    • Set TempGroup = (Units in PlayerSquare <gen>)
    • Unit Group - Pick every unit in TempGroup and do (Actions)
      • Loop - Actions
About Triangle ... Can this be done? Maybe checking if 3 angles around player contain unit . Same thing about Irregular region :/
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Find the logic between the Distance and the Angle from the center of the figure to the sides and corner of it (just poligons)

1- Place a Square inside a Circle.

2- You'll have the square sides on angles 0°, 90°, 180°, and 270° and the Square Corners on Angles 45°, 135°, 225°, and 315°. The distance between the center and the sides is the "hick" (cateto in Spanish) and the distance between the center and the corners is the hypotenuse.

3- Now you can see that the distacen between the center of the square and the sides/corners increase from 0° to 45°, and decrease from 45° to 90°, increase from 90° to 135°, and decrease from 135° to 225°, increase from 225° to 270°, and decrease from 270° to 315°, increase from 315° to 405° (The initial 45° again)

4- If the AoE of the Square is 500, Hicks will be AoE/2 = 250. The Hick^2 = 250*250 = 62500. The sum of both will be 125000. The Hypotenuse will be the SquareRoot of that value = 353.
JASS:
local real AoE = 500
local real Radio = AoE/2
local real Hick = Radio*Radio
local real Hypo = SquareRoot(Hick*2)

5- Now the AoE of the Unit Pick is 603 (Hypo + Hick) AoE. Inside it you'll check the

6- Now you have 353 distance in the corners, and 250 in the mid of the sides. You also have the Angles of the Corners and Mid of the Sides. Next step is finding the relation between these, which I don't know :)

Once you find that relation you can make from Trinagles to X number of sides figure. The process is the same once you know how the variables are related. Now, for custom forms it's a bit harder. I'm not sure how to :/

Anyway this was just me thinking without deep knowledge of math and stuff. Check this link: http://www.wc3c.net/showthread.php?t=96543
 
Last edited:
Status
Not open for further replies.
Top