• 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] Selection system request

Status
Not open for further replies.
Level 8
Joined
Sep 24, 2007
Messages
300
I need a trigger, that select all units of the same type, after a player select some unit.

ex: You select a footman and then trigger automaticaly adds all footmens (if possible in range around the selected one) to your selection.

I was triing to do it by myself but it just didn't work out.
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
Here you go:
  • Events
    • Player - Player 1 (Red) Selects a unit
    • Conditions
    • Actions
      • Set Temploc1 = (Position of (Triggering unit))
      • Set TempGroup = (Units within 500.00 of Temploc1 matching ((Unit-type of (Matching unit)) Equal to (Unit-type of (Triggering unit))))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Selection - Add (Picked unit) to selection for (Owner of (Triggering unit))
      • Custom script: call RemoveLocation(udg_Temploc1)
      • Custom script: call DestroyGroup(udg_TempGroup)
Yes, triggering unit works (look it up in the Trigger Editor when you select the Event)
Hope it helped =)

This way SHOULD automatically select every unit of the same type as the selected unit!
 
Level 8
Joined
Sep 24, 2007
Messages
300
Units are selected properly, but in few seconds, my game freezes. I hope you will find the problem.

  • Player 1 Selection
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
    • Actions
      • Set SelectionGroup[1] = (Units within 1000.00 of (Position of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to (Unit-type of (Triggering unit))))
      • Unit Group - Pick every unit in SelectionGroup[1] and do (Actions)
        • Loop - Actions
          • Selection - Add (Picked unit) to selection for Player 1 (Red)
          • Unit Group - Remove all units from SelectionGroup[1]
Trigger might count his own action as the event and responding with the same actions again and again, this could cause overflow, but this is more like stupid idea. I hope you have better solution. :)

Btw, I didn't determine the point, but this shouldn't be a problem afterall.
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
hahaha, yes it will ^^
It will turn itself off (meaning it cant START anymore,)
But it will still run the remaining actions,,
And the last action is turn on, which means it can Start agian,,
so AFTER you selected all the units, it gets turned on again,, ^^

-Yixx,-
 
Status
Not open for further replies.
Top