• 🏆 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] Unit selection Marker

Status
Not open for further replies.
Level 7
Joined
Sep 19, 2012
Messages
204
Hey Guys,

Me again with a trigger problem...

I try to create a trigger that marks Slots (units) around the selected one, to show the player wich buildings would be affected by the currently selected one.
My version works fine when you select a single slot, but it bugs out and leaves behind markers that dont get removed, when you double click.
Any ideas how i could upgrade this thing so it works with double click as well?
  • Slot Selection
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 2 (Blue) Selects a unit
      • Player - Player 3 (Teal) Selects a unit
      • Player - Player 4 (Purple) Selects a unit
      • Player - Player 5 (Yellow) Selects a unit
      • Player - Player 6 (Orange) Selects a unit
    • Conditions
      • ((Triggering unit) is A structure) Equal to True
      • (Build Area <gen> contains (Triggering unit)) Equal to True
    • Actions
      • Set temp_integer2 = 1
      • Set temp_group = (Units within 500.00 of (Position of (Triggering unit)))
      • Unit Group - Pick every unit in temp_group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Not equal to (Picked unit)
            • Then - Actions
              • Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Other\GeneralAuraTarget\GeneralAuraTarget.mdl
              • Set temp_selection[temp_integer2] = (Last created special effect)
              • Set temp_integer2 = (temp_integer2 + 1)
            • Else - Actions
      • Custom script: call DestroyGroup (udg_temp_group)
  • Slot Deselection
    • Events
      • Player - Player 1 (Red) Deselects a unit
      • Player - Player 2 (Blue) Deselects a unit
      • Player - Player 3 (Teal) Deselects a unit
      • Player - Player 4 (Purple) Deselects a unit
      • Player - Player 5 (Yellow) Deselects a unit
      • Player - Player 6 (Orange) Deselects a unit
    • Conditions
      • ((Triggering unit) is A structure) Equal to True
      • (Build Area <gen> contains (Triggering unit)) Equal to True
    • Actions
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Special Effect - Destroy temp_selection[(Integer A)]
 
Level 12
Joined
Mar 24, 2011
Messages
1,082
I am not 100% sure if Selection/De-selection event works with double click/drag/adding/removing selection/switching focus.

  • For each (Integer A) from 1 to 4, do (Actions)
    • Loop - Actions
      • Special Effect - Destroy temp_selection[(Integer A)]
Why are you destroying only 4 ? Shouldn't this be temp_integer2

  • Set temp_integer2 = 1
remove this from selection trigger and move it to de-selection trigger

Try those changes.

Also, your trigger will NOT work with multiple players. you may want to re-design & re-think a little bit.

PS:
Why are you not using the 0 index ? Use the 0 index. Instead of
For each (Integer A) from 1 to X
do:
For each (Integer A) from 0 to X
and:
Set temp_integer2 = 0

Also, don't use Integer A, use a custom integer variable instead.
 
Last edited:
Level 7
Joined
Sep 19, 2012
Messages
204
I am not 100% sure if Selection/De-selection event works with double click/drag/adding/removing selection/switching focus.

  • For each (Integer A) from 1 to 4, do (Actions)
    • Loop - Actions
      • Special Effect - Destroy temp_selection[(Integer A)]
Why are you destroying only 4 ? Shouldn't this be temp_integer2

  • Set temp_integer2 = 1
remove this from selection trigger and move it to de-selection trigger

Try those changes.

Also, your trigger will NOT work with multiple players. you may want to re-design & re-think a little bit.

PS:
Why are you not using the 0 index ? Use the 0 index. Instead of
For each (Integer A) from 1 to X
do:
For each (Integer A) from 0 to X
and:
Set temp_integer2 = 0

Also, don't use Integer A, use a custom integer variable instead.

Thank you so much. Those two small fixes made it work! :grin:

i already know that this doesnt work for multiple players...just wanted to find a way it works at all before i build it for all players :ugly:

Regarding Index 0...no Clue what i was thinking there :vw_wtf:
 
Level 13
Joined
May 10, 2009
Messages
868
I am not 100% sure if Selection/De-selection event works with double click/drag/adding/removing selection/switching focus.
Yes, mainly "select" event. It fires when a player even re-selects a unit. Area selection will force the "deselect" event to fire, and re-select units all over again, and also adding new units to selection. I'm not sure about the "focus" part. If by "focus" you mean hitting tab through all selected units, then no.
 
Level 12
Joined
Mar 24, 2011
Messages
1,082
Yes, mainly "select" event. It fires when a player even re-selects a unit. Area selection will force the "deselect" event to fire, and re-select units all over again, and also adding new units to selection. I'm not sure about the "focus" part. If by "focus" you mean hitting tab through all selected units, then no.
Exactly what I meant. Cheers!
 
Status
Not open for further replies.
Top