• 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.

Simple MUI Help

Status
Not open for further replies.
Level 11
Joined
Aug 11, 2009
Messages
605
So I have started exploring some MUI triggering but still have much to learn. Something I dont know how to do is this simple spell (which probably is very simple and I will facepalm myself when seeing how to do it).

When a Hero casts an ability he gets a passive ability for 5 seconds, which is removed after the duration.

It should not replace any spell, just add a new one for 5 seconds. And ofcourse be MUI so several players with the same Hero can cast it and still work.

Thanks for any help on this.
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
local unit u = GetTriggerUnit()
call UnitAddAbility(u, 'A000')
call TriggerSleepAction(5)
call UnitRemoveAbility(u, 'A000')
set u = null

All in custom scripts. The A000 should be replaced with the raw code of the ability.

Or create a timer for the hero when the ability is cast. Start it, register the expiration for a trigger. When the timer expires, remove the ability. There's no need to destroy the timer, since it is likely that it will be used again. So check whether the timer exists or not before creating one. You can "attach" the unit to the timer by saving the handle id of the unit for the timer into a hashtable.
 
Level 11
Joined
Aug 11, 2009
Messages
605
Got error on every custom script when using those texts :/ changed the A000 to the right value. What is the "u"? a variable?
 
Level 11
Joined
Aug 11, 2009
Messages
605
I will show you in a picture :)
 

Attachments

  • Error.jpg
    Error.jpg
    153.6 KB · Views: 91
Status
Not open for further replies.
Top