• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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