SC2Mapster Forums

Development > Triggers

make a unit not being deselectible (Solved)

  • 6 posts
    #1 Mar 25, 2012 at 19:28 UTC - 0 likes

    HI, i am working on a map on which each player only controls one unit.

    i just spent an hour+ to figure out a way to make it that players cannot select anything else but their unit. i neither could figure out a way to do this in data editor, nor in the trigger editor (in which i guess this is propably easier to do).

    as i just watched some tutorials and used the sf in the forum but failed to find sth of use for solving my problem.

    i'd like to know if s.o. can come up with a way to do this?

    thx

    Last edited Mar 25, 2012 by IcyJay
    #2 Mar 25, 2012 at 20:08 UTC - 0 likes

    Try this code. It forces selection by selecting the unit that you want undeselectable whenever you select any unit.

    Make Unit Un-Deselectable
        Events
            Unit Selection - Any Unit is Selected by player Any Player
        Local Variables
        Conditions
        Actions
            Unit Selection - Select (Hero Unit) for player 1
    

    Trigger Libraries:
    Leaver Resource Redistribution | Disables resource redistribution when player leaves
    Developer's Mode | Triggers useful for map testing

    #3 Mar 25, 2012 at 20:27 UTC - 0 likes

    as you believe it or not. i tried THIS EXACT trigger code on a test map and it did not work for some reason.

    two problems: - when i select another unit, my hero unit will be added to that selection, meaning i have two units selected (i could insert a deselect command) - this does only work on the players own units. as soon as an enemy unit is being selected the 'select hero unit' thingy doesnt trigger anymore

    what now

    #4 Mar 25, 2012 at 20:33 UTC - 0 likes

    @xKenneth: Go

    Unit Selection - Any Unit is Selected by player Any Player

    Did you mean Any Unit is Deselected by player Any Player?

    What if you add a Condition that says "Owner of Player = (Player #)" and another that says Triggering Unit = (Unit)

    Last edited Mar 25, 2012 by Mesden
    #5 Mar 25, 2012 at 20:57 UTC - 0 likes
    Quote from IcyJay: Go

    as you believe it or not. i tried THIS EXACT trigger code on a test map and it did not work for some reason.

    two problems: - when i select another unit, my hero unit will be added to that selection, meaning i have two units selected (i could insert a deselect command) - this does only work on the players own units. as soon as an enemy unit is being selected the 'select hero unit' thingy doesnt trigger anymore

    what now

    Don't get what you mean. Works for me.

    Name Size MD5
    Undeselectable.SC2Map 35.2 KiB de4765c9f9a7...
    #6 Mar 25, 2012 at 23:38 UTC - 0 likes

    alright i got it working. i didnt include the deselect unit group part.

    thanks for the map example

  • 6 posts

You must login to post a comment. Don't have an account? Register to get one!