• 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] Why won't my simple trigger work?

Status
Not open for further replies.
Level 3
Joined
Jun 27, 2008
Messages
34
ok i have this trigger that when a player types -store all his non-hero units go to his store area.

  • Reds Store
    • Events
      • Player - Player 1 (Red) types a chat message containing -store as An exact match
    • Conditions
      • ((Triggering unit) is A Hero) Equal to False
    • Actions
      • Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Unit - Move (Triggering unit) instantly to (Center of Red Store <gen>))
is it not working because the units are invulnerable?

plz help
 
Level 4
Joined
Apr 20, 2009
Messages
106
This should do what you're looking for.

  • Store
    • Actions
      • Player - Player 1 (Red) types a chat message containing Store as An exact match
    • Conditions
    • Events
      • Set TempUnitGroup = (Units in (Playable map area) owned by Player 1 (Red))
      • Set TempPoint = (Center of (Playable map area))
      • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A Hero) Equal to False
            • Then - Actions
              • Unit - Move (Picked unit) instantly to TempPoint
            • Else - Actions
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call DestroyGroup(udg_TempUnitGroup)
TempUnitGroup is a variable of the type Unit Group. TempPoint is a variable of the type Point. You can assign TempPoint to the center of whatever location you'd like.

What it's doing is picking all the units owned by Red, putting them into TempUnitGroup, and then it picks each unit individually, check if it's a Hero, and if it's not a Hero it will move them to TempPoint. The two lines of Custom Script at the end just clean up leaks from the Point and Unit Group.
 
Level 3
Joined
Jun 27, 2008
Messages
34
i copied everything exact and yet its still not working. this is really starting to agrivate me...:cry:
 
  • Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Unit - Move (Triggering unit) instantly to (Center of Red Store <gen>))
change triggering unit to picked unit

  • Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Unit - Move (Picked unit) instantly to (Center of Red Store <gen>))
however QirajiLord's solution is better because it does not leak that much memory
you probably missed changing things to picked unit there as well
if you didn't try to make debug messages everywhere in the trigger to see where it stops
(Game - Display Text to Player) or something like that
 
Level 3
Joined
Jun 27, 2008
Messages
34
  • Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Unit - Move (Triggering unit) instantly to (Center of Red Store <gen>))
change triggering unit to picked unit

  • Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Unit - Move (Picked unit) instantly to (Center of Red Store <gen>))
however QirajiLord's solution is better because it does not leak that much memory
you probably missed changing things to picked unit there as well
if you didn't try to make debug messages everywhere in the trigger to see where it stops
(Game - Display Text to Player) or something like that

thanks your right had them as triggering unit not picked unit :D works great thanks :D +rep
 
Status
Not open for further replies.
Top