Complex Trigger Problem

Phubar

Ultra Cool Member
Reaction score
30
To avoid comanding unit before whole group is selected add
-make triggering unit uncommandable
at the very start of selection group trigger and
-make triggering unit commandable
after the group selection is done.
 

Phubar

Ultra Cool Member
Reaction score
30
To instant select you need a function that gives the group where the unit is in (cant find it... you need a custom function)
Then you have to use "select group" base function and refer to the group (group in which the triggering unit is).
Siretu may help with this custom function, try to tell him to take a look at this discussion (if he does not alteady done it) :)
 

Dave312

Censored for your safe viewing
Reaction score
269
To instant select you need a function that gives the group where the unit is in (cant find it... you need a custom function)
You don't need a custom function. Just use the Selected Units function to get the currently selected units for that player.

I personally would be just using the Custom Value attribute on each unit to store which squad they belong to. Then when you need to select a squad, just cycle through all the units owned by that player and if the custom value matches the value from the unit selected, add that unit to the units selection. Should be pretty fast if a player doesn't have too many units in the game at once. I personally see data table as being quite slow but where this is actually true or not I don't know. Ofcourse this still won't solve your problem with the delay.
 

Kyuft

Member
Reaction score
11
I have a working system right now, with custom values, but it still has a delay. very short, but its still a delay...

-Kyuft:cool:
 

Phubar

Ultra Cool Member
Reaction score
30
Dave i was talking about another thing.
If you have 3 groups (A, B and C) when you select any unit the trigger will
-Select all unit in group (the one where the selected unit is)
So it will select A, B or C.
 

Dave312

Censored for your safe viewing
Reaction score
269
After some testing, it seems the delay comes from the time difference between the unit being physically selected in the game and available for orders and the Unit Selected event firing. In which case, you will never be able to remove the delay.

As Phubar suggested, you can stop a unit being quickly given orders which the rest of his squad doesn't receive by making the unit uncommandable. To get this to work correctly, each unit needs to be made uncommandable when they are create, and then when selected, make them commandable. If a player attempts to issue an order to quickly to the unit, then the player will receive a "Unit is Uncommadable" error.
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
Couldn't you make another trigger that runs when a unit is selected that checks if the amount of units selected by the triggering player == 1 and if so, orders all units in that unit's group to do the same thing.

I only skimmed throuh the thread so I might be missing some big parts of the problem.
 

Phubar

Ultra Cool Member
Reaction score
30
Siretu, the "problem" is that there is no function that selects or returns the group of a given unit.
Or i cant find it..
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
I'm not sure what you mean.

- Do you mean that there's no event that triggers when a unit is selected? There's the "Unit is Selected" event which should work.

- Do you mean that there's no way to get all the other units in Kyuft's own unit groups? There should be, how else can he select all of them when one is selected?

- Do you mean that there's no way to get all units selected by a player? Use the "Selected Units" function.

I think I'm missing the actual problem here.
 

Phubar

Ultra Cool Member
Reaction score
30
None of them :)
I mean im not able to do a thing like
myGroup= group of (myUnit)
ie
unit "mom" is in group "family", unit "carl" is in group "friends".
myGroup= group of (mom) will do myGroup=family
If i change mom with carl myGroup=friends.

Kyuft made a trigger for group selection but he asked to chsnge it.
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
The reason there's no such action is that a unit can be in several unit groups at once. Kyuft doesn't want to use real unit groups iirc, because there's going to be potentially infinite amounts of unit groups.
 

Phubar

Ultra Cool Member
Reaction score
30
Kyuft has already a working set of triggers but he wants to change it becouse of:

I have found a new problem[...] I have realized that in the time it takes for the trigger to process all of the Actions, and select the rest of the squad (when a unit is selected), you can still command that single unit. I want to somehow make it so that the instant the unit is selected, the rest of the squad is selected, as if they are one big unit. [...] Does anybody have any clue how to make an instant, neat system like the one I have described?

So i think he has to keep his triggers as they are and find a way to bypass the problem of commanding a unit before the whole group is selected.
I suggested this (to add in the trigger triggered by "Unit is selected")

Add
-make triggering unit uncommandable
at the very start of "selection group trigger" and
-make triggering unit commandable
after the group selection is done.

Dave said that this can be source of some bugs but i dont understand why. I keep thinking about it but i dont see wrong things.
 

Phubar

Ultra Cool Member
Reaction score
30
Sry but i think that your trigger wont work if he selects 2 or more units (by selection box).
Btw he solved the "reselect a unit that is alredy selected" (using his or my solution, that are similar) and now has the problem that in the time gap between he selects a unit and the whole group is selected, he can order that unit to do something and of course the rest of the group wont take the order becouse it's not selected.
Am i wrong? :)

PS Kyuft can you post your map on the bnet? So we can test it and see how big is that delay.
 

Kyuft

Member
Reaction score
11
Guys, my system works, but I guess I'll just have to get used to the .02-.05 second delay that is slightly inconvenient. Thanks though!

-Kyuft:cool:
 

Kyuft

Member
Reaction score
11
I will upload it soon.

EDIT: Phubar, you have it exactly correct, however, using your solution, I can set the units invulnerable until all of the units in the squad are selected. I was just hoping that there wasn't a delay, because I want someone to be able to select the unit (and its squad) and move them instantly, rather than having to wait for the units to all be selected.

-Kyuft:cool:
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
I'm sorry, this is slightly frustrating. I might just be missing the point, but I am trying to suggest a way to fix the delay problem. That's what I'm trying to solve, nothing else.

It shouldn't be a problem if you select more units because I said to add a condition that checks that there's only one selected unit, so it excludes drag selecting several units.

Edit:

Here's what I'm talking about:
Trigger:
  • Single Unit order
    • Events
      • Unit - Any Unit is issued an order to Any Ability Command
    • Local Variables
      • DataValue = "" <String>
    • Conditions
      • (Number of Living units in (Selected units for player (Triggering player))) == 1
    • Actions
      • Variable - Set DataValue = (String((Custom value 0 of (Triggering unit))) with Any Precision decimal places)
      • Unit - Order all units in ("MarineSquad[" + lv_dataValue + "]" from the Global data table) to ((Ability command for (Triggering order))) (Replace Existing Orders)

So if you manage to select a unit and give it an order before it selects all units in the group, it automatically tells the group to do the same thing as you told the single unit. Is there any reason why this wont work?
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
Good point. When I think about it, my solution has some problems. I think it'll cause an infinite loop. I suggest you try it out but remove the condition and turn off the trigger first and turn it on at the end.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top