Timer Spawn Guys

Ghan

Administrator - Servers are fun
Staff member
Reaction score
890
> Wondering how to make the creeps attack all players randomly

So, what are we talking here? Random UNITS from the players? Buildings? What? Heroes? We can tailor a trigger to sort for certain units. I need to know what you need, though.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
890
This will order the creeps to attack a random unit from all units owned by an enemy of the owner of the creeps. I hope that makes sense.

Code:
Timer Spawn
    Events
        Time - TimerVariable expires
    Conditions
    Actions
        Countdown Timer - Hide TimerWindowVariable
        Unit - Create 5 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
        Set TempGroup = (Last created unit group)
        Unit Group - Pick every unit in TempGroup and do (Actions)
            Loop - Actions
                Set TempGroup2 = (Units in (Playable map area) matching (((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True))
                Unit - Order (Picked unit) to Attack (Random unit from TempGroup2)
                Custom script:   call DestroyGroup(udg_TempGroup2)
        Custom script:   call DestroyGroup(udg_TempGroup)
 
R

r2yneth

Guest
Hrm, what is wrong with my triggeR? looks like yours but has more units spawning everywhere

Code:
Spawn F
    Events
        Time - TimerVariable expires
    Conditions
    Actions
        Countdown Timer - Hide TimerWindowVariable
        Unit - Create 5 F for Player 12 (Brown) at (Center of Region 008 <gen>) facing Default building facing degrees
        Unit - Create 5 F for Player 12 (Brown) at (Center of Region 008 Copy <gen>) facing Default building facing degrees
        Unit - Create 5 F for Player 12 (Brown) at (Center of Region 008 Copy 2 <gen>) facing Default building facing degrees
        Unit - Create 5 F for Player 12 (Brown) at (Center of Region 008 Copy 3 <gen>) facing Default building facing degrees
        Unit - Create 5 F for Player 12 (Brown) at (Center of Region 008 Copy 4 <gen>) facing Default building facing degrees
        Unit - Create 5 F for Player 12 (Brown) at (Center of Region 008 Copy 5 <gen>) facing Default building facing degrees
        Unit - Create 5 F for Player 12 (Brown) at (Center of Region 008 Copy 6 <gen>) facing Default building facing degrees
        Set TempGroup = (Last created unit group)
        Unit Group - Pick every unit in TempGroup and do (Actions)
            Loop - Actions
        Set TempGroup2 = (Units in Attack place <gen> matching (((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True))
        Unit - Order (Picked unit) to Attack (Random unit from TempGroup2)
        Custom script:   call DestroyGroup(udg_TempGroup)

Please correct me if I'm wrong somewhere :) Thanks in advance!
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
890
Code:
Set TempGroup = (Last created unit group)

That only gets the most recently spawned units i.e. the last 5.

Code:
Unit Group - Pick every unit in TempGroup and do (Actions)
            Loop - Actions
        Set TempGroup2 = (Units in Attack place <gen> matching (((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True))
        Unit - Order (Picked unit) to Attack (Random unit from TempGroup2)
        Custom script:   call DestroyGroup(udg_TempGroup)

This is wrong. It should be this:

Code:
Unit Group - Pick every unit in TempGroup and do (Actions)
  Loop - Actions
      Set TempGroup2 = (Units in Attack place <gen> matching (((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True))
      Unit - Order (Picked unit) to Attack (Random unit from TempGroup2)
      Custom Script: call DestroyGroup(udg_TempGroup2)
Custom script:   call DestroyGroup(udg_TempGroup)
 
R

r2yneth

Guest
Oh, so if I wanted to make it spawn everywhere, I would need 6 more triggers? :(
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
890
> Oh, so if I wanted to make it spawn everywhere, I would need 6 more triggers?

Not necessarily. You would just have to set the variable and do the loop each time you created a group of 5 units. It could all be done in the same trigger.
 
R

r2yneth

Guest
Do you think you can show me how to do it? (if its not too much trouble) :(
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
890
Code:
Unit - Create 5 F for Player 12 (Brown) at (Center of Region 008 Copy 6 <gen>) facing Default building facing degrees
Set TempGroup = (Last created unit group)
Unit Group - Pick every unit in TempGroup and do (Actions)
  Loop - Actions
      Set TempGroup2 = (Units in Attack place <gen> matching (((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True))
      Unit - Order (Picked unit) to Attack (Random unit from TempGroup2)
      Custom Script: call DestroyGroup(udg_TempGroup2)
Custom script:   call DestroyGroup(udg_TempGroup)
Unit - Create 5 F for Player 12 (Brown) at (Center of Region 008 Copy 5 <gen>) facing Default building facing degrees
Set TempGroup = (Last created unit group)
Unit Group - Pick every unit in TempGroup and do (Actions)
  Loop - Actions
      Set TempGroup2 = (Units in Attack place <gen> matching (((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True))
      Unit - Order (Picked unit) to Attack (Random unit from TempGroup2)
      Custom Script: call DestroyGroup(udg_TempGroup2)
Custom script:   call DestroyGroup(udg_TempGroup)

Repeat
 
R

r2yneth

Guest
Thank you!!!

There is one problem tho :(

Code:
Unit - Order (Picked unit) to Attack (Random unit from TempGroup2)
      Custom Script: call DestroyGroup(udg_TempGroup2)
Custom script:   call DestroyGroup(udg_TempGroup)
Unit - Create 5 F for Player 12 (Brown) at (Center of Region 008 Copy 5 <gen>) facing Default building facing degrees
Set TempGroup = (Last created unit group)

How did u get it to go bak to non-loop? For me, all the actions go under the first loop
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
890
Code:
Unit Group - Pick every unit in TempGroup and do (Actions)
  Loop - Actions
      Set TempGroup2 = (Units in Attack place <gen> matching (((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True))
      Unit - Order (Picked unit) to Attack (Random unit from TempGroup2)
      Custom Script: call DestroyGroup(udg_TempGroup2)
Custom script:   call DestroyGroup(udg_TempGroup)

See how the custom script is not indented? It's outside the loop. Pretty easy to do.
 
R

r2yneth

Guest
Lol, how'd u do it? I've been trying the past 7-8 minutes and its not working :(

OH NVM! just figured it out! thank you!

Hmmm - Its not working :(
No units are spawning anymore

Code:
Spawn Videem
    Events
        Time - TimerVariable expires
    Conditions
    Actions
        Countdown Timer - Hide TimerWindowVariable
        Unit - Create 5 F for Player 12 (Brown) at (Center of Region 008 <gen>) facing Default building facing degrees
        Set TempGroup = (Last created unit group)
        Unit Group - Pick every unit in TempGroup and do (Actions)
            Loop - Actions
                Set TempGroup2 = (Units in Attack place <gen> matching (((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True))
                Unit - Order (Picked unit) to Attack (Random unit from TempGroup2)
                Custom script:   call DestroyGroup(udg_TempGroup2)
        Custom script:   call DestroyGroup(udg_TempGroup)
        Unit - Create 5 F for Player 12 (Brown) at (Center of Region 008 Copy 2 <gen>) facing Default building facing degrees
        Set TempGroup = (Last created unit group)
        Unit Group - Pick every unit in TempGroup and do (Actions)
            Loop - Actions
                Set TempGroup2 = (Units in Attack place <gen> matching (((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True))
                Unit - Order (Picked unit) to Attack (Random unit from TempGroup2)
                Custom script:   call DestroyGroup(udg_TempGroup2)
        Custom script:   call DestroyGroup(udg_TempGroup)
        Unit - Create 5 F for Player 12 (Brown) at (Center of Region 008 Copy 3 <gen>) facing Default building facing degrees
        Set TempGroup = (Last created unit group)
        Unit Group - Pick every unit in TempGroup and do (Actions)
            Loop - Actions
                Set TempGroup2 = (Units in Attack place <gen> matching (((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True))
                Unit - Order (Picked unit) to Attack (Random unit from TempGroup2)
                Custom script:   call DestroyGroup(udg_TempGroup2)
        Custom script:   call DestroyGroup(udg_TempGroup)
        Unit - Create 5 F for Player 12 (Brown) at (Center of Region 008 Copy 4 <gen>) facing Default building facing degrees
        Set TempGroup = (Last created unit group)
        Unit Group - Pick every unit in TempGroup and do (Actions)
            Loop - Actions
                Set TempGroup2 = (Units in Attack place <gen> matching (((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True))
                Unit - Order (Picked unit) to Attack (Random unit from TempGroup2)
                Custom script:   call DestroyGroup(udg_TempGroup2)
        Custom script:   call DestroyGroup(udg_TempGroup)
        Unit - Create 5 F for Player 12 (Brown) at (Center of Region 008 Copy 5 <gen>) facing Default building facing degrees
        Set TempGroup = (Last created unit group)
        Unit Group - Pick every unit in TempGroup and do (Actions)
            Loop - Actions
                Set TempGroup2 = (Units in Attack place <gen> matching (((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True))
                Unit - Order (Picked unit) to Attack (Random unit from TempGroup2)
                Custom script:   call DestroyGroup(udg_TempGroup2)
        Custom script:   call DestroyGroup(udg_TempGroup)
        Unit - Create 5 F for Player 12 (Brown) at (Center of Region 008 Copy 6 <gen>) facing Default building facing degrees
        Set TempGroup = (Last created unit group)
        Unit Group - Pick every unit in TempGroup and do (Actions)
            Loop - Actions
                Set TempGroup2 = (Units in Attack place <gen> matching (((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True))
                Unit - Order (Picked unit) to Attack (Random unit from TempGroup2)
                Custom script:   call DestroyGroup(udg_TempGroup2)
        Custom script:   call DestroyGroup(udg_TempGroup)
        Unit - Create 5 F for Player 12 (Brown) at (Center of Region 008 Copy <gen>) facing Default building facing degrees
        Set TempGroup = (Last created unit group)
        Unit Group - Pick every unit in TempGroup and do (Actions)
            Loop - Actions
                Set TempGroup2 = (Units in Attack place <gen> matching (((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True))
                Unit - Order (Picked unit) to Attack (Random unit from TempGroup2)
                Custom script:   call DestroyGroup(udg_TempGroup2)
        Custom script:   call DestroyGroup(udg_TempGroup)

I'm pretty sure I did everything correct :banghead:
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
890
Hm? They don't spawn at all? No units are created? Does the timer expire? Is it the correct timer?
 
R

r2yneth

Guest
Nothing spawn at all
The timer does not expire I dunno why :banghead:
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
890
At this point, it would much simpler for both of us (and would take less time, too) if you just uploaded your map so that I could do it myself.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
890
Hey! How about it! It works! And it's pretty simple, too. Try it out. Go wild. But be careful with the triggers if you don't know what you're doing.
 
R

r2yneth

Guest
woo! you're the best! thanks! :)

Do i copy everything and just change the monsters if I wanted it to be level2/3/4?
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
890
> Do i copy everything and just change the monsters if I wanted it to be level2/3/4?

There are ways to condense that as well, but that way will work IF you do a comparison to check which level you're on. Otherwise, it will spawn all of the creep levels each wave.
 
R

r2yneth

Guest
:) I was wondering if you do a sample (whenever you have time on your hands - if you want) that would greatly improve my map :eek:
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top