• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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:
Level 37
Joined
Jul 22, 2015
Messages
3,485
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?
 
Level 3
Joined
May 7, 2016
Messages
38
"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:
 
Level 6
Joined
Feb 5, 2012
Messages
1,685
"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.
 
Level 3
Joined
May 7, 2016
Messages
38
Those are 2 loops that have 0 to do with each other
found it...
when you select ("Units currently selected by player(Integer A)")Unit Group
it says on the bottom "This should not be used in trigger consitions."
That ******* sucks
 
Status
Not open for further replies.
Top