[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: 62
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.
 
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?
 
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.
Back
Top