• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Disable Right Click

Status
Not open for further replies.
Event:
A unit is issued an order with a point target

Condition:
Issued order equal to "smart"

Actions:
Issue immediate order "stop" to triggering unit.


This might not be enough if players spam-click somewhere. If you want it 100% free of exploits, you have to issue the stop order with a 0 second delay via a timer.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
In addition to Zwiebelchen's post:
You can create a Trigger, convert it to custom text and then place this inside it:
Then you can do a custom script: "call IssueImmediateOrderByIdDelayed(GetTriggerUnit(), OrderId("stop"), 0)"
JASS:
library DelayedOrder uses TimerIndex
    
    globals
        
        unit array      udg_DelayedOrder_WhichUnit
        integer array   udg_DelayedOrder_OrderId
        real array      udg_DelayedOrder_TargetPoint_X
        real array      udg_DelayedOrder_TargetPoint_Y
        widget array    udg_DelayedOrder_TargetWidget
        
    endglobals
    
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    function IssueImmediateOrderByIdCallback takes nothing returns nothing
        local timer t = GetExpiredTimer()
        local integer id = GetTimerData(t)
        call ReleaseIndexedTimer(t)
        
        call IssueImmediateOrderById(udg_DelayedOrder_WhichUnit[id], udg_DelayedOrder_OrderId[id])
        set udg_DelayedOrder_WhichUnit[id] = null
        set udg_DelayedOrder_OrderId[id] = 0
    endfunction
    function IssueImmediateOrderByIdDelayed takes unit whichUnit, integer order, real delay returns nothing
        local timer t = NewIndexedTimer()
        local integer id = GetTimerData(t)
        
        set udg_DelayedOrder_WhichUnit[id] = whichUnit
        set udg_DelayedOrder_OrderId[id] = order
        
        call TimerStart(t, delay, false, function IssueImmediateOrderByIdCallback)
        set t = null
    endfunction
    
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    function IssuePointOrderByIdCallback takes nothing returns nothing
        local timer t = GetExpiredTimer()
        local integer id = GetTimerData(t)
        call ReleaseIndexedTimer(t)
        
        call IssuePointOrderById(udg_DelayedOrder_WhichUnit[id], udg_DelayedOrder_OrderId[id], udg_DelayedOrder_TargetPoint_X[id], udg_DelayedOrder_TargetPoint_Y[id])
        set udg_DelayedOrder_WhichUnit[id] = null
        set udg_DelayedOrder_OrderId[id] = 0
        set udg_DelayedOrder_TargetPoint_X[id] = 0.
        set udg_DelayedOrder_TargetPoint_Y[id] = 0.
    endfunction
    function IssuePointOrderByIdDelayed takes unit whichUnit, integer order, real x, real y, real delay returns nothing
        local timer t = NewIndexedTimer()
        local integer id = GetTimerData(t)
        
        set udg_DelayedOrder_WhichUnit[id] = whichUnit
        set udg_DelayedOrder_OrderId[id] = order
        set udg_DelayedOrder_TargetPoint_X[id] = x
        set udg_DelayedOrder_TargetPoint_Y[id] = y
        
        call TimerStart(t, delay, false, function IssuePointOrderByIdCallback)
        set t = null
    endfunction
    
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    function IssueTargetOrderByIdCallback takes nothing returns nothing
        local timer t = GetExpiredTimer()
        local integer id = GetTimerData(t)
        call ReleaseIndexedTimer(t)
        
        call IssueTargetOrderById(udg_DelayedOrder_WhichUnit[id], udg_DelayedOrder_OrderId[id], udg_DelayedOrder_TargetWidget[id])
        set udg_DelayedOrder_WhichUnit[id] = null
        set udg_DelayedOrder_OrderId[id] = 0
        set udg_DelayedOrder_TargetWidget[id] = null
    endfunction
    function IssueTargetOrderByIdDelayed takes unit whichUnit, integer order, widget targetWidget, real delay returns nothing
        local timer t = NewIndexedTimer()
        local integer id = GetTimerData(t)
        
        set udg_DelayedOrder_WhichUnit[id] = whichUnit
        set udg_DelayedOrder_OrderId[id] = order
        set udg_DelayedOrder_TargetWidget[id] = targetWidget
        
        call TimerStart(t, delay, false, function IssueTargetOrderByIdCallback)
        set t = null
    endfunction
    
endlibrary
 
Level 7
Joined
Nov 19, 2015
Messages
283
If you want a unit to simply stop moving you can get a dummy unit to cast ensnare. They can still spin around on the spot, attack and cast spells. Remove the buff to end.

Another method is to change the channel ability. Change the base order ID to smart, Options to universal spell and target type to point target. All right clicks by that unit can be detected when they cast that spell. Add and remove the ability to toggle on and off.

I think its slightly better than just stopping the order once it is given. Since spam clicking sometimes can bypass it.
 
Level 7
Joined
Nov 19, 2015
Messages
283
Here's the method kingkwong described. . . I am amazed you knew that handy hidden feature, I was planning to reveal that in a couple weeks.

Just add the *custom* channel(Disable Right-Click named) ability to any unit/hero you want right-click disabled on.

I was surprized I knew something too lol :D
I learnt this a while ago from thehelper.net and using it in my current map.

I want to try help on the threads too but usually I don't have a solution or someone else is there first. So I'm glad I was able to offer some innovative solutions :thumbs_up:
 
Another method is to change the channel ability. Change the base order ID to smart, Options to universal spell and target type to point target. All right clicks by that unit can be detected when they cast that spell.
What is the advantage of this over checking for the "smart" order in combination with an order event? Seems like a pointless workaround for a problem that doesn't even exist to me.
 
Doesn't require any code/triggers for constant detection so it creates less strain on everyone's computers.
So just adding this ability would already cause the unit to stop moving? No triggers at all? If so, that's just neato!
Does it still work with the channel ability hidden (or without the "visible" flag in the OE)?
 
Level 7
Joined
Nov 19, 2015
Messages
283
It actually still allows the unit to move but removes the right click which is what was asked for.

The unit can still move if the player wanted the unit to.
 
So just adding this ability would already cause the unit to stop moving? No triggers at all? If so, that's just neato!
Does it still work with the channel ability hidden (or without the "visible" flag in the OE)?

If you made 3 more to block attack,move,patrol then yes the unit wouldn't be able to move anymore unless aggro'd. Yeah it is pretty neat, a well-kept secret for a long time until now. :grin:

Yeah I don't see why not.
 
If you made 3 more to block attack,move,patrol then yes the unit wouldn't be able to move anymore unless aggro'd. Yeah it is pretty neat, a well-kept secret for a long time until now. :grin:

Yeah I don't see why not.
That's so cool.

Does the unit still turn towards the target if you right-click?

Might be a nice alternative to pausing units.
 
Status
Not open for further replies.
Top