• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Is there anyway to remove the attack ability ?

Status
Not open for further replies.
Level 17
Joined
Jul 1, 2010
Messages
721
Yes it works that way but I wanted after a unit casts an ability the target unit to have the Cargo Hold then after 30 seconds to remove it from the target unit. However if I use "Target Unit of Ability being Cast" it doesn't work...
 
you need it gui right?
do this:
  • Custom script: local unit u = GetSpellTargetUnit()
  • Custom script: call UnitAddAbility( u, 'Abun')
  • Custom script: call TriggerSleepAction( 30.00 )
  • Custom script: call UnitRemoveAbility( u, 'Abun')
  • Custom script: set u = null
I write this from my head, if don't work, replace u and ability raw code places.

JASS:
local unit u = GetSpellTargetUnit() // We store target unit into local variable
call UnitAddAbility( u, 'Abun')  // We add 'Abun' (Cargo Hold) to unit
call TriggerSleepAction( 30.00 ) // Trigger wait action (jass version)
call UnitRemoveAbility( u, 'Abun') // We remove 'Abun' (Cargo Hold) to unit
set u = null // We null local unit (cleaning leaks)
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Chucky: You can test it and let us know if it's.

If it's not MUI (Multi Instanceable) you can create a unit group, a hashtable, and a loop trigger :p OR Work with custom values and some indexing system
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
MUI spells are those that works correctly even when multiple units casts them at the same time.

To create MUI abilities you have to create and handle things the most "generic" way, and leave the "hard work" to the game system. It's something like

· "Pick every Player in (All Players)" is better than doing 12 actions for Player 1, 2, 3...
· If you use "FlameStrike Caster = Triggering Unit" the variable will take a new value if some other unit casts it.
· Hashtables / JASS Locals / Avoiding Wait actions / A Good Indexing System / Using JASS Native Functions are suggestions (nearly "requirements") in order to create MUI Abilities.
· This is motly required for abilities with over time effect (Like Missile Moving, Damage over Time, Unit moving, etc.). Simple abilities like Finger of Death (Lion's Ultimate in DotA), Centaur's War Stomp, Panda's Clap, are instant and doesn't require anything to make them MUI.
 
Status
Not open for further replies.
Top