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

[Solved] Single unit variables

Status
Not open for further replies.
Level 4
Joined
Jul 10, 2013
Messages
73
Are there leaks in single unit variables? I'm just wondering if my trigger is going to be leaking at all or not. I attached it below. I was looking around and found some custom script solutions, but they come up as errors when trying to save the map.
 

Attachments

  • trigger.png
    trigger.png
    10.4 KB · Views: 53
Level 11
Joined
Jun 2, 2004
Messages
849
Unit variables don't leak, no.


Notably your trigger won't work if run twice; the unit group variable is destroyed but never recreated. You can't add a unit to a null unit group.

If you want to create an empty group, there's no GUI action for this, but there is a simple custom script:
Code:
set udg_GroupVar = CreateGroup()
Then you can destroy it later in the trigger.
 
Level 4
Joined
Jul 10, 2013
Messages
73
The only reason I am using a group variable here is because it is the only way I know how to make a single unit attack move to a target and not just go straight for the target. The trigger re-runs many times because it goes off on a popular unit death, why would it not work?
 
Level 13
Joined
May 10, 2009
Messages
868
You are looking for this action "Unit - Issue Order Target A Point":
  • Unit - Order (Killing unit) to Attack-Move To Point2
As Kaijyuu said, you can't add units to groups that don't exist. If you intend to keep using a specific group, use this function instead:

Unit Group - Clear
  • Unit Group - Remove all units from YourGroup
You only need to destroy/remove things when you don't need them anymore.
 
Status
Not open for further replies.
Top