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

Spawning units at another unit

Status
Not open for further replies.
Level 3
Joined
May 12, 2008
Messages
42
Okay so i made a trigger that when a unit finishes being built
and if the unit is a milita recruitment
then add the unit to unit group milita2

:sad:
now how could i make it so that every 10 seconds 2 milita units would spawn at any milita recruitment in the unit group milita 2

:smile: thanks for help
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
HI

Im using the german editor, but i think u can understand it, since every important information is in english =)

Posibility 1:
  • Trigger
    • Ereignisse
      • Time - Every 10.00 seconds of game time
    • Bedingungen
    • Aktionen
      • Unit Group - Pick every unit in groupmilita2 and do (Actions)
        • Loop - Actions
          • Set TempPoint = (Position of (Picked unit))
          • Einheit - Create 2 militia for (Owner of (Picked unit)) at TempPoint facing default degrees
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Custom script: set udg_TempPoint=null
Psoibility 2: If u dont like periodic Events, or to be able to control the SpawnTime a bit, u can use a Timer, wich you have to start manually at Time - 0.00 (or whenever you want). The good Thing is, u can stop Timers, so u could stop the Spawning for all Players by Trigger:
  • Set up
    • Ereignisse
      • Map initialization
    • Bedingungen
    • Aktionen
      • Countdown-Timer - Start SpawnTimer as a Einmalig timer that will expire in 10.00 seconds
  • Spawn
    • Ereignisse
      • Time - SpawnTimer expires
    • Bedingungen
    • Aktionen
      • Unit Group - Pick every unit in groupmilita2 and do (Actions)
        • Schleifen - Aktionen
          • Set TempPoint = (Position of (Picked unit))
          • Einheit - Create 2 milita for (Owner of (Picked unit)) at TempPoint facing default degrees
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Custom script: set udg_TempPoint=null
      • Countdown-Timer - Start SpawnTimer as a Einmalig timer that will expire in 10.00 seconds
I hope that it is helpfull =)

Greetings
Emm-A-
 
Level 28
Joined
Mar 25, 2008
Messages
2,955
HI

Im using the german editor, but i think u can understand it, since every important information is in english =)

Posibility 1:
  • Trigger
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in groupmilita2 and do (Actions)
        • Loop - Actions
          • Set TempPoint = (Position of (Picked unit))
          • Unit - Create 2 militia for (Owner of (Picked unit)) at TempPoint facing default degrees
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Custom script: set udg_TempPoint=null
Possibility 2: If u dont like periodic Events, or to be able to control the SpawnTime a bit, u can use a Timer, wich you have to start manually at Time - 0.00 (or whenever you want). The good Thing is, u can stop Timers, so u could stop the Spawning for all Players by Trigger:
  • Set up
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Timer - Start SpawnTimer as a One-shot timer that will expire in 10.00 seconds
  • Spawn
    • Events
      • Time - SpawnTimer expires
    • Conditions
    • Aconditions
      • Unit Group - Pick every unit in groupmilita2 and do (Actions)
        • Schleifen - Aktionen
          • Set TempPoint = (Position of (Picked unit))
          • Unit - Create 2 milita for (Owner of (Picked unit)) at TempPoint facing default degrees
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Custom script: set udg_TempPoint=null
      • Timer - Start SpawnTimer as a One-shot timer that will expire in 10.00 seconds
I hope that it is helpfull =)

Greetings
Emm-A-
Well it would but you also can set the One-shot timer to a continious one to get rid of the last line in the second trigger
 
Level 3
Joined
May 12, 2008
Messages
42
well wat is this..

Set TempPoint = (Position of (Picked unit))
Einheit - Create 2 militia for (Owner of (Picked unit)) at TempPoint facing default degrees
Custom script: call RemoveLocation(udg_TempPoint)
Custom script: set udg_TempPoint=null
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
Search in the GUI-Actions for Set Variable.

TempPoint is the Name of a Variable. In the Triggereditor, press STRG + 8 or hit the "Yellow X", then select POINT as VariableType.

Then you go to Actions and search for Set Variable.

The Custom Script is also an action, that u can find in the GUI.

Greets
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
Would this work if i had 2 milita recruitment centers?

So you want to have two points to spawn your Milita units?

So you just have to use the variable a second time:

Like this:
  • Set TempPoint = (Center of (Area X))
  • Unit - Create 1 Militia for Player 1 (Red) at TempPoint facing default degrees
  • Custom script: call RemoveLocation(udg_TempPoint)
  • Set TempPoint = (Center of (Area y))
  • Unit - Create 1 Militia for Player 1 (Red) at TempPoint facing default degrees
  • Custom script: call RemoveLocation(udg_TempPoint)
 
Level 3
Joined
May 12, 2008
Messages
42
Nvm i dont need to do that it works with just the one
but i have question how can make it so when like the milita center is destroyed the milita will stop spawning or if upgraded itll stop spawning.
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
u need those bolean Comparissons:

1. Unit is alive
2. Research Type Equal to Integer number(as i think you have to research for the upgrade)

  • (Current research level of <ResearchType> for Player X) Equal to Y
  • // Put in for Player X = picked Player in the PickPlayerloop, and for Y the Levelnumber of the researchtype(that u want to compare
  • then use IF / THEN / ELSE to use the Conditon
  • ((Ur barracks) is alive) Equal to True
 
Status
Not open for further replies.
Top