wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > Code Resources > Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 07-10-2008, 11:13 PM   #1
Ammorth
I blink, therefore I am.
 
Ammorth's Avatar
 
Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)

Default LineSegments

Line Segments

Collapse JASS:
// ==================================================================================
// LineSegment - by Ammorth, Feb 13, 2010 - rev5
// 
// This script, and myself, can be found at wc3c.net
//
// Used to determine certain things about segments, involving units and geometry.
//
// Requirements:
//   - vJass
//   - optional: xebasic - by Vexorian ( [url]http://www.wc3c.net/showthread.php?t=101150[/url] )
//     will use XE_MAX_COLLISION_SIZE if xebasic is present, otherwise it will ignore it.
//
// Installation:
//   - Create a new trigger called LineSegments and convert it to custom text
//   - Copy the code to the new trigger, replacing everything
//
// How To Use:
//   - call GetNearestPointOnSegment(Ax, Ay, Bx, By, Cx, Cy) to get the nearest point on
//     the line segment AB to point C (returns a location)
//   - call GetDistanceFromSegment(Ax, Ay, Bx, By, Cx, Cy) to get the distance from the
//     line segment AB to a given point C
//   - call GroupEnumUnitsInRangeOfSegment(whichgroup, Ax, Ay, Bx, By, distance, filter) to
//     add all of the units within distance of segment AB to whichgroup, according to the filter.
//   - call IsUnitInRangeOfSegment(unit, Ax, Ay, Bx, By, distance) to see if the unit givin is
//     within distance of segment AB
//   - xebasic is no longer required, but if avaliable, will return correct results with
//     GroupEnumUnitsInRangeOfSegment() using XE_MAX_COLLISION_SIZE.
//
// Notes:
//   - All functions have a location version wrappers incase you would rather pass locations
//     They are named as follows:
//         > GetNearestPointOnSegmentLoc()
//         > GetDistanceFromSegmentLoc()
//         > GroupEnumUnitsInRangeOfSegmentLoc()
//         > IsUnitInRangeOfSegmentLoc()
//
// ==================================================================================
library LineSegment requires optional xebasic
globals
    private group udg_LineTempGroup = CreateGroup()
endglobals

// with optionals we can add/improve features if other libraries are present
// this should in-line with an optimizer, since the static if makes it constant
private constant function xebasic_wrapper takes nothing returns real
    static if LIBRARY_xebasic then
        return XE_MAX_COLLISION_SIZE
    else
        return 0.0
    endif
endfunction

function GetNearestPointOnSegment takes real Ax, real Ay, real Bx, real By, real Cx, real Cy returns location
    local real r
    // could use a point struct here if you really wanted, instead of a location.
    local real dx = Bx-Ax
    local real dy = By-Ay
    local real L = ((dx)*(dx) + (dy)*(dy)) // Get quasi length
    if L == 0 then // seg is actually a point so lets return the point
        return Location(Ax, Ay)
    endif
    set r = ((Cx-Ax)*(dx) + (Cy-Ay)*(dy))/(L) // get the ratio
    if r > 1 then // closests point is past seg, so return end point B
        return Location(Bx, By)
    elseif r < 0 then // same as B, but at A instead
        return Location(Ax, Ay)
    endif // In the middle of A and B so use the ratio to find the point
    return Location(Ax+r*(dx), Ay+r*(dy))
endfunction
function GetNearestPointOnSegmentLoc takes location A, location B, location C returns location
    return GetNearestPointOnSegment(GetLocationX(A), GetLocationY(A), GetLocationX(B), GetLocationY(B), GetLocationX(C), GetLocationY(C))
endfunction


function GetDistanceFromSegment takes real Ax, real Ay, real Bx, real By, real Cx, real Cy returns real
    local real r
    local real dx = Bx-Ax
    local real dy = By-Ay
    local real L = ((dx)*(dx) + (dy)*(dy)) // Get quasi length
    if L == 0 then // seg is actually a point so lets return the distance to the point
        return SquareRoot((Cx-Ax)*(Cx-Ax)+(Cy-Ay)*(Cy-Ay))
    endif
    set r = ((Cx-Ax)*(dx) + (Cy-Ay)*(dy))/(L) // get the ratio
    if r > 1 then // closests point is past seg, so return distance to point B
        return SquareRoot((Cx-Bx)*(Cx-Bx)+(Cy-By)*(Cy-By))
    elseif r < 0 then // same as B, but at A instead
        return SquareRoot((Cx-Ax)*(Cx-Ax)+(Cy-Ay)*(Cy-Ay))
    endif // In the middle of A and B so use the ratio to find the point
    set Ax = Ax+r*(dx)
    set Ay = Ay+r*(dy)
    return SquareRoot((Cx-Ax)*(Cx-Ax)+(Cy-Ay)*(Cy-Ay))
