• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[Trigger] Spawn multiple units by pressing button?

Status
Not open for further replies.
Level 5
Joined
Oct 11, 2009
Messages
125
I would like someone to tell me how I can spawn multiple units by selecting a button in something like a tavern. I need to have the spawned units teleport and change ownership but I can do that no problem. Any help?
 
  • Trigger
  • Events
    • Unit - A unit sells a unit
  • Conditions
  • Actions
    • Set Point1 = (Position of (Sold unit))
    • For each (IntegerA) from 1 to 4, do (Actions)
      • Loop - Actions
        • Unit - Create 1 (Unit-type of (Sold unit)) for (Owner of (Sold unit)) at Point1 facing default building degrees
    • Custom script: call RemoveLocation (udg_Point1)
 
ummm I seem to have made a mistake?

This is what I made (I know it's not what you put down but it helped)

Events- Unit Mercenary Camp X (gen) sells a unit.
Condition-
Action-Unit-Create 5(Unit-Type(Sold Unit)) for (Player x (xxx)) at (xxx<gen>)

It creates 1 of the sold units right next to the camp and 5 mercenary camps at the region where the units should spawn!
 
1. Yes I am sure I used sold unit.
2. Pharaoh what does that action do that isn't already being done (i know it's probably important but im just curious) and where do I find Set Point?
 
It moves your sold unit at the point where the rest units should spawn. This will have a total amount of 6 units. If you want 5 units, either create 4 units and move the unit or create 5 units and use the actions:
  • Unit - Kill (Sold unit)
  • Unit - Remove (Sold unit) from the game
Set Point1 is a variable; you store the location to remove it afterwards, because it causes memory leak. For more:
https://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/variables-5896/
https://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/
 
AAAAAH THANK GOD!!! Finally worked after I changed it from selling a unit to training a unit and than I added the remove unit from game action
 
Status
Not open for further replies.
Back
Top