• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

How to disarm a single unit (not aoe)

Status
Not open for further replies.

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
You could also try casting silence on it with a very small AoE, however the above suggesting would be better (if it works).

People also mentioned things like removing the attack ability but I forget if this stops them attacking or just hides the attack command card button.
 
Level 12
Joined
Oct 16, 2010
Messages
680
Have you seen the untouched values of a single target drunken haze? The area of effect is 10.

even a single target spell can be an aoe spell, these two aren't exclusive. there is no need for that 10 aoe.
for example
if the unit with disabled pathing(like WW) is targeted there is a chance an other unit will get cought in the fire. Rare situation but could occur:p
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
Yes I know. Have you seen the untouched values of a single target drunken haze? The area of effect is 10.
There is no such Drunken Haze ability. There is only the one used by Pandaren Brewmaster and also Chen's version which has 4 levels and slightly different values in some fields. However both have 200.00 AoE range by default.
There is no other Drunken Haze ability nor is there any such ability with 10.00 AoE.

Also, even the 10.00 range is problematic. Drunken Haze affects both ground and air units which are within range of the target. So if air unit happens to be nearby the target, which for 10.00 range is about right above it, both units get affected.
With 0.00 range, only the target is affected.
 
Wanted offer an alternative solution, since silence can technically be dispelled, so instead by making the unit's spells cost tons of mana you can effectively silence them without it being able to be dispelled. Here I've set the additional mana costs to be 20000, which is more than any unit can have on most maps.

JASS:
//Helper function to add the mana

   function SpellAddTonsOfMana takes integer spell, unit u returns nothing
        local integer i
        set i = BlzGetAbilityIntegerField(BlzGetUnitAbility(u, spell), ABILITY_IF_LEVELS)
        loop
            exitwhen i == - 1
            call BlzSetUnitAbilityManaCost(u, spell, i, BlzGetUnitAbilityManaCost(u, spell, i) + 20000)
            set i = i - 1
        endloop
    endfunction
 

//Helper function to remove the added mana

    function SpellRemoveTonsOfMana takes integer spell, unit u returns nothing
        local integer i
        set i = BlzGetAbilityIntegerField(BlzGetUnitAbility(u, spell), ABILITY_IF_LEVELS)
        loop
            exitwhen i == - 1
            call BlzSetUnitAbilityManaCost(u, spell, i, BlzGetUnitAbilityManaCost(u, spell, i) - 20000)
            set i = i - 1
        endloop
    endfunction


//Silence requires explicitly adding all the abilities that may need to be silence per unit
// but since this function only applies to one unit you can make a comprehensive list of all abilities here for all the units you want
// to silence as adding mana to abilities they don't have will have no effect on them

function SilenceUnit takes unit u returns nothing
    local integer abl
    abl = 'A001'    //Death Coil
    call SpellAddTonsOfMana(abl, u)
    abl = 'A0F4'    //Carrion Swarm
    call SpellAddTonsOfMana(abl, u)
    abl = 'A03M'    //DeathPact
    call SpellAddTonsOfMana(abl, u)
    abl = 'AUan'    //Animate Dead
    call SpellAddTonsOfMana(abl, u)
endfunction


//Un-Silence requires explicitly adding all the abilities that may need to be silence

function RemoveSilenceUnit takes unit u returns nothing
    local integer abl
    abl = 'A001'    //Death Coil
    call SpellRemoveTonsOfMana(abl, u)
    abl = 'A0F4'    //Carrion Swarm
    call SpellRemoveTonsOfMana(abl, u)
    abl = 'A03M'    //DeathPact
    call SpellRemoveTonsOfMana(abl, u)
    abl = 'AUan'    //Animate Dead
    call SpellRemoveTonsOfMana(abl, u)
endfunction
Then simply call in the silencing spell's or silence on region enter/leave trigger
JASS:
SilenceUnit(GetTriggerUnit())  //  GetEnteringUnit(), GetLeavingUnit()  ect...
//put a wait here or another coded delay
RemoveSilenceUnit(GetTriggerUnit())
and voila you have another version of silence! ❕
 
Last edited:
This thread is 8 years old... You are using trigger functions that did not even exist back when it was created!

Probably should start a new thread for this kind of thing. Possibly a JASS resource.
True it's a necro, but when I did a google search for this exact problem this was the first thread to come up. Figured it was better to just drop the answer here than try and create a competing thread for future searches.
 

Uncle

Warcraft Moderator
Level 70
Joined
Aug 10, 2018
Messages
7,407
True it's a necro, but when I did a google search for this exact problem this was the first thread to come up. Figured it was better to just drop the answer here than try and create a competing thread for future searches.
We can Disable/Enable specific abilities now, I don't think there's a need to mess with Mana Costs.

For Disarm, you can add the Cargo Hold ability to a unit.
 
Last edited:
Level 26
Joined
Aug 18, 2009
Messages
4,097
For Disarm, you can add the Cargo Hold ability to a unit.
For clarification: The "Cargo Hold (Orc Burrow)" (Abun) ability is meant here, which is different from other Cargo Hold abilities.
But you do not need this anymore, either. You can directly disable the "Attack" (Aatk) ability with BlzUnitDisableAbility.

BlzUnitDisableAbility(unit, 'Aatk', true, false)

or

BlzUnitDisableAbility(unit, 'Aatk', true, true)

if you also want to hide the button(s).
 
Status
Not open for further replies.
Top