endfunction
function GetDistanceFromSegmentLoc takes location A, location B, location C returns real
    return GetDistanceFromSegment(GetLocationX(A), GetLocationY(A), GetLocationX(B), GetLocationY(B), GetLocationX(C), GetLocationY(C))
endfunction

function GroupEnumUnitsInRangeOfSegment takes group whichgroup, real Ax, real Ay, real Bx, real By, real distance, boolexpr filter returns nothing
    local real dx = Bx-Ax
    local real dy = By-Ay
    local real L = ((dx)*(dx) + (dy)*(dy)) // Get quasi length
    local real r = SquareRoot(dx*dx+dy*dy)/2+distance + xebasic_wrapper() // double-purpose for r
    local unit u
    call GroupClear(udg_LineTempGroup)
    call GroupEnumUnitsInRange(udg_LineTempGroup, Ax+(dx/2), Ay+(dy/2), r, filter)
    loop
        set u = FirstOfGroup(udg_LineTempGroup)
        exitwhen u == null
        if L == 0 and IsUnitInRangeXY(u, Ax, Ay, distance) then // seg is actually a point so lets return the point
            call GroupAddUnit(whichgroup, u)
        else
            set r = ((GetUnitX(u)-Ax)*(dx) + (GetUnitY(u)-Ay)*(dy))/(L) // get the ratio
            if r > 1 then // split if/thens so that it exists properly
                if IsUnitInRangeXY(u, Bx, By, distance) then // closests point is past seg, so return end point B
                    call GroupAddUnit(whichgroup, u)
                endif
            elseif r < 0 then
                if IsUnitInRangeXY(u, Ax, Ay, distance) then // same as B, but at A instead
                    call GroupAddUnit(whichgroup, u)
                endif
            elseif IsUnitInRangeXY(u, Ax+r*(dx), Ay+r*(dy), distance) then // In the middle of A and B so use the ratio to find the point
                call GroupAddUnit(whichgroup, u)
            endif
        endif
        call GroupRemoveUnit(udg_LineTempGroup, u)
    endloop
    set u = null    
endfunction
function GroupEnumUnitsInRangeOfSegmentLoc takes group whichgroup, location A, location B, real distance, boolexpr filter returns nothing
    call GroupEnumUnitsInRangeOfSegment(whichgroup, GetLocationX(A), GetLocationY(A), GetLocationX(B), GetLocationY(B), distance, filter)
endfunction

function IsUnitInRangeOfSegment takes unit u, real Ax, real Ay, real Bx, real By, real distance returns boolean
    local real r
    local real dx = Bx-Ax
    local real dy = By-Ay
    local real L = ((dx)*(dx) + (dy)*(dy)) // Get quasi length
    if L == 0 then // seg is actually a point so lets return the point
        return IsUnitInRangeXY(u, Ax, Ay, distance)
    endif
    set r = ((GetUnitX(u)-Ax)*(dx) + (GetUnitY(u)-Ay)*(dy))/(L) // get the ratio
    if r > 1 then // closests point is past seg, so return end point B
        return IsUnitInRangeXY(u, Bx, By, distance)
    elseif r < 0 then // same as B, but at A instead
        return IsUnitInRangeXY(u, Ax, Ay, distance)
    endif // In the middle of A and B so use the ratio to find the point
    return IsUnitInRangeXY(u, Ax+r*(dx), Ay+r*(dy), distance)
endfunction
function IsUnitInRangeOfSegmentLoc takes unit u, location A, location B, real distance returns boolean
    return IsUnitInRangeOfSegment(u, GetLocationX(A), GetLocationY(A), GetLocationX(B), GetLocationY(B), distance)
endfunction

endlibrary

