• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Solved] Help! Redeclared Functions

Status
Not open for further replies.
Level 7
Joined
Sep 2, 2011
Messages
349
I want to import both these spells but they use the same function.
Here it is.

Storm Spiral
JASS:
    function GetNearestUnit takes real locx, real locy, real radius, boolexpr unitfilter returns unit
        local unit p
        local unit p2
        local real discurrent = 0.
        local real dist = 0.
        call GroupEnumUnitsInArea(Enumer,locx,locy,radius,unitfilter)
        set bj_lastCreatedUnit = null
        set discurrent = radius
        loop
            set p = FirstOfGroup(Enumer)
            exitwhen p == null
            call GroupRemoveUnit(Enumer,p)
            set dist = DistanceXY( locx, locy, GetUnitX(p), GetUnitY(p) )
            if dist < discurrent then
                set discurrent = dist
                set bj_lastCreatedUnit = p
            endif
            set p = null
        endloop
        
        call GroupRefresh( Enumer )
        
        return bj_lastCreatedUnit
    endfunction

Flesh Eating Plant

JASS:
function GetNearestUnit takes location attach , location loc , location loc2, real radius , unit attachunit returns unit
    local unit ret = null
    local real x1 = GetLocationX(loc)
    local real x2 = 0.00
    local real x3 = GetLocationX(loc2)
    local real y1 = GetLocationY(loc)
    local real y2 = 0.00
    local real y3 = GetLocationY(loc2)
    local unit a = null
    local unit b = null
    local real MinD = radius
    local real D = 0.00
    local real r = 0.00
    call GroupEnumUnitsInRangeOfLoc(g, loc, radius, filter)
    loop
    set a = FirstOfGroup(g)
    exitwhen a==null
    call GroupRemoveUnit(g,a)
        set r = SquareRoot((GetLocationX(attach)-GetUnitX(a))*(GetLocationX(attach)-GetUnitX(a))+(GetLocationY(attach)-GetUnitY(a))*(GetLocationY(attach)-GetUnitY(a)))
        set x2 = GetUnitX(a)
        set y2 = GetUnitY(a)
        set D = SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))
        if r >= (TendrilLength * TendrilDefaultPosition) and (D < MinD) and (SquareRoot((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3)) < TendrilLength ) and not(IsUnitInGroup(a,PulledUnits)) and GrapCondition(a,attachunit) == true then
           set MinD = D
           set b = a
        endif
    endloop
    call GroupClear(g)
    set a = null
    return b
endfunction

Deleting one of them will cause so many damn errors. I want them both in my map, but is it possible?
 
OMG. All of this time, this is the only solution to that problem? My god. Thanks! :D

Mark this thread, solved.
 
Status
Not open for further replies.
Back
Top