• 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!

Nigh Elf Walls Pack

This bundle is marked as pending. It has not been reviewed by a staff member yet.

Nigh Elf Walls
2467721.jpg


Hello there guys, im posting this model as Night Elves defensive structures, i had a problem here since there's not many walls from them in WoW, neither i could find videos, and what i found out was that night elves maybe use full stone too, so i took the WC3 no ancient structures as a start and inspiration, i tried my best to make the Walls, Doors and Towers taking some Japanese inspiration, i think these ones turne out to be the best. Also im attaching a Test Map with a Lybrary, Objects, Icons, and Models already implemented so you can start your new map from there. There I also put some instructions so you can copy paste everything you need into your map carefully and precisely.

BTW you can set the Walls, Towers from the world editor. For the Doors, use each race basic dummy door unit, set 3 or 4 in line to set a door, once in game the game is going to load everything and fix them as you put them. Basically an usefull feature for those who need to put some of these buildings for campaings and so.

vJASS:
library WallSysLib initializer LibInit
    struct Door
        integer basic
        integer small
        integer smallOpened
        integer medium
        integer mediumOpened
    endstruct
    globals
        private group array GL_ugroup
        private location array GL_punto
        private integer DummyWallID
        private integer BaseDummyUpdating
        private integer BaseDummyDoor
        private group WSL_temp_group = CreateGroup()
        private Door array DoorList[99]
        private integer array WallList[99]
        private integer array TowerList[99]
        private integer MaxVar
        private integer TowersMax
        private trigger GateFinished
        private trigger GateDies
        private integer GateSpell
        private trigger WallFinished
        private trigger DummySelected
        private trigger TowerUpdated
        private trigger LibInitialization
        private trigger PreSetWalls
        private trigger PreSetGates
        private boolean debuggeractive = false
        private group tgroup1 = CreateGroup()
        private group tgroup2 = CreateGroup()
    
        private group finishedwalls = CreateGroup()
    
    endglobals
 
    private function setvariables takes nothing returns nothing
 
    /* ////////////////////////////////////////////////////////////////////////////////////////////////////
            ESTABLECIDO POR EL USUARIO
                    -------
                  SET BY USER
    //////////////////////////////////////////////////////////////////////////////////////////////////// */
 
        set MaxVar = 8  //Establece el limite max de variaciones para grupo de puertas - Establecerlo deacuerdo a cuantos grupos de puertas declaras
                        //Set the door groups variations max limit - Set following how many DoorGroups you declare
        set TowersMax = 22  //Establece el limite max de variaciones para torres - Estaclecelo deacuerdo a cuantas torres declaras
                            //Set the towers variations max liimit - Set following how many Towers you declare
        set DummyWallID = 'o000'    //Establece el ID de la Unidad Muro Dummy
                                    //Set the Dummy Wall Unit ID
        set BaseDummyUpdating = 'h000'  // Establece el ID de la Unidad Dummy transición Puertas
                                        // Set the transition Dummy Unit ID
        set GateSpell = 'A000'  //ID de la habilidad de las puertas dummy
                                //Dummy doors spell ID
        set DoorList[0] = Door.create()
    
        //Declaración Grupo de Puertas Occidente - Western Doors Group declaration
        set DoorList[1] = Door.create()
        set DoorList[1].basic = 'h001'          //Basic Dummy Door
        set DoorList[1].small = 'h005'          //Closed Door
        set DoorList[1].smallOpened = 'h004'    //Open Door
        set DoorList[1].medium = 'h009'         //Closed Large Door
        set DoorList[1].mediumOpened = 'h008'   //Open Large Door
    
        //Declaración Puertas Oriente - Eastern Doors Group declaration
        set DoorList[2] = Door.create()
        set DoorList[2].basic = 'h00A'
        set DoorList[2].small = 'h003'
        set DoorList[2].smallOpened = 'h002'
        set DoorList[2].medium = 'h007'
        set DoorList[2].mediumOpened = 'h006'
    
        //Declaración Puertas Humanas - Humans Doors Group declaration
        set DoorList[3] = Door.create()
        set DoorList[3].basic = 'h00Q'
        set DoorList[3].small = 'h00X'
        set DoorList[3].smallOpened = 'h00T'
        set DoorList[3].medium = 'h015'
        set DoorList[3].mediumOpened = 'h011'
    
        //Declaración Puertas Orcos - Orcs Doors Group declaration
        set DoorList[4] = Door.create()
        set DoorList[4].basic = 'h00R'
        set DoorList[4].small = 'h00Y'
        set DoorList[4].smallOpened = 'h00U'
        set DoorList[4].medium = 'h016'
        set DoorList[4].mediumOpened = 'h012'
    
        //Declaración Puertas Muerto Viviente - Undead Doors Group declaration
        set DoorList[5] = Door.create()
        set DoorList[5].basic = 'h019'
        set DoorList[5].small = 'h010'
        set DoorList[5].smallOpened = 'h00W'
        set DoorList[5].medium = 'h018'
        set DoorList[5].mediumOpened = 'h014'
    
        //Declaración Puertas Elfo Nocturno - NighElves Doors Group declaration
        set DoorList[6] = Door.create()
        set DoorList[6].basic = 'h00S'
        set DoorList[6].small = 'h00Z'
        set DoorList[6].smallOpened = 'h00V'
        set DoorList[6].medium = 'h017'
        set DoorList[6].mediumOpened = 'h013'
    
        //Declaración Murallas - Walls declaration
        set WallList[1] = 'h00C'    //Eastern Wall
        set WallList[2] = 'h00B'    //Western Wall
        set WallList[3] = 'h00M'    //Human Wall
        set WallList[4] = 'h00N'    //Orcish Wall
        set WallList[5] = 'h00O'    //Undead Wall
        set WallList[6] = 'h00P'    //NighElve Wall
    
    
        //Declaracion Torres - Towers declaration
        set TowerList[1] = 'h00L'
        set TowerList[2] = 'h00K'
        set TowerList[3] = 'h00J'
        set TowerList[4] = 'h00G'
        set TowerList[5] = 'h00I'
        set TowerList[6] = 'h00H'
        set TowerList[7] = 'h00F'
        set TowerList[8] = 'h00E'
        set TowerList[9] = 'h01B'
        set TowerList[10] = 'h01C'
        set TowerList[11] = 'h01D'
        set TowerList[12] = 'h01E'
        set TowerList[13] = 'h01F'
        set TowerList[14] = 'h01G'
        set TowerList[15] = 'h01H'
        set TowerList[16] = 'h01I'
        set TowerList[17] = 'h01J'
        set TowerList[18] = 'h01K'
        set TowerList[19] = 'h01L'
        set TowerList[20] = 'h01M'
        set TowerList[21] = 'h01N'
        set TowerList[22] = 'h01O'
    
        /* ////////////////////////////////////////////////////////////////////////////////////////////////////
                      FIN
                    -------
                      END
        //////////////////////////////////////////////////////////////////////////////////////////////////// */
    
    endfunction
 
    private function localdebugger takes string text returns nothing
        if debuggeractive == true then
            call BJDebugMsg(text)
        endif
    endfunction
 
    private function Detect127b takes nothing returns boolean
        local image img
        // This icon wasn't introduced until 1.28a
        set img = CreateImage("ReplaceableTextures\\WorldEditUI\\Editor-Toolbar-MapValidation.blp", 64, 64, 0, 0,0,0,64,64,0, 1)
        if (GetHandleId(img) == -1) then
            return true
        else
            return false
        endif
        call DestroyImage(img)
    endfunction
 
    private function LibUnitAlive takes unit u returns boolean
     return not IsUnitType(u, UNIT_TYPE_DEAD) and GetUnitTypeId(u) != 0
    endfunction
 
    private function CompareDoorList takes integer ui returns integer
        local integer i
        local integer n
        set i = 0
        set n = 0
        loop
            exitwhen i > MaxVar
                if DoorList[i].basic == ui then
                     set n = i
                endif
            set i = i + 1
        endloop
        return n
    endfunction
    private function CompareDoorLevel takes integer ui returns integer
        local integer i
        local integer n
        set i = 0
        set n = 0
        loop
            exitwhen i > MaxVar
                if ui == DoorList[i].small or ui == DoorList[i].smallOpened then
                     set n = 1
                endif
            set i = i + 1
        endloop
        loop
            exitwhen i > MaxVar
                if ui == DoorList[i].medium or ui == DoorList[i].mediumOpened then
                     set n = 2
                endif
            set i = i + 1
        endloop
        return n
    endfunction
    private function CompareWallList takes integer ui returns integer
        local integer i
        local integer n
        set i = 0
        set n = 0
        loop
            exitwhen i > MaxVar
                if ui == WallList[i] then
                     set n = i
                endif
            set i = i + 1
        endloop
        return n
    endfunction
    private function CompareTowerList takes integer ui returns integer
        local integer i
        local integer n
        set i = 0
        set n = 0
        loop
            exitwhen i > TowersMax
                if ui == TowerList[i] then
                     set n = i
                endif
            set i = i + 1
        endloop
        return n
    endfunction
    private function UnitIsWall2 takes unit u returns boolean
        local integer UnitTypeID
        set UnitTypeID = GetUnitTypeId(u)
        //call localdebugger("InitUnitIsWall2")
        if CompareWallList(UnitTypeID) > 0 or UnitTypeID == DummyWallID or not(CompareDoorList(UnitTypeID) == 0) or CompareTowerList(UnitTypeID) > 0 then
            //call localdebugger("WallDetected")
            return true
        else
            return false
        endif
    endfunction

    private function RemoveTags takes unit u returns nothing
        call AddUnitAnimationPropertiesBJ( false, "upgrade", u )
        call AddUnitAnimationPropertiesBJ( false, "first", u )
        call AddUnitAnimationPropertiesBJ( false, "second", u )
        call AddUnitAnimationPropertiesBJ( false, "third", u )
        call AddUnitAnimationPropertiesBJ( false, "fourth", u )
    endfunction

    private function WallDetectNeighbours2 takes player owner, real x, real y, string dir returns unit
        local real dist = 128.0 // neighbour pos
        local real sub_dist = 16.0// range of exact position to check
        local real pos_x = x
        local real pos_y = y
        local unit fog = null
        local location loc = null
        local unit w = null
    
        call localdebugger("InitWallDetectNe...2")
        // Why is wc3 coordinates so weird!!!??
        if dir == "north" then
            set pos_y = pos_y + dist
        elseif dir == "south" then
            set pos_y = pos_y - dist
        elseif dir == "east" then
            set pos_x = pos_x + dist
        elseif dir == "west" then
            set pos_x = pos_x - dist
        endif

        set loc = Location(pos_x, pos_y)
    
        call GroupClear(WSL_temp_group)
        call GroupAddGroup( GetUnitsInRangeOfLocAll(sub_dist, loc), WSL_temp_group)
        call localdebugger("WallDetectN...2 Part3")
        loop
            set fog = FirstOfGroup(WSL_temp_group)
            exitwhen fog == null or w != null

        
            //if (UnitIsWall2(fog) == true) and (GetOwningPlayer(fog) == owner) then
            //    set w = fog
            //endif
        
            if UnitIsWall2(fog) == true then
                set w = fog
            endif
        
            call GroupRemoveUnit(WSL_temp_group, fog)
        endloop
    
        call GroupClear(WSL_temp_group)
    
        // cleanup
        set fog = null
        call RemoveLocation(loc)
        // return
        return w
    endfunction


    private function WallUpdate2 takes unit u, boolean main_piece returns nothing
        local player p = GetOwningPlayer(u)
        local real x = GetUnitX(u)
        local real y = GetUnitY(u)
        local integer result = 0
        local real a = 0
        local unit k = u
    
        // Cardinal neighbours
        local unit n = WallDetectNeighbours2(p, x, y, "north")
        local unit s = WallDetectNeighbours2(p, x, y, "south")
        local unit e = WallDetectNeighbours2(p, x, y, "east")
        local unit w = WallDetectNeighbours2(p, x, y, "west")

        call localdebugger("InitWallUpdate2")

        // Early exits
        if LibUnitAlive(k) == false then
             set n = null
            set s = null
            set e = null
            set w = null
        
            return
        endif

        // Update cardinal neighbours
        if main_piece == true then
            if n != null then
                call WallUpdate2(n, false)
            endif
            if s != null then
                call WallUpdate2(s, false)
            endif
            if e != null then
                call WallUpdate2(e, false)
            endif
            if w != null then
                call WallUpdate2(w, false)
            endif
        endif

        // Detect type of piece
        call GroupClear(WSL_temp_group)
        call GroupAddUnit(WSL_temp_group, n)
        call GroupAddUnit(WSL_temp_group, s)
        call GroupAddUnit(WSL_temp_group, e)
        call GroupAddUnit(WSL_temp_group, w)

        // End piece
        if CountUnitsInGroup(WSL_temp_group) == 1 then
            call RemoveTags(u)
            call AddUnitAnimationPropertiesBJ( true, "upgrade", u )
            call AddUnitAnimationPropertiesBJ( true, "second", u )
            if n != null then
                //set result = udg_wall_register[1]
                set a = 0
            elseif w != null then
                //set result = udg_wall_register[2]
                set a = 90
            elseif e != null then
                //set result = udg_wall_register[3]
                set a = 270
            elseif s != null then
                //set result = udg_wall_register[4]
                set a = 180
            endif
        
        // T-cross
        elseif CountUnitsInGroup(WSL_temp_group) == 3 then
            call RemoveTags(u)
            call AddUnitAnimationPropertiesBJ( true, "upgrade", u )
            call AddUnitAnimationPropertiesBJ( true, "fourth", u )
            if n == null then
                //set result = udg_wall_register[5]
                set a = 0
            elseif s == null then
                //set result = udg_wall_register[6]
                set a = 180
            elseif w == null then
                //set result = udg_wall_register[7]
                set a = 90
            elseif e == null then
                //set result = udg_wall_register[8]
                set a = 270
            endif

        elseif CountUnitsInGroup(WSL_temp_group) == 4 then
            call RemoveTags(u)
            call AddUnitAnimationPropertiesBJ( true, "upgrade", u )
            call AddUnitAnimationPropertiesBJ( true, "fifth", u )
    
                //set result = udg_wall_register[8]
                set a = 270

        // Straight piece or corner piece
        elseif CountUnitsInGroup(WSL_temp_group) == 2 then
            call RemoveTags(u)
            call AddUnitAnimationPropertiesBJ( true, "upgrade", u )
            // Straight piece
            if (n == null and s == null) or (e == null and w == null) then
            call AddUnitAnimationPropertiesBJ( true, "third", u )
                if n == null then
                    //set result = udg_wall_register[9]
                    set a = 270
                elseif e == null then   
                    //set result = udg_wall_register[10]
                    set a = 0
                endif
            else
                call AddUnitAnimationPropertiesBJ( true, "first", u )
                // Corner piece
                if s != null then
                    if w != null then
                        //set result = udg_wall_register[11]
                        set a = 90
                    elseif e != null then
                        //set result = udg_wall_register[12]
                        set a = 180
                    endif
                elseif n != null then
                    if e != null then
                        //set result = udg_wall_register[13]
                        set a = 270
                    elseif w != null then
                        //set result = udg_wall_register[14]
                        set a = 0
                    endif
                endif

            endif
        else
            // Else return cross piece
            //set result = 'h000'
            call RemoveTags(u)
            set a = 0
        endif
        call GroupClear(WSL_temp_group)
    
        //call BlzSetUnitSkin( u, result )
        //call ReplaceUnitBJ( u, result, bj_UNIT_STATE_METHOD_RELATIVE )
        call SetUnitFacingTimed( u, a, 0 )
        //call SetUnitFacing( u, a )
        //cleanup
    
        set n = null
        set s = null
        set e = null
        set w = null

    endfunction
    private function DeleteGateDummies takes unit u, real dist returns nothing
        local location P = GetUnitLoc(u)
        local real x = GetLocationX(P)
        local real y = GetLocationY(P)
        local real a = GetUnitFacing(u)
        local group g = null
        local unit fog = null
    
        if (a <= 95 and a >= 85) or (a <= 275 and a >= 265) then
            call GroupAddGroup( GetUnitsInRangeOfLocAll(64, Location(x + dist, y)), g)
            call GroupAddGroup( GetUnitsInRangeOfLocAll(64, Location(x - dist, y)), g)   
        elseif (a <= 5 and a >= 355) or (a <= 185 and a >= 175) then
            call GroupAddGroup( GetUnitsInRangeOfLocAll(64, Location(x, y + dist)), g)
            call GroupAddGroup( GetUnitsInRangeOfLocAll(64, Location(x, y - dist)), g)
        endif
    
        loop
            set fog = FirstOfGroup(g)
            exitwhen fog == null
        
            if GetUnitTypeId(fog) == DummyWallID  then
                call RemoveUnit(fog)
            endif
        
        endloop
    
        call DestroyGroup(g)
    endfunction
    private function SetGateLife takes unit u returns nothing
        local unit k
    
        loop
            set k = FirstOfGroup(WSL_temp_group)
            exitwhen k == null
            call SetUnitLifePercentBJ( u, (GetUnitLifePercent(u) + GetUnitLifePercent(k))/2 )
            call GroupRemoveUnit(WSL_temp_group, k)
            call ShowUnitHide(k)
            call RemoveUnit(k)
        endloop
    endfunction

    private function MidUpdateGate takes unit u, integer ui, string s returns nothing
        local integer typeid = 'h00C'
        local integer civ
    
        set civ = CompareDoorList(ui)
        call localdebugger("IDList: " + I2S(civ))
        call localdebugger("IDFromList: " + I2S(DoorList[civ].basic))
        call localdebugger("IDUnit: " + I2S(ui))
        if s == "s" then
            set typeid = DoorList[civ].small
        else
            set typeid = DoorList[civ].medium
        endif
        
        call IssueImmediateOrderById(u, 851976)
        call SetPlayerTechMaxAllowedSwap( BaseDummyUpdating, -1, GetOwningPlayer(u))
        call IssueTrainOrderByIdBJ( u, BaseDummyUpdating )
        call SetPlayerTechMaxAllowedSwap( BaseDummyUpdating, 0, GetOwningPlayer(u))
    
        call UnitSetUpgradeProgress(u, 100)
    
        call IssueImmediateOrderById(u, 851976)
        call IssueTrainOrderByIdBJ( u, typeid )
                    
        call UnitSetUpgradeProgress(u, 100)
    
        call UnitRemoveAbility(u, 'Amov')
    
    endfunction

    private function UnitIsGate takes unit u returns boolean
        if CompareDoorList(GetUnitTypeId(u)) > 0 then
            return true
        else
            return false
        endif

    endfunction

    private function GateDetectNeighbours takes player owner, real x, real y, integer pot, string dir returns unit
        local real dist = 128.0 // neighbour pos
        local real sub_dist = 16.0// range of exact position to check
        local real pos_x = x
        local real pos_y = y
        local unit fog = null
        local location loc = null
        local unit w = null
        local string Detc = null
    
        call localdebugger("InicioGateDetectneighbours")
        // Why is wc3 coordinates so weird!!!??
        if dir == "north" then
            set pos_y = pos_y + dist * I2R(pot)
        elseif dir == "south" then
            set pos_y = pos_y - dist * I2R(pot)
        elseif dir == "east" then
            set pos_x = pos_x + dist * I2R(pot)
        elseif dir == "west" then
            set pos_x = pos_x - dist * I2R(pot)
        endif

        set loc = Location(pos_x, pos_y)


        call GroupClear(WSL_temp_group)
        call GroupAddGroup( GetUnitsInRangeOfLocAll(sub_dist, loc), WSL_temp_group)
    
        loop
            set fog = FirstOfGroup(WSL_temp_group)
            exitwhen fog == null or w != null

            if (UnitIsGate(fog) == true) and (GetOwningPlayer(fog) == owner) and IsUnitInGroup(fog, finishedwalls) then
                set w = fog
                call localdebugger(dir + I2S(pot))
            endif
        
            call GroupRemoveUnit(WSL_temp_group, fog)
        endloop
    
        call GroupClear(WSL_temp_group)
    
        // cleanup
        set fog = null
        set loc = null
    
        call RemoveLocation(loc)

        // return
        return w
    endfunction

    private function GateUpdate takes unit u, boolean main_piece returns nothing
        local player p = GetOwningPlayer(u)
        local real x = I2R(R2I(GetUnitX(u)/64)*64)
        local real y = I2R(R2I(GetUnitY(u)/64)*64)
        local integer result = 0
        local real a = 0
        local real vida = 0
        local unit k
        local unit km = u
        local boolean error = FALSE
        local integer ut = GetUnitTypeId(u)

        // Cardinal neighbours
        local unit n = GateDetectNeighbours(p, x, y, 1, "north")
        local unit s = GateDetectNeighbours(p, x, y, 1, "south")
        local unit e = GateDetectNeighbours(p, x, y, 1, "east")
        local unit w = GateDetectNeighbours(p, x, y, 1, "west")

        local unit n2 = GateDetectNeighbours(p, x, y, 2, "north")
        local unit s2 = GateDetectNeighbours(p, x, y, 2, "south")
        local unit e2 = GateDetectNeighbours(p, x, y, 2, "east")
        local unit w2 = GateDetectNeighbours(p, x, y, 2, "west")
    
        // Early exits
        call localdebugger("InicioGateUpdate")
        if n != null then
            if e != null then
                set error = TRUE
            elseif w != null then
                set error = TRUE
            endif
        elseif s != null then
            if e != null then
                set error = TRUE
            elseif w != null then
                set error = TRUE
            endif
        endif
    
        if LibUnitAlive(km) == FALSE then
        
            set error = TRUE
        
        
        endif
    
        if error == TRUE then
    
            set n = null
            set s = null
            set e = null
            set w = null
        
            set n2 = null
            set s2 = null
            set e2 = null
            set w2 = null
        
            return
        endif

        call GroupClear(WSL_temp_group)
        call GroupAddUnit(WSL_temp_group, n)
        call GroupAddUnit(WSL_temp_group, s)
        call GroupAddUnit(WSL_temp_group, e)
        call GroupAddUnit(WSL_temp_group, w)
        call GroupAddUnit(WSL_temp_group, n2)
        call GroupAddUnit(WSL_temp_group, s2)
        call GroupAddUnit(WSL_temp_group, e2)
        call GroupAddUnit(WSL_temp_group, w2)

        // End piece
        if CountUnitsInGroup(WSL_temp_group) == 3 then
            call RemoveTags(u)
            if n != null then
                if s != null then
                    if n2 != null then
                        call localdebugger("Detect: 4, Vertical N")
                    
                        call SetGateLife(u)
                    
                        //call SetUnitPosition(u, x, y + 64)
                    
                        call SetUnitX(u, x)
                        call SetUnitY(u, y + 64)
                    
                        call MidUpdateGate(u, ut, "l")
                    
                        call CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), DummyWallID, x, y + 128 + 128, 0)
                        call GroupAddUnitSimple(GetLastCreatedUnit(), finishedwalls)
                        call UnitRemoveAbility(GetLastCreatedUnit(), 'Amov')
                        call CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), DummyWallID, x, y - 128, 0)
                        call GroupAddUnitSimple(GetLastCreatedUnit(), finishedwalls)
                        call UnitRemoveAbility(GetLastCreatedUnit(), 'Amov')
                    
                    
                    
                    elseif s2 != null then
                        call localdebugger("Detect: 4, Vertical S")
                    
                        call SetGateLife(u)
                    
                        //call SetUnitPosition(u, x, y - 64)
                    
                        call SetUnitX(u, x)
                        call SetUnitY(u, y - 64)

                        call MidUpdateGate(u, ut, "l")
                    
                        call CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), DummyWallID, x, y + 128, 0)
                        call GroupAddUnitSimple(GetLastCreatedUnit(), finishedwalls)
                        call UnitRemoveAbility(GetLastCreatedUnit(), 'Amov')
                        call CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), DummyWallID, x, y - 128 - 128, 0)
                        call GroupAddUnitSimple(GetLastCreatedUnit(), finishedwalls)
                        call UnitRemoveAbility(GetLastCreatedUnit(), 'Amov')
                    
                    
                    
                    endif
                endif
            elseif w != null then
                if e != null then
                    if w2 != null then
                        call localdebugger("Detect: 4, Horizontal W")
                    
                        call SetGateLife(u)
                    
                        //call SetUnitPosition(u, x - 64, y)
                    
                        call SetUnitX(u, x - 64)
                        call SetUnitY(u, y)

                        call MidUpdateGate(u, ut, "l")
                    
                        call CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), DummyWallID, x - 256, y, 0)
                        call GroupAddUnitSimple(GetLastCreatedUnit(), finishedwalls)
                        call UnitRemoveAbility(GetLastCreatedUnit(), 'Amov')
                        call CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), DummyWallID, x + 128, y, 0)
                        call GroupAddUnitSimple(GetLastCreatedUnit(), finishedwalls)
                        call UnitRemoveAbility(GetLastCreatedUnit(), 'Amov')
                    
                    
                    elseif e2 != null then
                        call localdebugger("Detect: 4, Horizontal E")
                    
                        call SetGateLife(u)
                    
                        //call SetUnitPosition(u, x + 64, y)
                    
                        call SetUnitX(u, x + 64)
                        call SetUnitY(u, y)

                        call MidUpdateGate(u, ut, "l")
                    
                        call CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), DummyWallID, x - 128, y, 0)
                        call GroupAddUnitSimple(GetLastCreatedUnit(), finishedwalls)
                        call UnitRemoveAbility(GetLastCreatedUnit(), 'Amov')
                        call CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), DummyWallID, x + 256, y, 0)
                        call GroupAddUnitSimple(GetLastCreatedUnit(), finishedwalls)
                        call UnitRemoveAbility(GetLastCreatedUnit(), 'Amov')
                    
                    
                    endif
                endif
            endif
        // T-cross
        elseif CountUnitsInGroup(WSL_temp_group) == 2 then
            call RemoveTags(u)
            if n != null then
                if s != null then
                    call localdebugger("Detect: 3, Vertical")
                
                    call SetGateLife(u)

                    call MidUpdateGate(u, ut, "s")
                
                    call CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), DummyWallID, x, y + 128, 0)
                    call GroupAddUnitSimple(GetLastCreatedUnit(), finishedwalls)
                    call UnitRemoveAbility(GetLastCreatedUnit(), 'Amov')
                    call CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), DummyWallID, x, y - 128, 0)
                    call GroupAddUnitSimple(GetLastCreatedUnit(), finishedwalls)
                    call UnitRemoveAbility(GetLastCreatedUnit(), 'Amov')
                
                
                endif
            elseif w != null then
                if e != null then
                    call localdebugger("Detect: 3, Horizontal")
                
                    call SetGateLife(u)
                
                    call MidUpdateGate(u, ut, "s")
                
                    call CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), DummyWallID, x + 128, y, 90)
                    call GroupAddUnitSimple(GetLastCreatedUnit(), finishedwalls)
                    call UnitRemoveAbility(GetLastCreatedUnit(), 'Amov')
                    call CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), DummyWallID, x - 128, y, 90)
                    call GroupAddUnitSimple(GetLastCreatedUnit(), finishedwalls)
                    call UnitRemoveAbility(GetLastCreatedUnit(), 'Amov')
                
                
                endif
            endif
        else
            call RemoveTags(u)
            call localdebugger("Detect: No Apto")
        endif
        call GroupClear(WSL_temp_group)
        //call UnitRemoveAbility(u, 'Amov')--
        //call BlzSetUnitSkin( u, result )
        //call ReplaceUnitBJ( u, result, bj_UNIT_STATE_METHOD_RELATIVE )
        //call SetUnitFacingTimed( u, a, 0 )--
        //cleanup
    
        set n = null
        set s = null
        set e = null
        set w = null
    
        set n2 = null
        set s2 = null
        set e2 = null
        set w2 = null

    endfunction
 
    //===========================================================================
 
    private function GateFinished_Actions takes nothing returns nothing
        local unit u = GetSpellAbilityUnit()
    
        //call localdebugger("InicioGateFinished")
    
        if GetSpellAbilityId() == GateSpell then
            //call localdebugger("HabilidadDetectada")
            call GateUpdate(u, true)
        endif
    endfunction
 
    private function GateDies_Actions takes nothing returns nothing
        local integer UnitTypeID
        local unit u = GetDyingUnit()
        local integer DoorLevel
    
        //call localdebugger("InicioGateDies")
    
        set UnitTypeID = GetUnitTypeId(GetDyingUnit())
        if CompareDoorList(UnitTypeID) > 0 then
            set DoorLevel = CompareDoorLevel(UnitTypeID)
            if DoorLevel == 1 then
                call DeleteGateDummies(u, 128)
            elseif DoorLevel == 2 then
                call DeleteGateDummies(u, 192)
            endif
        endif
    endfunction
 
    private function WallFinished_Actions takes nothing returns nothing
        local unit u = GetConstructedStructure()
        //call localdebugger("Unit TypeID: " + I2S(GetUnitTypeId(u)) )
        if UnitIsWall2(u) == true then
            //call localdebugger("UnitIsWall2: true")
            call GroupAddUnitSimple(u, finishedwalls)
            call UnitRemoveAbility(u, 'Amov')
            call WallUpdate2(u, true)
        endif
    endfunction
 
    private function DummySelected_Actions takes nothing returns nothing
        local integer UnitTID = GetUnitTypeId(GetTriggerUnit())
        if UnitTID == DummyWallID then
            call SelectUnitRemoveForPlayer( GetTriggerUnit(), GetTriggerPlayer() )
        else
        endif
    endfunction
 
    private function TowerUpdated_Actions takes nothing returns nothing
        local unit u = GetTriggerUnit()
        local integer UnitTID = GetUnitTypeId(GetTriggerUnit())
        if CompareTowerList(UnitTID) > 0 then
            call UnitRemoveAbility(u, 'Amov')
            call WallUpdate2(u, true)
        endif
    endfunction
 
    private function PreSetGates_Actions takes nothing returns nothing
        local unit u = null
    
        set u = FirstOfGroup(tgroup2)
    
        if u == null then
            call DestroyGroup(tgroup2)
            call DestroyTrigger(PreSetGates)
        else
            loop
                set u = FirstOfGroup(tgroup2)
                call UnitRemoveAbility(u, 'Amov')
                call IssueImmediateOrderBJ( u, "channel")
                call GroupRemoveUnit(tgroup2, u)
            endloop
        endif
    
    endfunction
 
    private function PreSetWalls_Actions takes nothing returns nothing
        local unit u = null
    
        set u = FirstOfGroup(tgroup1)
    
        if u == null then
        
            call DestroyGroup(tgroup1)
            call DestroyTrigger(PreSetWalls)
        
            call PolledWait(1)
        
            set PreSetGates = CreateTrigger()
            call TriggerRegisterTimerEventPeriodic(PreSetGates, 0.01)
            call TriggerAddAction( PreSetGates, function PreSetGates_Actions )
    
        else
            //call ClearSelection( )
            call UnitRemoveAbility(u, 'Amov')
            // call SelectUnitAdd( u )
            call WallUpdate2(u, true)
            call GroupRemoveUnit(tgroup1, u)
            call localdebugger("Quedan: " + I2S(CountUnitsInGroup(tgroup1)))
        endif
    endfunction
 
    function LibInitialization_Actions takes nothing returns nothing
        local integer i = 0
        local integer i2 = 1
        local integer n
        local unit u = null
    
        if Detect127b() == true then
            set n = 11
            call localdebugger("Version 1.27b Detectada")
        else
            set n = 26
            call localdebugger("Version 1.28 o superior Detectada")
        endif
        loop
            exitwhen i2 > MaxVar
                call GroupAddGroup(GetUnitsOfTypeIdAll(WallList[i2]), tgroup1)
            set i2 = i2 + 1
        endloop
        call localdebugger("PrimerGrupo")
        set i2 = 1
        loop
            exitwhen i2 > TowersMax
                call GroupAddGroup(GetUnitsOfTypeIdAll(TowerList[i2]), tgroup1)
            set i2 = i2 + 1
        endloop
        call localdebugger("SegundoGrupo")
        set i2 = 1
        loop
            exitwhen i2 > MaxVar
                call GroupAddGroup(GetUnitsOfTypeIdAll(DoorList[i2].basic), tgroup2)
            set i2 = i2 + 1
        endloop
        call GroupAddGroup(tgroup2, tgroup1)
        call GroupAddGroup(tgroup1, finishedwalls)
        call localdebugger("TercerGrupo")
        call localdebugger("Unidades: " + I2S(CountUnitsInGroup(tgroup1)))
    
        set PreSetWalls = CreateTrigger()
        call TriggerRegisterTimerEventPeriodic(PreSetWalls, 0.01)
        call TriggerAddAction( PreSetWalls, function PreSetWalls_Actions )
    
        /*loop
            set u = FirstOfGroup(tgroup0)
            exitwhen u == null
            call UnitRemoveAbility(u, 'Amov')
            call GroupRemoveUnit(tgroup0, u)
            call localdebugger("Quedan: " + I2S(CountUnitsInGroup(tgroup0)))
        endloop*/   
    
        loop
            exitwhen i > n
            call SetPlayerTechMaxAllowedSwap( BaseDummyUpdating, 0, Player(i) )
            set i = i + 1
        endloop
    
    endfunction
 
    private function LibInit takes nothing returns nothing
        call setvariables()
    
        //===========================================================================
        set GateFinished = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ( GateFinished, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
        call TriggerAddAction( GateFinished, function GateFinished_Actions )
        //===========================================================================
        set GateDies = CreateTrigger(  )
        call TriggerRegisterAnyUnitEventBJ( GateDies, EVENT_PLAYER_UNIT_DEATH )
        call TriggerAddAction( GateDies, function GateDies_Actions )
        //===========================================================================
        set WallFinished = CreateTrigger(  )
        call TriggerRegisterAnyUnitEventBJ( WallFinished, EVENT_PLAYER_UNIT_CONSTRUCT_FINISH )
        call TriggerAddAction( WallFinished, function WallFinished_Actions )
        //===========================================================================
        set TowerUpdated = CreateTrigger(  )
        call TriggerRegisterAnyUnitEventBJ( TowerUpdated, EVENT_PLAYER_UNIT_UPGRADE_FINISH )
        call TriggerAddAction( TowerUpdated, function TowerUpdated_Actions )
        //===========================================================================
        set LibInitialization = CreateTrigger(  )
        call TriggerRegisterTimerEventSingle( LibInitialization, 0.50 )
        call TriggerAddAction( LibInitialization, function LibInitialization_Actions )
        //===========================================================================
        set DummySelected = CreateTrigger(  )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(0), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(1), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(2), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(3), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(4), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(5), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(6), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(7), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(8), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(9), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(10), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(11), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(12), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(13), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(14), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(15), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(16), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(17), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(18), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(19), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(20), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(21), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(22), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(23), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(24), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(25), true )
        call TriggerRegisterPlayerSelectionEventBJ( DummySelected, Player(26), true )
        call TriggerAddAction( DummySelected, function DummySelected_Actions )
        //===========================================================================
        call localdebugger("InicioLibInit")
    endfunction

endlibrary

The library works by itself, it doesnt need other libraries nor functions neither global variables. I recomend you to use the test map, copy paste all the assets needed and declare all the variables requested. Feel free to mode it and make your own models for the system.


Credits to:
  • The_Silent: Base logic and algorithm for this library
  • Reteras: Reteras Model Studio
  • Everyone in Hiveworkshop

Map Link: Kuzakani Wall System
Contents

Nigh Elf Large Door (Model)

Nigh Elf Small Door (Model)

Nigh Elf Towers Pack (Model)

Nigh Elf Walls Pack (Model)

Back
Top