• 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] Problem with picking units

Status
Not open for further replies.
Level 5
Joined
Dec 25, 2018
Messages
110
  • Wait 12.00 seconds
  • Set LocalGroup2 = (Units within 3000.00 of LocalPoint3 matching ((((Matching unit) belongs to an ally of (Owner of LocalUnit)) Equal to True) and (((Matching unit) is alive) Equal to True)))
  • Unit Group - Pick every unit in LocalGroup2 and do (Actions)
    • Loop - Actions
      • Set DelUnit = (Picked unit)
      • Game - Display to (All players) the text: del
      • Custom script: call UnitRemoveAbility(udg_DelUnit ,'B01Q')
      • Custom script: call UnitRemoveAbility(udg_DelUnit ,'B01R')
  • Custom script: call DestroyGroup(udg_LocalGroup2)
LocalUnit is local created by
Custom script: local unit udg_LocalUnit.

Pick every unit in every LocalGroup2 works fine if I use this code before the wait, how can I make it work after wait?
 
Last edited:
You cannot use local variables inside conditinal statements in GUI, since they create separate functions in the JASS script, so I'm not even sure why it would work before the wait. It should not work as intended at all (unless the owner of the global LocalUnit happens to be the same as the local). Also, you have to null local unit variables at the end of each trigger that you use them in, unless that unit is never supposed to be removed from the game.

  • Custom script: set udg_LocalUnit = null
Would you mind posting the entire trigger? Might be easier to debug that way.
 
Last edited:
Level 45
Joined
Feb 27, 2007
Messages
5,578
You can just assign some other global right before that LocalGroup2 set line:
  • Wait 12.00 seconds
  • Set USE_THIS_GLOBAL = LocalUnit
  • Set LocalGroup2 = (Units within 3000.00 of LocalPoint3 matching ((((Matching unit) belongs to an ally of (Owner of USE_THIS_UNIT)) Equal to True) and (((Matching unit) is alive) Equal to True)))
 
Level 5
Joined
Dec 25, 2018
Messages
110
You can just assign some other global right before that LocalGroup2 set line:
  • Wait 12.00 seconds
  • Set USE_THIS_GLOBAL = LocalUnit
  • Set LocalGroup2 = (Units within 3000.00 of LocalPoint3 matching ((((Matching unit) belongs to an ally of (Owner of USE_THIS_UNIT)) Equal to True) and (((Matching unit) is alive) Equal to True)))
This worked, thanks.
 
Status
Not open for further replies.
Top