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

How o make unit unselectable but also vulnerable?

Status
Not open for further replies.
Level 9
Joined
Jul 10, 2011
Messages
562
why you trying to get this? it should be vurnable but not being able to get target of a spell or being target to attack Oo that makes no sense for me.


never the less you would have to trigger it. means you have to register whether its selected, target of a spell or an attack order is set and then stop the orders or deselect it.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
  • Events
    • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • For each (Integer A) from 1 to 12, do (Actions)
      • Loop - Actions
        • Selection - Remove your unit from selection for (Player((Integer A)))
However you need to set the unit to some variable.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
Didnt know there is such an event :D
well then:
  • trigger1
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Trigger - Add to trigger2 <gen> the event (Player - (Player((Integer A))) Selects a unit)
  • trigger2
    • Events
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to whichunit
    • Actions
      • Selection - Remove (Triggering unit) from selection for (Triggering player)
Ive tested it and it works but its not fast enough so if you are fast enough you can order the unit to move or attack.

edit:
actually even
  • anothertrigger
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Selection - Remove Footman 0000 <gen> from selection for (Player((Integer A)))
is too slow to keep the unit, however you can do something like
  • anothertrigger
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Selection - Remove Footman 0000 <gen> from selection for (Player((Integer A)))
          • Unit - Order Footman 0000 <gen> to Stop
Just so you know.
Also it really depends what you want the unselectable unit to do
 
Level 7
Joined
Jul 1, 2008
Messages
1,025
Thanks Edo! I will test this now, I basically want unit to still be able to take damage but not be able to be ordered around or clickable

This can probably be fixed with model edit, though that might not be what you want.

Happy, how come? I only asking because I also imported a model into my map but for some reason its not selectable, what is it about a model which make sit non selectable and can it be done using magos model editor?
 
It's this one field, keep in mind that collision objects also affect clickability. If you don't know what they are, there is a lot of info on google (mostly because of DotA selection issues).

As for the "unselectable" field in the geoset dialog, it is, aside from collision objects, responsible for the fact that you can't select hero glow.
 

Attachments

  • Unselectable.jpg
    Unselectable.jpg
    88.7 KB · Views: 319
Level 8
Joined
Dec 30, 2011
Messages
134
Didnt know there is such an event :D
well then:
  • trigger1
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Trigger - Add to trigger2 <gen> the event (Player - (Player((Integer A))) Selects a unit)
  • trigger2
    • Events
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to whichunit
    • Actions
      • Selection - Remove (Triggering unit) from selection for (Triggering player)
Ive tested it and it works but its not fast enough so if you are fast enough you can order the unit to move or attack.

edit:
actually even
  • anothertrigger
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Selection - Remove Footman 0000 <gen> from selection for (Player((Integer A)))
is too slow to keep the unit, however you can do something like
  • anothertrigger
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Selection - Remove Footman 0000 <gen> from selection for (Player((Integer A)))
          • Unit - Order Footman 0000 <gen> to Stop
Just so you know.
Also it really depends what you want the unselectable unit to do

lol, you have to be ULTRA SUPER QUICKLY for that man. And the periodic action makes some lag into the game, that is a bad way
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
with selection event you really do not unless you order the unit to stop or attack back what it was attacking, ive tested it and its more then .1 because Ive successfully ordered the unit to move multiple times in row

one .01 timer created 0 fps drop on my computer when i was running it
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
You don't have to use a periodic event, edo494. Just use the "a player selects a unit event". It's far more efficient.
This only works in single player. The player selects unit event generates an asynchronous event (from a local response) which means that there is a delay in multiplayer games between the unit being selected and the event firing as it has to be synchronized. The result is that you will have the unit selected for a few frames before the trigger fires to unselect it. Worse still is that multiple selection of the unit may cause buggy results as the event might be triggered multiple times during the delay.

There is no real way to do this in WarCraft III next to inefficient iteration every frame. In StarCraft II this is done very easily and is demonstrated by melee interceptors.

You might wish to try abusing various locust restoration methods to try and achieve the effect but I am not sure if one exists that gives the result you want and in nay case this is highly bug prone.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
There are 2 types of "selecting" unit(s);
- Click
- Drag-select

When you add Locust to the unit and remove it (in special way), it disables you to Click that unit, okay first thing is done.

Now, to remove the Drag-select, you need to do this;
  • Game - Disable drag-selection functionality (Enable drag-selection box)
Since that action affects all player in that map, you can use this;
  • Actions
    • Custom script: if GetLocalPlayer() == Player(0) then
    • Game - Disable drag-selection functionality (Enable drag-selection box)
    • Custom script: endif
That will only affect a certain Player

Let's say you want Player 1 to not drag-select or click Player 2 units that has Locust, use that GetLocalPlayer as Player(0) since in JASS, Player(0) = Player 1 in GUI.

Here's a test map for you to understand more better.

But since you have disabled the drag-select, it will affect your units too, it's the drawback.
 

Attachments

  • test8.w3x
    12.7 KB · Views: 60
Level 7
Joined
Jul 1, 2008
Messages
1,025
hmm I see, thank you all for the help, it seems there is no easy around this especially for someone like me with no advanced knowledge of world editor triggers.

There is where the limitations of world editor really seem to come into play. I have gone with Happy Taurens simple suggestion and created an unselectable model version of my unit and intend to switch it via replace unit when i want the unit to be unselectable.

Thanks for everyones great help! I've certainly learned alot about the editor here.
 
Status
Not open for further replies.
Top