• 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 faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Help! why the enemy stop moving and attacking!

Status
Not open for further replies.
Level 1
Joined
Jul 20, 2020
Messages
2
Help! why the enemy stop moving and attacking!


I create some units to attack my main hero.
but when i moving my main hero left <-> right around many times , the created enemys stop moving and attacking ,they seems to be suspend!
how can i make them moving and attacking again!
Thanks!

[v 1.32.9]

JASS:
library startInit initializer init_function
globals
    private unit mainHero
    private group enemyG
endglobals


private function oderUnit_attack takes nothing returns nothing
    local unit u = GetEnumUnit()
    local real x =GetUnitX(mainHero)
    local real y =GetUnitY(mainHero)

    if IsUnitType(u, UNIT_TYPE_DEAD) then
        call GroupRemoveUnit(enemyG  ,  u )
    else
        call  IssuePointOrder( u , "attack" ,x , y )
        // call IssuePointOrder( u , "attack" ,x , y )
        // call IssuePointOrderLoc( u , "attack" , l )
    endif
endfunction

private function startOderUnit takes nothing returns nothing
    call ForGroup(enemyG ,function oderUnit_attack )
endfunction

private function createEnemy takes nothing returns nothing
    local unit u
    local real x = GetUnitX(mainHero)
    local real y = GetUnitY(mainHero)
    local location l = Location(x , y)

    set u = CreateUnit(Player(5),'Hmkg',3000,3000,0)
    call SetUnitAcquireRange(u, 2000.00)
    call RemoveGuardPosition(u)
    // call GroupAddUnit( enemyG,u)
    // call IssuePointOrder( u , "attack" ,x , y )
    call IssuePointOrderLoc( u , "attack" ,l )

    call RemoveLocation(l)
    // call BJDebugMsg(R2S(x) + " , " + R2S(y))
    set u = null
    set l = null
endfunction

private function createHero takes nothing returns nothing
    set mainHero = CreateUnit(Player(0) , 'Hmkg' ,0 , 0 , 0 )
endfunction

private function initMap takes nothing returns nothing
    call FogMaskEnableOff()
    call FogEnableOff()
    call SetCameraFieldForPlayer(Player(0), CAMERA_FIELD_TARGET_DISTANCE, 2200.00, 0)

    call SetMapName("testMap")
    call SetMapDescription("testMap")
    call SetPlayers(5)
    call SetTeams(5)

    call BJDebugMsg("testMap inited!")
endfunction


    private function init_function takes nothing returns nothing
        local timer timer_createEnemy = CreateTimer()
        local timer timer_oderEnemy = CreateTimer()
        set enemyG = CreateGroup()

        call initMap()
        call createHero()
        call createEnemy()

        call TimerStart( timer_createEnemy , 0.5 , true , function createEnemy)
        // call TimerStart( timer_oderEnemy , 0.03 , true , function startOderUnit)
      
    endfunction
endlibrary
 

Attachments

  • testMapClip.gif
    testMapClip.gif
    4.7 MB · Views: 31
  • testMap.w3x
    21.6 KB · Views: 25
Level 1
Joined
Jul 20, 2020
Messages
2
it works! thank you verymuch!
Warcraft 3 supports only a limited amount of moving units per player at the same time I think something like 100. Split your attackers into multiple players (so that no player reaches that limit), then they all can move again.
 
Status
Not open for further replies.
Top