Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

SetUnitPropWindow --> DisableUnitMovement

Discussion in 'World Editor Help Zone' started by WaterKnight, Nov 4, 2011.

  1. WaterKnight

    WaterKnight

    Joined:
    Aug 18, 2009
    Messages:
    4,035
    Resources:
    5
    Maps:
    1
    Tutorials:
    4
    Resources:
    5
    That is the movement window of a unit and I do not have more precise information other than it somehow defines in which angle range to the facing the unit can walk in.

    If you set it to 0, which you can do ingame via
    SetUnitPropWindow

    then the unit cannot move anymore, not even straightforward, at least could not achieve this in test. However, it can still turn around. So I wonder if this would be a good replacement for the Ensnare-casting dummy, to render units immovable. I have not seen the use of it til yet so I ask.

    Advantages are that it is immediate, does not drag air units to the ground, has no buff display, does not interrupt channels, probably cheaper and almost no map changes a unit's prop window ingame, so you can use the function
    GetUnitDefaultPropWindow

    to restore the previous value without the need of a custom value assignment.

    Any downsides?
     
  2. andreasaspenberg

    andreasaspenberg

    Joined:
    Mar 2, 2010
    Messages:
    3,015
    Resources:
    0
    Resources:
    0
    that is way too advanced for me to make sense of but maybe if you explain it better i can help you. you could try to tell me what you want to accomplish.
     
  3. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,429
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    That sounds promising. However, what were the downsides of setting movement speed to 0 again?

    Although, if the prop window works without bugs, then it is the best option. I'll try testing it later.
     
  4. WaterKnight

    WaterKnight

    Joined:
    Aug 18, 2009
    Messages:
    4,035
    Resources:
    5
    Maps:
    1
    Tutorials:
    4
    Resources:
    5
    That the lowest possible speed is 1. If you do it via
    SetUnitMoveSpeed
    , this function will only affect the base speed but bonus effects stack nonetheless and you will also need to store the actual value and monitor/catch changes. Definitely, I see more projects using this function than
    SetUnitPropWindow
    . If you do it via ability, I guess Item: Movement Speed Bonus (AIms) is the only one without buff and it cannot reduce movement speed. Would also alter the display when hovering over unit's armor tooltip.

    @andreasaspenberg: To render a unit temporarily immovable during runtime but with turning and without hassles. Have looked through the forum. Most only were told that they should set min speed in gameplay constants to 0, which I have just said is not enough. Others proposed to use Entangling Roots, which is even worse than Ensnare, as it fiddles with additional unit interaction like disabling attack.
     
  5. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,174
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    I was testing that one day, giving units different prop window values. For some reason, I did it in GUI. Seeing this thread, I wondered how I did not experience the no-movement thing.

    Code (vJASS):
    function SetUnitPropWindowBJ takes unit whichUnit, real propWindow returns nothing
        local real angle = propWindow
        if (angle <= 0) then
            set angle = 1
        elseif (angle >= 360) then
            set angle = 359
        endif
        set angle = angle * bj_DEGTORAD

        call SetUnitPropWindow(whichUnit, angle)
    endfunction


    CURSE YOU GUI!

    This is really useful for my skill selection system.
    Pic

    [​IMG]


    I need to have the unit selected while in the screen to display comman card, but obviously I don't want it to move. Instead of using a trigger that catches all orders and stops the unit after a timer expires, I can just set prop window to 0. Neat.
     
  6. Frotty

    Frotty

    Wurst Reviewer

    Joined:
    Jan 1, 2009
    Messages:
    1,479
    Resources:
    11
    Models:
    3
    Tools:
    1
    Maps:
    5
    Tutorials:
    1
    Wurst:
    1
    Resources:
    11
    Also did a few tests, didnt find any downsides yet - so probably a clean and fast way.
     
  7. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,375
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    I wrote a script based on this in the last few days, which just keeps one system from enabling unit movement if another system still wants it disabled. I can say it works and this is a really fantastic find.
     
  8. Ironside

    Ironside

    Joined:
    Feb 3, 2009
    Messages:
    2,722
    Resources:
    4
    Maps:
    3
    Tutorials:
    1
    Resources:
    4
    Interesting find, although I prefer it to place a buff and effect (sure could be done via trigger).