• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Lock the Selection of One Unit?

Status
Not open for further replies.
Level 6
Joined
Dec 9, 2014
Messages
176
I'd like to lock the selection to my hero. By this I mean I'd like to make it so that when clicking on other things my selection stays on the hero. This way I can set things like quest givers to be selected and activate without losing the hero selection. Is there any way to do this?

Edit: So I just tried this:

  • Selection Locking
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Selection - Select Sorceress for Player 1 (Red)
      • Selection - Select Wizard for Player 1 (Red)
That almost worked... until I tried to cast a targeting spell. seems it reselects my hero before I can do anything with the spell. So I think what I need is a condition that checks to make sure the hero is not already selected, if the hero isn't selected then it selects it. Making this immediate however would not allow triggers that use the selection event to work. So, maybe a condition along with a very tiny wait?

Edit: Getting closer! This worked perfectly for the Sorceress but failed for the Wizard. I really hope I don't have to set both heroes to the same variable in order for this to work. Hmm, maybe an If, Then, Else thingy will work better.

  • Selection Locking
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
    • Actions
      • Wait 0.05 seconds
      • Selection - Select Sorceress for Player 1 (Red)
      • Selection - Select Wizard for Player 1 (Red)
 
Last edited:
Level 21
Joined
Aug 13, 2011
Messages
739
You could do:
  • Actions
    • Game - Disable selection and deselection functionality (Enable selection circles)
    • Selection - Select Unit for Player 1 (Red)
All you have to do is enable the selection/deselection funtionality again if you want the player to be able to select other things. The unit has to be selected for the player after selection is disabled.
 
Level 6
Joined
Dec 9, 2014
Messages
176
Hmm, That sounds like a pain in the butt lol. Selection is going to activate a lot of things throughout the game, twould suck to have to enable it and then disable it everytime. Let me try setting a If, Then, Else on the heroes and see if that works.
 
Level 21
Joined
Aug 13, 2011
Messages
739
Or use an interaction skill which can be cast on NPCs to talk to them. Then you can use the casting distance to be how close you want the unit to the NPC to be able to talk to them as well.
 

Attachments

  • Interact Skill.w3x
    8.9 KB · Views: 59
Level 6
Joined
Dec 9, 2014
Messages
176
Or use an interaction skill which can be cast on NPCs to talk to them. Then you can use the casting distance to be how close you want the unit to the NPC to be able to talk to them as well.

Hmmm, question! Is there someway to check to make sure the unit being selected is a unit and not an ability or item?

Edit: Well, The interact button may be a better choice. My only issue is it taking up spell space I plan to use for Spell Books and what not. I got to thinking that I kinda want the player to be able to select other things, the reason why is to see what their name and info is.
 
Last edited:
Level 24
Joined
Aug 1, 2013
Messages
4,657
This is a bit modified rip from one of my AOS/MOBA maps.
You are only allowed to select units that are owned by you.
You can still select units but your selection will reset.

  • Selection GUI
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Set TempPlayer = (Picked player)
          • Set TempUnitGroup = (Units currently selected by TempPlayer)
          • Set TempUnit = (Random unit from TempUnitGroup)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of TempUnit) Not equal to TempPlayer
            • Then - Actions
              • Selection - Clear selection for TempPlayer
              • Selection - Add Heroes[(Player number of TempPlayer)] to selection for TempPlayer
            • Else - Actions
          • Custom script: call DestroyGroup(udg_TempUnitGroup)
You could replace the if - then - else condition to "TempUnit not equal to ..."
Or to whatever you want.

You could also do it like this (not tested):
  • Selection Simple
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 2 (Blue) Selects a unit
      • Player - Player 3 (Teal) Selects a unit
    • Conditions
    • Actions
      • Set TempPlayer = (Triggering player)
      • Set TempUnitGroup = (Units currently selected by TempPlayer)
      • Set TempUnit = (Random unit from TempUnitGroup)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of TempUnit) Not equal to TempPlayer
        • Then - Actions
          • Selection - Clear selection for TempPlayer
          • Selection - Add Heroes[(Player number of TempPlayer)] to selection for TempPlayer
        • Else - Actions
      • Custom script: call DestroyGroup(udg_TempUnitGroup)
 
Level 6
Joined
Dec 9, 2014
Messages
176
I can't seem to get the interact to work with conditions. I'd like to make it so that casting Interact on different units will produce different things they say. I can't seem to figure out what I did wrong here, any help is much appreciated.

  • Interact
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Interact
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Targeted unit) Equal to Captain Tybalt |cffffcc003|r 0005 <gen>
        • Then - Actions
          • Set InteractRoll = (Random integer number between 1 and 100)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • InteractRoll Greater than or equal to 1
              • InteractRoll Less than or equal to 35
            • Then - Actions
              • Game - Display to Player Group - Player 1 (Red) the text: |cff7777aaCapt Tyba...
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • InteractRoll Greater than or equal to 36
              • InteractRoll Less than or equal to 50
            • Then - Actions
              • Game - Display to Player Group - Player 1 (Red) the text: |cff7777aaCapt Tyba...
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • InteractRoll Greater than or equal to 51
              • InteractRoll Less than or equal to 70
            • Then - Actions
              • Game - Display to Player Group - Player 1 (Red) the text: |cff7777aaCapt Tyba...
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • InteractRoll Greater than or equal to 71
              • InteractRoll Less than or equal to 85
            • Then - Actions
              • Game - Display to Player Group - Player 1 (Red) the text: |cff7777aaCapt Tyba...
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • InteractRoll Greater than or equal to 86
              • InteractRoll Less than or equal to 100
            • Then - Actions
              • Game - Display to Player Group - Player 1 (Red) the text: |cff7777aaCapt Tyba...
            • Else - Actions
        • Else - Actions
 
Status
Not open for further replies.
Top