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

[Trigger] Perodic Spawning

Status
Not open for further replies.
Level 4
Joined
Sep 2, 2006
Messages
99
Example:
Red has a building, they can upgrade that building into two different things.
Well I want if they upgrade it into A unit 1 will spawn every second.
Or if they upgrade it to B unit 2 will spawn every 1 second.
I'm kind of frazzled about this and just want a straight trigger answer, or something easy to do this.


Thank you +rep always to people who help
 
Level 4
Joined
Sep 2, 2006
Messages
99
The units will be controllable, the players will again have control of what buildings to choose from, I will have at least three choices and I so I will need some kind of condition or make an event so when that building finishes upgrading units will spawn there? Also when it gets destroyed I want them to stop.

It is not an AoS type map.
 
Level 16
Joined
Jul 21, 2008
Messages
1,121
Try using this:

  • -------- Put this into your initialization --------
  • -------- N is last building / unit number --------
  • -------- Variables below are Unit-Type --------
  • Set Building[1] = YourBuilding1
  • Set Building[2] = YourBuilding2
  • Set Building[N] = YourBuildingN
  • Set Unit[1] = UnitFromBuilding1
  • Set Unit[2] = UnitFromBuilding2
  • Set Unit[N] = UnitFromBuildingN
  • Spawns
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • -------- Here goes spawning --------
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Set TempGroup = (Units of type Building[(Integer A)])
          • Unit Group - Pick every unit in TempGroup and do (Actions)
            • Loop - Actions
              • Set TempPoint = (Position of (Picked unit))
              • Unit - Create 1 Unit[(Integer A)] for (Owner of (Picked unit)) at TempPoint facing Default building facing degrees
              • Custom script: call RemoveLocation(udg_TempPoint)
          • Custom script: call DestroyGroup(udg_TempGroup)
 
Level 4
Joined
Sep 2, 2006
Messages
99
This is what I have and wanted, it is currently working excellent.
  • UnitSpawn
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Building) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Unit for (Owner of (Picked unit)) at (Position of (Picked unit)) facing (Position of (Triggering unit))
 
Level 7
Joined
Jul 20, 2008
Messages
377
Events
Time - Every 1.00 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in (Units of type Building) and do (Actions)
Loop - Actions
Unit - Create 1 Unit for (Owner of (Picked unit)) at (Position of (Picked unit)) facing (Position of (Triggering unit))

These are leaks. Place them into the correct variables and destroy the group after you're done with it.
 
Level 8
Joined
Sep 13, 2006
Messages
431
You'll want to use something like this to avoid leaks. This also allows your building's rally location to function normally, though it is optional:

  • Events
    • Time - Every 1.00 seconds of game time
  • Conditions
  • Actions
    • Set UnitGroup = (Units in (Playable map area) matching ((Unit-type of (Matching)) Equal to Building))
    • Unit Group - Pick every unit in UnitGroup and do (Actions)
      • Loop - Actions
        • Set Point = (Position of (Picked unit))
        • Unit - Create 1 Unit for (Owner of (Picked unit)) at Point facing Default building facing degrees
        • Unit - Order (Last created unit) to Attack-Move To (Rally-Point of (Picked unit) as a point)
    • Custom script: call RemoveLocation( udg_Point )
    • Custom script: call DestroyGroup( udg_UnitGroup )
Hope this helps!
 
Last edited:
Status
Not open for further replies.
Top