Creating rect in front of unit

bowser499

Member
Reaction score
1
See the image.
0howtodo.jpg
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Note this works only if it's facing exactly 0, 90, 180 or 270 degrees, because you can't make a rectangular region diagonally. Let's say you want a region 200 distance towards the North of the unit, and the region size being 600 x 400. Simply set a point, which is the position of the unit offset by 600 towards 90 degrees. And create a region centered at the point set with length 600 and breadth 400.
 

bowser499

Member
Reaction score
1
I just want to put all enemies in front of unit in a group. Unit can face diagonally... =(
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Then you can't use regions. You'll need to pick units in range of the unit, and then change the facing angle. Let's say facing angle of unit is 200. Just set the angle from the unit to the picked unit and check if the angle is +50 -50.
 

Sajin

User title under construction.
Reaction score
56
like a region? or a visual thing?
I think for sure you'll need

Unit_Position - Point
x_Rect = Real
y_Rect = Real
y_RectOFFSET = Real
RECT = Region

Where
x_Rect is the width of the rectangle
y_Rect is the Height of the rectangle
y_RectOFFSET is y_Rect / 2
and RECT is your final region

and the trigger would be something like
(im excluding events / conditions)
Code:
Actions - 
   set Unit_Position = Position of Triggering Unit
   set x_Rect = 600
   set y_Rect = 300
   set y_RectOFFSET = y_Rect / 2
   Create Region at Unit_Position with size (x_Rect, y_Rect) offset by y_RectOFFSET towards Facing of Triggering Unit
   set Rect = Last Created Region


EDIT for unit group why not...
add UNIT_Group = Unitgroup variable

Code:
Actions - 
   set Unit_Position = Position of Triggering Unit
   set x_Rect = 600
   set y_Rect = 300
   set y_RectOFFSET = y_Rect / 2
   Create Region at Unit_Position with size (x_Rect, y_Rect) offset by y_RectOFFSET towards Facing of Triggering Unit
   set Rect = Last Created Region
   Pick all units in RECT and
        Actions:
            Add Picked Unit to UNIT_Group
            //
            // Do your actions and what not
            //
   call RemoveLocation (udg_Unit_Position)
   call DestroyGroup (udg_UNIT_Group)
   // the code to destroy regions?



Edit again: to Sky
you might be able to use them

you would just have to offset the region and it would look like this
Code:
SW------------S-----------SE
---------------------------
---------------------------
W--------------------------E
---------------------------
---------------------------
NW------------N------------NE


where the directions(SE, NW, Etc) is the facing angle of the unit
you would just need different offset values and a formula to calculate it
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
You can't create diagonal regions as far as I know...
 

Sajin

User title under construction.
Reaction score
56
Locals can only be used in jass i believe :p so if you know it go for it ;)
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
no you cant, but you can offset them to make it work i edited my post above to show

I saw it.. but... where's the O? And still I can't see how you can make a region in front of a unit diagonally, without the use of more than 1 region.
 

Sajin

User title under construction.
Reaction score
56
sorry i re re did it to show it better ^_^' but your not making a region diagonally, its still a square, its just off center from where he wants it

think of it as a coordinate plane
when the units facing north he wants the unit to be at 0,0 and the regions coordinates are (-3, 3)(-3, 0)(3, 3)(3, 0) making the square in front of him but say he faces north west. then the unit will be placed at (3, 0)
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Oh I get it. But it wouldn't be too accurate right? since it's like a diamond infront of the unit?
 

Sajin

User title under construction.
Reaction score
56
Probably not, especially not at angles other then 90, 180, etc But if hes determined to use regions then it is possible, This is one of the easier ways to detect damage to units only in front of the unit as well (i know its possible other ways but i've never bothered to try it)
 

bowser499

Member
Reaction score
1
I want to put the units in circle segment (a-45;a+45) where a is facing angle, or what angles shall I use?
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
It's up to you really, depending on how wide infront the unit you want targeted. a-180;a+180 would make something like a rectangle infront of the unit. (Actually a semicircle)
 

Sajin

User title under construction.
Reaction score
56
if you want a circle then use pick all units within range and create a dummy in front of the unit by alittle shorter then the range of the selection
for example
spell pick all enemies 500 range in front of caster

Code:
E
  unit starts effect of ability
C
  Ability = your ability
A
  Create 1 castdummy at position of caster offset by 480 towards facing angle of casting unit
  pick all units within 500 of last created unit
    cause last created unit to damage picked unit

makeing it shorter reduces the chances of creating and blind spots where the circle arches away from the casting unit
 

Sajin

User title under construction.
Reaction score
56
The absolute best you can get in GUI (easily anyhow) is something close to this
18967770.jpg


Uploaded with ImageShack.us
Keep in mind, to do it like this, first you must create a dummy unit 500 away and then pick the enemy units within 500 of it and add those to a unit group. THEN you need to also pick the units within 500 of your caster And create a new unit group with the units that are in both of the created unit groups, if there only in 1 then they get booted
 

xPass

All aboard the xPass Express!
Reaction score
26
Wait guys wait, actually you all missed one thing. Do you by chance know of an action that goes like this?

Region - Move Region

:D Never tried before, but I think it'll work...
 

bowser499

Member
Reaction score
1
I've done this with dummy (rep to Sajin) but another solution exist.
Just check angle between points < facing + 50. or > facing - 50.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top