• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ HD Level Design Contest #1 POLL is now OPEN! Check out the stunning visuals of the final entries. 🔗Click here to cast your vote!

Sending units like in civilization wars.

Status
Not open for further replies.
Level 3
Joined
May 12, 2008
Messages
42
I was wondering how i could have units be sent every time interval. I.E, i build a barracks in a location, every 30 seconds 1 footmen will be spawned at a region and then sent to attack another region. I wanna know how i can do that but with multiples, so like i can later on build like a workshop and every 30 seconds a Tank AND a footmen is spawned and sent to attack. I'm trying to make a AOS/Civilization wars map.
 
Level 6
Joined
May 7, 2009
Messages
228
Use a trigger:

Event- periodic timer- 30 seconds
Actions- create 1 unit at location of barracks
etc.

Or if you want to do it properly, learn JASS.
 
Level 3
Joined
May 12, 2008
Messages
42
Thats not what i mean, what i meant was if i build a barracks a footmen is sent every 30 seconds, if i built another, another footmen would be sent.
 
Level 5
Joined
Dec 18, 2007
Messages
168
Event - Periodic Timer- (XXX)
Actions - (Unit) Create X unit at location X
Actions - (Unit) Order (Last Created Unit) to Move to (Area, Likely the Enemy Base)

I never knew how to do this, and I'm not finished.

With this, all you can do is make the unit, once created, move to the location.

They won't fight back if provoked, and all units that were created will move to that one area, whether it's their (base) or not.

Hopefully with this bump though, a better answer will come up.

Best of Luck!
 
Level 6
Joined
May 7, 2009
Messages
228
How much JASS do you know?
Here is the actual trigger Civilization Wars uses.
(Well more or less. I renamed the variables)


Basically, it loops though all units of type 1 and spawns a unit of type 2 next to it for the computer player. (And applies timed life and all that other stuff)

The movement is dealt with in other triggers.

JASS:
function GetPlayerUnitGroup takes player p,integer ucode returns group
    set aglobalgroup=CreateGroup()
    set bj_groupEnumTypeId=ucode
    call GroupEnumUnitsOfPlayer(aglobalgroup,p,filterGetUnitsOfPlayerAndTypeId)
    return aglobalgroup
endfunction


function SpawnUnits takes integer uc1,integer uc2 returns nothing   //spawn normal
    local integer p=0
    local group g=null
    local unit loopunit=null
    local unit newunit=null
    local player teamcomputer=null
    local integer loc_integer04=0
    local integer loc_integer05=0
    loop
        exitwhen p>5
        set g=GetPlayerUnitGroup(Player(p),uc1)
        if p<3 then
            set teamcomputer=Player(10)
        else
            set teamcomputer=Player(11)
        endif
        loop
            set loopunit=FirstOfGroup(g)
            exitwhen loopunit==null
            set newunit=CreateUnit(teamcomputer,uc2,GetUnitX(loopunit),GetUnitY(loopunit),0)
            call UnitApplyTimedLife(newunit,'BTLF',120)
            call GroupRemoveUnit(g,loopunit)
        endloop
        call DestroyGroup(g)
        set p=p+1
    endloop
    set g=null
    set loopunit=null
    set newunit=null
    set teamcomputer=null
endfunction
 
Level 9
Joined
May 30, 2008
Messages
430
@Storyyeller
why you are adding generic timer to the units 120 seconds, when he is not requiring the units to die after 120 seconds. I don't know jass but i can get some of the things in it and sience i am not spell maker i don't need JASS

@TormentedGod
You can do it with 10 lines in GUI it's very simple.
HINT: Use the search button
 
Level 6
Joined
May 7, 2009
Messages
228
@Storyyeller
why you are adding generic timer to the units 120 seconds, when he is not requiring the units to die after 120 seconds. I don't know jass but i can get some of the things in it and sience i am not spell maker i don't need JASS

@TormentedGod
You can do it with 10 lines in GUI it's very simple.
HINT: Use the search button

Because in Civ Wars, units have a 120 second time limit.
 
Status
Not open for further replies.
Top