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

need help for a trigger

Status
Not open for further replies.
Level 2
Joined
Jun 1, 2014
Messages
18
it is maybe an easy trigger but this time i dont find the solution .....
so how can i give a unit a maximum to spawn /build that the icon of the building or other unit disappear in the list

another question is : i got a bigger region and the units which should attack all in this region attack only a few things in the middle ......how can i tell them with trigger to kill all in this region ?
 
1. please explain again what do you want exactly

2. first you have to put all units of that region in unit group. then, I guess you want to order your units to attack with trigger, also put your units in unit group. Then order random unit from your units(or allof them) to attack random unit from the enemy unit group. and after each loop check if the unit group is empty(boolean). If it's empty turn off trigger. don't forget to destroy groups after each loop, to avoid leaks. If you want somethign else explain exactly how you want it.
 
Level 13
Joined
Oct 16, 2010
Messages
737
Your first part is one of the options in "Player". It won't have a number next to the icon of how many you can train but it'll dissapear when you hit the limit.

The second one is a bit more complicated. You'll have to set a unit group for all those in the region, then pick one of them and make your units attack it. Note that doing it like that will make your units ignore anything other than that target, so setting a point and making them attack-move to the point usually works better.

This is what they'd look like:

  • Set Unit Limit
    • Events
    • Conditions
    • Actions
      • Player - Limit training of Footman to 5 for Player 1 (Red)
  • Order to attack unit
    • Events
    • Conditions
    • Actions
      • -------- Pick Units in Region --------
      • Set TempUnitGroup = (Units in (Playable map area) owned by Player 2 (Blue))
      • -------- Pick random unit --------
      • Set TempUnit = (Random unit from TempUnitGroup)
      • -------- Set position of unit --------
      • Set TempPoint = (Position of TempUnit)
      • -------- Remove group as it's about to be overwritten --------
      • Custom script: call DestroyGroup(udg_TempUnitGroup)
      • -------- Set units that are going to attack --------
      • Set TempUnitGroup = (Units owned by Player 1 (Red))
      • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
        • Loop - Actions
          • -------- Make them attack-move --------
          • Unit - Order (Picked unit) to Attack-Move To TempPoint
      • -------- Remove Leaks --------
      • Custom script: call DestroyGroup(udg_TempUnitGroup)
      • Custom script: call RemovePoint(udg_TempPoint)
 
Level 2
Joined
Jun 1, 2014
Messages
18
does this work for units that spawn in this region randomly too (i mean i got no preplaced units ...... they spawn in this region randomly and more than one time )
 
Status
Not open for further replies.
Top