If xebasic by Vexorian is present, it will use XE_MAX_COLLISION_SIZE to properly Enum units in range. Those that don't care or will not use this for units do not need to include xebasic anymore.

It is useful for line-spells as it's more accurate than the multiple GroupEnumUnitsInRange() method. Might also be faster in certain situations. Can also be used in geometric systems.

For lines, instead of segments, remove the ratio checks (r < 0 ; r > 1) and just return the final return.

Change Log


update 5:
- made xebasic an optional requirement

update 4:
- cleaned some code
- made function names follow the blizzard naming conventions
- added to the documentation at the front

update 3:
- fixed GetEnumUnitsInRangeOfSeg test radius

update 2:
- GetEnumUnitsInRangeOfSeg now takes into account the units collision size
- Added IsUnitInRangeOfSegXY and IsUnitInRangeOfSegLoc

update 1:
- Removed location leak
- Inlined GetDistanceFromSeg
- Fixed return value

__________________

Last edited by Ammorth : 02-13-2010 at 11:15 PM.
Ammorth is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 07-11-2008, 12:48 AM   #2
cohadar
master of fugue
 
cohadar's Avatar
 
Join Date: Jun 2007
Posts: 2,453

Submissions (5)

cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)

Default

I never made any line spells just because I knew code would look like this...
__________________
Omg database crash deleted my signature, as a side effect this immensely improved wc3c.
cohadar is offline   Reply With Quote
Old 07-11-2008, 01:50 AM   #3
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

Use a static group for the enum, then it would get approved.

Quote:
I never made any line spells just because I knew code would look like this...
Just have the filthy geometry in a library away from your spells' code and done. Oh, I just forgot that the only libraries we are allowed to use in spells are attachment stuff ...
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 07-11-2008, 03:37 AM   #4
Ammorth
I blink, therefore I am.
 
Ammorth's Avatar
 
Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)

Default

Quote:
Originally Posted by Vexorian
Use a static group for the enum, then it would get approved.

Done, and still kept the easy non-vJass conversion.

Quote:
Originally Posted by Vexorian
Oh, I just forgot the only libraries we are allowed to use in spells are attachment stuff...

Really? I thought you said awhile ago that OOP is the key and that incorporating a physics system into a spell is ridiculous. Either way, this can be used outside spells as well (like in my PAS system).
__________________
Ammorth is offline   Reply With Quote
Old 07-11-2008, 03:58 AM   #5
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

The scripts section is getting fat fast, I think I will have to implement the tag stuff...
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 07-11-2008, 05:37 PM   #6
darkwulfv
Alpha Male of Wc3c
 
darkwulfv's Avatar


Official Map Reviewer
 
Join Date: Mar 2006
Posts: 3,646

Submissions (6)

darkwulfv is just really nice (270)darkwulfv is just really nice (270)

Send a message via AIM to darkwulfv
Default

+rep because I actually need this (I can't believe it).

Can I just ask? (It sounds like a dumb question, but...) So if I use GroupEnumUnitsInRangeOfSeg, that will group the units along the line segment? (Within the range) So, if it were a visual, the area that would get considered for grouping would be something like

===================
=
=-----------------------
=
===================

Where "====" is the area units get grouped in, and "----" is the line segment.
__________________
The Spell Request Thread
Quote:
Originally Posted by Joe-Black-5
a dota like map but with unique stuff
(There was no map attached, and that was all the thread said.)
Spells I've Made

Darkwulfv's Lightning Grapple || Tritanis' Lazy Bolt


Last edited by darkwulfv : 07-11-2008 at 05:42 PM.
darkwulfv is offline   Reply With Quote
Old 07-11-2008, 06:40 PM   #7
Ammorth
I blink, therefore I am.
 
Ammorth's Avatar
 
Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)

Default

it would actually curve on the outside of the line:

Zoom (requires log in)
purple/blue is line seg, red is the enum area and yellow is the test area.


If you don't want to have the curves, you can add a check to see if the closest point is an endpoint. If it is, then it's part of the curve.

