Hi everyone, three hours of tweaking and experimenting things has led me to believe that global variable unit groups behave differently than the unit groups from the map->groups window (i'll call the latter type "ui unit groups").
Here's how I know:
1. I had a trigger that just created a unit, then added that unit to my ui unit group. The last action in the trigger would ask for how many units in the group. First, I tried doing it with just actions: Create Unit action, followed by a Add Unit to Unit Group action that got the LastCreatedUnit. At the end of the trigger, it said 0 units were in the unit group. My second try involved scripting the actions: I had a script which called CreateUnit, caught the return in a variable, and added it to a unit group via the UnitGroupAdd function. Still, the end of the trigger said 0 units were in the unit group.
2. Instead of getting the unit and adding it to the ui unit group, I made a local variable, and set it to equal the ui unit group. At the end of the trigger, get this, it said the local unit group had 1 unit, while the ui unit group had 0. This can mean two things: the local unit group was another instance (as opposed to a reference), or the UnitGroupCount function is not working.
3. In that same trigger, I added another action: Set Variable. I set the ui unit group to the value of the local unit group. Nothing changed, the local unit group still had 1, and the ui unit group still had 0.
4. Instead of having a ui unit group and a local unit group, I just used one global unit group. Everything worked perfectly. Once I added the unit to it, this global unit group then had 1.
All these experiments lead me to these possible conclusions:
A. There are some massive bugs in the galaxy editor, or
B. Unit Groups, the ones in the map -> object groups window (as opposed to global or local unit group variables) are const.
I could use some guidance here. I could find no place that said these things were const. Thoughts?
Hi everyone, three hours of tweaking and experimenting things has led me to believe that global variable unit groups behave differently than the unit groups from the map->groups window (i'll call the latter type "ui unit groups").
Here's how I know:
1. I had a trigger that just created a unit, then added that unit to my ui unit group. The last action in the trigger would ask for how many units in the group. First, I tried doing it with just actions: Create Unit action, followed by a Add Unit to Unit Group action that got the LastCreatedUnit. At the end of the trigger, it said 0 units were in the unit group. My second try involved scripting the actions: I had a script which called CreateUnit, caught the return in a variable, and added it to a unit group via the UnitGroupAdd function. Still, the end of the trigger said 0 units were in the unit group.
2. Instead of getting the unit and adding it to the ui unit group, I made a local variable, and set it to equal the ui unit group. At the end of the trigger, get this, it said the local unit group had 1 unit, while the ui unit group had 0. This can mean two things: the local unit group was another instance (as opposed to a reference), or the UnitGroupCount function is not working.
3. In that same trigger, I added another action: Set Variable. I set the ui unit group to the value of the local unit group. Nothing changed, the local unit group still had 1, and the ui unit group still had 0.
4. Instead of having a ui unit group and a local unit group, I just used one global unit group. Everything worked perfectly. Once I added the unit to it, this global unit group then had 1.
All these experiments lead me to these possible conclusions:
A. There are some massive bugs in the galaxy editor, or
B. Unit Groups, the ones in the map -> object groups window (as opposed to global or local unit group variables) are const.
I could use some guidance here. I could find no place that said these things were const. Thoughts?
- Evan