HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Enum units in a cone

03-07-2010, 08:53 PM#1
Kueken
Hey

I worked on simulating Blizzard's cone spells (like carrion swarm) exactly. I created a kind of GroupEnumUnitInCone function, which enums units in a cone shape, just like the hard-coded spells.
Usage would be something like this
Collapse JASS:
    call GroupEnumUnitsInCone(ENUM_GROUP,startx,starty,startarea,endx,endy,endarea,filter)
I could change endx and endy syntax to angle and range easily, too.

Since this is not that easily achieved for a triggered shockwave or something (at least not exactly, I wanted to make this working as close as possible to hard-coded cone spells. Well maybe there is a much easier solution to get the exact hardcoded cone behavior and I am just overcomplicating things, dunno ;)).
However, I thought this might be useful for someone.

So my question is now: Should I try and submit a script with this? Or not worth the effort? Or maybe something similar already exists and I did not find it.

In case, someone is interested, this is the code until now (not perfect for sure, but I appreciate suggestions of any kind).

Expand Zinc:

The struct is not needed desparately, but I think it is cleaner to submit the struct per global than use single globals for every data needed. I can change that, though.


This thread is mainly to receive feedback, if this is needed and ever has a chance of approval, but improvement suggestions are appreciated as well :)

I made a simple testmap for demonstration, simulating a carrion swarm, which behaves almost exactly like the original one. If someone is interested, I can upload the map as well.
03-10-2010, 12:19 PM#2
Anitarf
As far as I know, WC3 cone spells do not affect all the units in the cone instantly, but as the spell projectile reaches them. As such, a projectile system like xecollider is a much better simulator of such spells than picking all the units in the cone instantly.
03-10-2010, 09:45 PM#3
TheKid
You could project a missile (using xe, or other methods) and increase its area of effect as it travels, so that when its at the beginning it will affect a small area and as it reaches the end of its effect the area would be significantly larger.

This would result in a "rounded" cone. I really don't know if Blizzard's "spray" spells have rounded edges or they are completely "square". I highly doubt they're completely square-edges.
03-10-2010, 10:08 PM#4
Anachron
Collapse JASS:
GroupClear(whichGroup);
Data.add(whichGroup,startx,starty,endx,endy,startwidth,endwidth,null);
You serious?
03-10-2010, 10:22 PM#5
Kueken
Quote:
Originally Posted by Anitarf
As far as I know, WC3 cone spells do not affect all the units in the cone instantly, but as the spell projectile reaches them. As such, a projectile system like xecollider is a much better simulator of such spells than picking all the units in the cone instantly.
Well, you can pick the units in multiple cones over time.
Quote:
You could project a missile (using xe, or other methods) and increase its area of effect as it travels, so that when its at the beginning it will affect a small area and as it reaches the end of its effect the area would be significantly larger.

This would result in a "rounded" cone. I really don't know if Blizzard's "spray" spells have rounded edges or they are completely "square". I highly doubt they're completely square-edges.
They have rounded edges, but so has my function. If you just increase the AoE of a xecollider however, you pick at a quite big circle at the end.
Quote:
Collapse Zinc:
GroupClear(whichGroup);
Data.add(whichGroup,startx,starty,endx,endy,startwidth,endwidth,null);
You serious?
Where is the problem? I want this to behave like Blizz' GroupEnuminRange functions, which clear the group before enuming aswell. If I leave that, it would just add new units, which could produce problems or would require you to clear the group yourself.


@ all: Like stated, I do not know, if this is needed, and the code is not perfect.

Well, I just compared with using xecollider with a dynamic collision size, and there is a small difference, but for most ppl it will be negligible, so this function is most likely unneeded at all.
03-11-2010, 05:12 PM#6
Fluff
Pick all units within X range from a point and then check to see if each of them is between the angles?
03-11-2010, 07:31 PM#7
Anitarf
Quote:
Originally Posted by Kueken
Well, you can pick the units in multiple cones over time.
If you're doing it like that, you might as well pick units in line segments as a reasonable (and faster) approximation.
03-11-2010, 11:14 PM#8
Kueken
Ye, I am sorry polluting the T/S with this. In fact, its pretty useless. Can be closed/graveyarded/deleted/left alone, what you prefer ;).
The only use for this would be an instant breath spell, for all other situations there are better solutions, as you stated. So, even in my opinion now, it is far too situational to submit it as a script.