Collapse JASS:
function GroupEnumUnitsInRangeOfSegNoCurve takes group whichgroup, real Ax, real Ay, real Bx, real By, real distance, boolexpr filter returns nothing
    local real dx = Bx-Ax
    local real dy = By-Ay
    local real r = SquareRoot(dx*dx+dy*dy)/2+distance
    local unit u
    local location l = Location(0., 0.)
    call GroupEnumUnitsInRange(udg_LineTempGroup, Ax+(dx/2), Ay+(dy/2), r, filter)
    loop
        set u = FirstOfGroup(udg_LineTempGroup)
        exitwhen u == null
        set l = GetNearestPointOnSeg(Ax, Ay, Bx, By, GetUnitX(u), GetUnitY(u))
        set dx = GetLocationX(l)
        set dy = GetLocationY(l)
        set r = SquareRoot(dx - GetUnitX(u)) * (dx - GetUnitX(u)) + (dy - GetUnitY(u)) * (dy - GetUnitY(u)))
        if (r <= distance) and (dx != Ax and dy != Ay) and (dx != Bx and dy != By) then // check for end points so it doesn't curve
            call GroupAddUnit(whichgroup, u)
        endif
        call GroupRemoveUnit(udg_LineTempGroup, u)
    endloop
    set u = null
endfunction

If you only want one side or the other, just remove the check for that side.
Attached Images
File Type: jpg method.jpg (66.1 KB, 533 views)
__________________

Last edited by Ammorth : 07-11-2008 at 06:57 PM.
Ammorth is offline   Reply With Quote
Old 07-11-2008, 08:34 PM   #8
darkwulfv
Alpha Male of Wc3c
 
darkwulfv's Avatar


Official Map Reviewer
 
Join Date: Mar 2006
Posts: 3,646

Submissions (6)

darkwulfv is just really nice (270)darkwulfv is just really nice (270)

Send a message via AIM to darkwulfv
Default

Way cool, thanks for that. I'll update my code.

Btw, I think you should add a note about those curves, for anyone who might not know.
__________________
The Spell Request Thread
Quote:
Originally Posted by Joe-Black-5
a dota like map but with unique stuff
(There was no map attached, and that was all the thread said.)
Spells I've Made

Darkwulfv's Lightning Grapple || Tritanis' Lazy Bolt

darkwulfv is offline   Reply With Quote
Old 07-30-2008, 10:51 PM   #9
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Ok, first of all, the function GetDistanceFromSeg leaks a location. This is bad, so I'm temporarily moving this script back into submissions until this is corrected.

I don't think you should call GetNearestPointOnSeg at all from the GetDistanceFromSeg function, but inline the code instead, it not only solves the leak problem but saves you the overhead of creating and destroying locations which is a big time saver when doing stuff like GroupEnumUnitsInRangeOfSeg.

In the GetNearestPointOnSeg function, the check for L being negative is unneeded as L can't be negative the way it is calculated. Also, shouldn't the last return statement be return Location(Ax+r*(dx), Ay+r*(dy)) instead of return Location(r*(dx), r*(dy))?

A useful function that could be included in this pack would be GetNearestPointOnLine, which would be similar to GetNearestPointOnSeg, except it wouldn't look for the nearest point just on the segment between A and B but on the whole line defined by points A and B. Same goes for GetDistanceFromLine, would be a useful thing to have.
__________________
Anitarf is offline   Reply With Quote
Old 07-30-2008, 11:41 PM   #10
cohadar
master of fugue
 
cohadar's Avatar
 
Join Date: Jun 2007
Posts: 2,453

Submissions (5)

cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)

Default

You don't need temp group, you can simply remove units from starting group that are outside of segment.
(or even better make your function an EnumFilter that returns false if unit is out of segment)

call GroupEnumUnitsInRange(whichgroup, Ax+(dx/2), Ay+(dy/2), r, And(userFilter, segmentFilter))
__________________
Omg database crash deleted my signature, as a side effect this immensely improved wc3c.

Last edited by cohadar : 07-30-2008 at 11:44 PM.
cohadar is offline   Reply With Quote
Old 07-30-2008, 11:58 PM   #11
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Quote:
Originally Posted by cohadar
You don't need temp group, you can simply remove units from starting group that are outside of segment.
(or even better make your function an EnumFilter that returns false if unit is out of segment)

call GroupEnumUnitsInRange(whichgroup, Ax+(dx/2), Ay+(dy/2), r, And(userFilter, segmentFilter))
Doesn't using And like that create a new boolexpr every time it's used (unlike Condition and Filter which return the same handle if used on the same function multiple times), thus causing a memory leak?
__________________
Anitarf is offline   Reply With Quote
Old 07-31-2008, 02:28 AM   #12
Szythe
User
 
