• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] Why is this trigger not working properly?

Status
Not open for further replies.
Level 3
Joined
May 7, 2016
Messages
38
Ok so for this trigger i have this events
  • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Picked unit)) Equal to Scout Tower
        • Then - Actions
          • Unit Group - Add (Picked unit) to T_US_TR_Towers
        • Else - Actions
  • Unit Group - Pick every unit in T_US_TR_Towers and do (Actions)
    • Loop - Actions
      • Trigger - Add to Tower Range Selection <gen> the event (Unit - (Picked unit) Is selected)
So my goal is to see for each player(4 total) if they have selected one unit and to save that (one) unit
So i first tried this
  • For each (Integer A) from 1 to 4, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units currently selected by (Player((Integer A))))) Equal to 1
        • Then - Actions
          • Set T_US_TR_OneSelect[(Integer A)] = True
          • Set T_US_TR_Unit[(Integer A)] = (Triggering unit) <--------------------Marked
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of T_US_TR_Unit[(Integer A)]) Equal to Scout Tower
            • Then - Actions
              • Set T_US_TR_Type[(Integer A)] = 1
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of T_US_TR_Unit[(Integer A)]) Equal to Guard Tower
                • Then - Actions
                  • Set T_US_TR_Type[(Integer A)] = 2
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of T_US_TR_Unit[(Integer A)]) Equal to Cannon Tower
                    • Then - Actions
                      • Set T_US_TR_Type[(Integer A)] = 3
                    • Else - Actions
        • Else - Actions
          • Set T_US_TR_OneSelect[(Integer A)] = False
Than i tried this
  • For each (Integer A) from 1 to 4, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units currently selected by (Player((Integer A))))) Equal to 1
        • Then - Actions
          • Set T_US_TR_OneSelect[(Integer A)] = True
          • Unit Group - Pick every unit in T_US_TR_Towers and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is selected by (Player((Integer A)))) Equal to True
                • Then - Actions
                  • Set T_US_TR_Unit[(Integer A)] = (Picked unit) <--------------------Marked
                • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of T_US_TR_Unit[(Integer A)]) Equal to Scout Tower
            • Then - Actions
              • Set T_US_TR_Type[(Integer A)] = 1
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of T_US_TR_Unit[(Integer A)]) Equal to Guard Tower
                • Then - Actions
                  • Set T_US_TR_Type[(Integer A)] = 2
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of T_US_TR_Unit[(Integer A)]) Equal to Cannon Tower
                    • Then - Actions
                      • Set T_US_TR_Type[(Integer A)] = 3
                    • Else - Actions
        • Else - Actions
          • Set T_US_TR_OneSelect[(Integer A)] = False
Did multiple checks using
  • Game - Display to (All players) the text: Check
to see the name of the unit and it was always (blank)
So now i have 0 idea why this is not working
 
Last edited:
Well here are some issues and questions I have at a glance:
    • If - Conditions
      • (Number of units in (Units currently selected by (Player((Integer A))))) Equal to 1
    ^ This will only work if the Player literally has one unit selected. If they drag select multiple units, this will return false.

    • Set T_US_TR_Unit[(Integer A)] = (Triggering unit)
    ^What event is this trigger running off of? Need to check to make sure GetTriggerUnit() is valid

  • Where in the trigger did you the debug message?
 
"So my goal is to see for each player(4 total) if they have selected one unit and to save that (one) unit"

The trigger is running on
  • Unit Group - Pick every unit in T_US_TR_Towers and do (Actions)
  • Loop - Actions
  • Trigger - Add to Tower Range Selection <gen> the event (Unit - (Picked unit) Is selected)
already given you the info you need

But wait...
Now i am using this
  • For each (Integer A) from 1 to 4, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units currently selected by (Player((Integer A))))) Equal to 1
        • Then - Actions
          • Set T_US_TR_OneSelect[(Integer A)] = True
          • Set T_US_TR_Unit[(Integer A)] = (Triggering unit)
        • Else - Actions
          • Set T_US_TR_OneSelect[(Integer A)] = False
  • For each (Integer A) from 1 to 4, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • T_US_TR_OneSelect[(Integer A)] Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: (OneSelectIsOn + (String((Integer A))))
        • Else - Actions
          • Game - Display to (All players) the text: (OneSelectIsOff + (String((Integer A))))
now the "unit" is fine but when i click on one turret i get
"
OneSelectIsOff1
OneSelectIsOff2
OneSelectIsOff3
OneSelectIsOff4
"
and click again after 3 sec
"
OneSelectIsOff1
OneSelectIsOn2
OneSelectIsOff3
OneSelectIsOff4
"
I have 0 Idea What is going on
in all my editing i never saw something like this? :eekani:
 
"So my goal is to see for each player(4 total) if they have selected one unit and to save that (one) unit"

The trigger is running on
  • Unit Group - Pick every unit in T_US_TR_Towers and do (Actions)
  • Loop - Actions
  • Trigger - Add to Tower Range Selection <gen> the event (Unit - (Picked unit) Is selected)
already given you the info you need

But wait...
Now i am using this
  • For each (Integer A) from 1 to 4, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units currently selected by (Player((Integer A))))) Equal to 1
        • Then - Actions
          • Set T_US_TR_OneSelect[(Integer A)] = True
          • Set T_US_TR_Unit[(Integer A)] = (Triggering unit)
        • Else - Actions
          • Set T_US_TR_OneSelect[(Integer A)] = False
  • For each (Integer A) from 1 to 4, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • T_US_TR_OneSelect[(Integer A)] Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: (OneSelectIsOn + (String((Integer A))))
        • Else - Actions
          • Game - Display to (All players) the text: (OneSelectIsOff + (String((Integer A))))
now the "unit" is fine but when i click on one turret i get
"
OneSelectIsOff1
OneSelectIsOff2
OneSelectIsOff3
OneSelectIsOff4
"
and click again after 3 sec
"
OneSelectIsOff1
OneSelectIsOn2
OneSelectIsOff3
OneSelectIsOff4
"
I have 0 Idea What is going on
in all my editing i never saw something like this? :eekani:

You use IntegerA on the two loops. Try using a custom integer in between loops.

After that post again the result.
 
Status
Not open for further replies.
Back
Top