• 🏆 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!

Whats wrong with fucking selection/Deseletion, shit...

Status
Not open for further replies.
Level 15
Joined
Nov 30, 2007
Messages
1,202
Whats wrong with selection/Deseletion...

I have been pulling my hairs out for hours and distilled my problem for you here:

  • select
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
      • b Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Town Hall
        • Then - Actions
          • Game - Display to (All players) the text: Selected: City
          • Set b = False
          • Selection - Select Farm 0001 <gen>
          • Set b = True
        • Else - Actions
          • Game - Display to (All players) the text: Selected: Other
  • deselet
    • Events
      • Player - Player 1 (Red) Deselects a unit
    • Conditions
      • b Equal to True
    • Actions
      • Game - Display to (All players) the text: Deselect
Basically I don't want Selection - Select Farm 0001 <gen> to be registered , thus b is set to false. But... for some ungodly reason it still goes through. And laughingly informs me that yes, a city was selected and deselected and then another unit was selected....
 
Last edited:
Level 12
Joined
Feb 22, 2010
Messages
1,115
That is probably because of delay with selection event.Try adding a wait action before "set b = true" to test it.
 
Level 15
Joined
Nov 30, 2007
Messages
1,202
That is probably because of delay with selection event.Try adding a wait action before "set b = true" to test it.

Yep that was it:

  • select
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
      • b Equal to True
    • Actions
      • Set u[1] = u[0]
      • Set u[0] = (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • u[1] Not equal to u[0]
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal to Town Hall
            • Then - Actions
              • Set b = False
              • Selection - Select Farm 0001 <gen>
              • Wait 0.00 seconds
              • Set b = True
              • Game - Display to (All players) the text: Selected: City
            • Else - Actions
              • Game - Display to (All players) the text: selected other
        • Else - Actions
          • Game - Display to (All players) the text: same selection found
 
Level 15
Joined
Nov 30, 2007
Messages
1,202
You can try just to directly filter the unit or unit type:

Code:
Event:
    Player selects a unit

Condition:
    TriggeringUnit != Farm 0001 <gen>

Action:

I did something of the sorts, the problem was more complicated then what i showed, but the issue was the same. Anyway, have finally solved it. (No TriggerSleepAction, if thats what you were worried about.)
 
Status
Not open for further replies.
Top