Join Date: Sep 2006
Posts: 320

Submissions (3)

Szythe has a spectacular aura about (143)

Spell Making Session 11 WinnerSmiley contest 4th and 5th place.Mapping Contest Third PlaceSpell making session 08

Default

I found that when a unit is standing right next to a segment, it often returns a value from 10,000 to 11,000 instead of how far the unit actually is from the segment.
Szythe is offline   Reply With Quote
Old 07-31-2008, 03:58 AM   #13
BlinkBoy
User
 
BlinkBoy's Avatar


Respected User
 
Join Date: Dec 2003
Posts: 835

Submissions (4)

BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)

Outstanding Tutorial

Default

can't you create a rect that covers the sgement, get the units from it, then get the units from both extremes using a range grouping, and then join the 3 groups?

Nvm, that would work only for vertical and horizontal segments.

but now that I think it, you could check if a unit is inside the Quad, there's a function somewhere around for checking that.
__________________
Tools:
NeoDex - a Gmax and 3ds Max modeling Toolset for Wc3!

Learn to animate! check out my: Basic Animation Tutorial!

Currently working at a sequel to my animation tutorial.

Last edited by BlinkBoy : 07-31-2008 at 04:00 AM.
BlinkBoy is offline   Reply With Quote
Old 07-31-2008, 04:14 AM   #14
darkwulfv
Alpha Male of Wc3c
 
darkwulfv's Avatar


Official Map Reviewer
 
Join Date: Mar 2006
Posts: 3,646

Submissions (6)

darkwulfv is just really nice (270)darkwulfv is just really nice (270)

Send a message via AIM to darkwulfv
Default

GroupEnumUnitsInQuad, by Grim001. It's over @ Wc3jass.
__________________
The Spell Request Thread
Quote:
Originally Posted by Joe-Black-5
a dota like map but with unique stuff
(There was no map attached, and that was all the thread said.)
Spells I've Made

Darkwulfv's Lightning Grapple || Tritanis' Lazy Bolt

darkwulfv is offline   Reply With Quote
Old 07-31-2008, 06:46 AM   #15
Ammorth
I blink, therefore I am.
 
Ammorth's Avatar
 
Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)

Default

Quote:
Originally Posted by Anitarf
Ok, first of all, the function GetDistanceFromSeg leaks a location. This is bad, so I'm temporarily moving this script back into submissions until this is corrected.
Fixed.

Quote:
Originally Posted by Anitarf
I don't think you should call GetNearestPointOnSeg at all from the GetDistanceFromSeg function, but inline the code instead, it not only solves the leak problem but saves you the overhead of creating and destroying locations which is a big time saver when doing stuff like GroupEnumUnitsInRangeOfSeg.
Changed.

Quote:
Originally Posted by Anitarf
In the GetNearestPointOnSeg function, the check for L being negative is unneeded as L can't be negative the way it is calculated. Also, shouldn't the last return statement be return Location(Ax+r*(dx), Ay+r*(dy)) instead of return Location(r*(dx), r*(dy))?
Never noticed the first point before (removed) and you are right, I forgot to add back the starting point (fixed).

Quote:
Originally Posted by Anitarf
A useful function that could be included in this pack would be GetNearestPointOnLine, which would be similar to GetNearestPointOnSeg, except it wouldn't look for the nearest point just on the segment between A and B but on the whole line defined by points A and B. Same goes for GetDistanceFromLine, would be a useful thing to have.
It would be, but since this is for line segments, I don't feel it would fit. Its simple to do though, just remove the boundary checks (the ratio) and you get a line.

Quote:
Originally Posted by cohadar
You don't need temp group, you can simply remove units from starting group that are outside of segment.
(or even better make your function an EnumFilter that returns false if unit is out of segment)
I believe EnumUnitsIin only adds units to the group, and not remove them. This also prevents the Condition leak (as stated by Anitarf).

Quote:
Originally Posted by Szythe
I found that when a unit is standing right next to a segment, it often returns a value from 10,000 to 11,000 instead of how far the unit actually is from the segment.
This was because the return was messed up. It is fixed now.
__________________
Ammorth is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 05:59 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services