1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  4. Dismiss Notice
  5. The Highway to Hell has been laid open. Come along and participate in the 5th Special Effect Contest.
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

How o make unit unselectable but also vulnerable?

Discussion in 'World Editor Help Zone' started by Marshmalo, Jul 29, 2012.

  1. Marshmalo

    Marshmalo

    Joined:
    Jul 1, 2008
    Messages:
    993
    Resources:
    5
    Icons:
    1
    Maps:
    4
    Resources:
    5
    Hi there, I'd like to know how to make a unit non-selectable/none-clickable while still being vulnerable?

    I know the locust ability makes them non-Selectable/non-lickable but also makes them vulnerable too, anyone help?
     
  2. claptomanic

    claptomanic

    Joined:
    Jul 10, 2011
    Messages:
    562
    Resources:
    0
    Resources:
    0
    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.
     
  3. edo494

    edo494

    Joined:
    Apr 16, 2012
    Messages:
    3,846
    Resources:
    5
    Spells:
    1
    JASS:
    4
    Resources:
    5
    • 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.
     
  4. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,127
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    You don't have to use a periodic event, edo494. Just use the "a player selects a unit event". It's far more efficient.
     
  5. HappyTauren

    HappyTauren

    Joined:
    Nov 3, 2006
    Messages:
    8,412
    Resources:
    87
    Models:
    61
    Icons:
    23
    Packs:
    1
    Tutorials:
    2
    Resources:
    87
    This can probably be fixed with model edit, though that might not be what you want.
     
  6. edo494

    edo494

    Joined:
    Apr 16, 2012
    Messages:
    3,846
    Resources:
    5
    Spells:
    1
    JASS:
    4
    Resources:
    5
    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
     
  7. Marshmalo

    Marshmalo

    Joined:
    Jul 1, 2008
    Messages:
    993
    Resources:
    5
    Icons:
    1
    Maps:
    4
    Resources:
    5
    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

    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?
     
  8. HappyTauren

    HappyTauren

    Joined:
    Nov 3, 2006
    Messages:
    8,412
    Resources:
    87
    Models:
    61
    Icons:
    23
    Packs:
    1
    Tutorials:
    2
    Resources:
    87
    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.
     

    Attached Files:

  9. KhaosMachine

    KhaosMachine

    Joined:
    Dec 30, 2011
    Messages:
    117
    Resources:
    6
    Spells:
    6
    Resources:
    6
    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
     
  10. edo494

    edo494

    Joined:
    Apr 16, 2012
    Messages:
    3,846
    Resources:
    5
    Spells:
    1
    JASS:
    4
    Resources:
    5
    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
     
  11. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,698
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    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.
     
  12. HappyTauren

    HappyTauren

    Joined:
    Nov 3, 2006
    Messages:
    8,412
    Resources:
    87
    Models:
    61
    Icons:
    23
    Packs:
    1
    Tutorials:
    2
    Resources:
    87
    Even in singleplayer, you will still see the selected unit for a few frames before it gets switched. I've solved this problem by disabling selection alltogether and selecting units via scripts, but if that obscures the way your map functions, there's no real way around this.
     
  13. defskull

    defskull

    Joined:
    Mar 27, 2008
    Messages:
    7,979
    Resources:
    17
    Spells:
    17
    Resources:
    17
    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.
     

    Attached Files:

  14. Marshmalo

    Marshmalo

    Joined:
    Jul 1, 2008
    Messages:
    993
    Resources:
    5
    Icons:
    1
    Maps:
    4
    Resources:
    5
    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.
     
  15. HappyTauren

    HappyTauren

    Joined:
    Nov 3, 2006
    Messages:
    8,412
    Resources:
    87
    Models:
    61
    Icons:
    23
    Packs:
    1
    Tutorials:
    2
    Resources:
    87
    Also, it's important to note that you can still select the unit if the drag selection is on. You will have to turn drag selection on in order to be truly unable to select it.