is the unit in unit group?

MissKerrigan

Active Member
Reaction score
23
Hey,

I got 9 regions in my map and they are called:

- island 1
- island 2
- island 3
- island 4
- island 5
- island 6
- island 7
- island 8
- island 9

I made triggers for this:

event: unit enters region 'island 1'
condition: none
action: add unit to unit group 'island 1'

(I did the same for all islands)


Now my question louds:

If one of my units first enters island 1 and move on to island 2, will it be in both unit groups then or does the computer removes my unit from 'island 1' and put it in 'island 2'?

Sorry I have no idea how I can describe this a better way

MissKerrigan
 

MissKerrigan

Active Member
Reaction score
23
ok then it's gonna be a problem and my question is the following then:

If a unit is in unit group 'island 4' and moves to 'island 6' how do I remove the unit from unit group 'island 4' then?
I mean, it would be wrong to make a trigger which removed it from unit group 'island 4' because the unit could also be in 'island 7'

(I assume that you understand I want to do this for all islands, a unit may only be in ONE unit group)
 

Dave312

Censored for your safe viewing
Reaction score
269
Can't you just use a trigger that removes the unit from the unit group when it leaves the region?
 

MissKerrigan

Active Member
Reaction score
23
no I can't because if the unit dies, I have to know in which unit group it was
so if the unit dies outside of a region the computer has no idea what to do

the unit must stay in the unit group untill it gets in a new one
 

X-maul

AKA: Demtrod
Reaction score
201
Every time it enters a region, remove it from all the unit groups you got, 1 at a time.
Then put into the right one. Not the most efficient, but it would work.
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
Worth noting is that you should be able to remove a unit from a unit group it isn't in.

If that doesn't work for some reason, you can always go through all unit groups and check if they're in it with the "unit is in unit group" function.
 

MissKerrigan

Active Member
Reaction score
23
I just want to make something like this:

event: any unit enters region 'island 1'
condition: none
action: removed unit from 'the unit group it is in'
action: wait 1 second
action: add unit to unit group 'island 1'

But I can't find anywhere to remove the unit group from the group it is in at that moment

Does anyone understands my situation?

MissKerrigan
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
Do as X-maul told you. You'll have to instead have it like:
event: any unit enters region 'island 1'
condition: none
action: removed unit from 'island 2'
action: removed unit from 'island 3'
action: removed unit from 'island 4'
action: removed unit from 'island 5'
action: removed unit from 'island 6'
action: removed unit from 'island 7'
action: removed unit from 'island 8'
action: removed unit from 'island 9'
action: wait 1 second
action: add unit to unit group 'island 1'

You could also do it shorter by putting the unit groups in an array and looping through it.
 

MissKerrigan

Active Member
Reaction score
23
but doesn't this brings the computer bugs because you tell it to remove the unit from 8 unit groups it isn't in?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top