• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Simple MUI Help

Status
Not open for further replies.
Level 11
Joined
Aug 11, 2009
Messages
594
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,240
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
594
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
594
I will show you in a picture :)
 

Attachments

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