• 🏆 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!

Remove stun by triggers?

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
This is just a guess, since I don't have time right now to test. Stun buff says: Stun (Paused). But the Buff is only a visual effect, has no effect on the units function, the skill does though. You have to remove the Skill effect, no the buff.

Unit - Remove Buff must work: It will only remove the special effect and the buff, but the unit will remain Stunned.

To remove the real stun (and the buff at the same time) try using Unit - Pause/Unpause. (Off course: Unpause the unit)
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
Oh my gosh! The buff removing now works -.- ! Actually my true a new problem with my spell appears...

My spell, called 'Evil Kiss' needs to stun the target for 10 seconds, but there is 5% chance per second for the effect to break...

And when i cast it, every time the stun has been removed right when i cast the spell...

I will upload my map... can someone help me with that? (check my triggers! btw the Evil kiss spell owns the 'Spider Queen')
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
The game engine handles buffs by giving the unit an ability with the same ID as the buff set in the object editor. This dummy ability maintains the effect of the buff. By removing this ability (with the ID of the buff object) it will remove the buff and any effects the buff was giving.

As far as I know, this process is mono directional. You can not add a buff like you can normal abilities yet you can remove a buff like you do normal abilities.
 
Level 10
Joined
Jun 6, 2007
Messages
392
Here's how I would do it:

  • EK Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Evil Kiss
    • Actions
      • Hashtable - Save "chance" as 0 of (Key (Target unit of ability being cast)) in EK_Hash
      • Set TempPoint = (Target point of ability being cast)
      • Unit - Create 1 Dummy Unit for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
      • Unit - Hide (Last created unit)
      • Unit - Add a 3.00 second Generic expiration timer to (Triggering unit)
      • Unit - Add EK_DummyAbility to (Last created unit)
      • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Target unit of ability being cast)
      • Unit Group - Add (Triggering unit) to EK_Group
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Trigger - Turn on EK Remove Buff <gen>
  • EK Remove Buff
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in EK_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 100) Less than (Load 0 of (Key (Picked unit)) from EK_Hash)
              • ((Picked unit) has buff EK_Buff) Equal to False
            • Then - Actions
              • Unit - Remove EK_Buff buff from (Picked unit)
              • Unit Group - Remove (Picked unit) from EK_Group
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in EK_Hash
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in EK_Group) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
EK Remove Buff trigger is initially off, and "chance" means the chance to awaken per second. I hope I didn't forget anything, I wrote this in a little hurry.
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
Thanks! But i want to ask another thing - is it possible for the hashtables to bug my spell? Cuz i actually don't want it MUI :D all my other spells are not MUI because only one unit will use them... so i just want to ask if the hashtables can give such bugs?

Thanks for the support, Dr Super Good and Erkki2! :)
 
Level 10
Joined
Jun 6, 2007
Messages
392
Now I had time to test it, and as I should have guessed, it was full of bugs :p
Here's the fixed version:
  • EK Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Evil Kiss
    • Actions
      • Hashtable - Save 30 as 0 of (Key (Target unit of ability being cast)) in EK_Hash
      • Set TempPoint = (Target point of ability being cast)
      • Unit - Create 1 DummyUnit for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
      • Unit - Hide (Last created unit)
      • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
      • Unit - Add EK_DummyAbility to (Last created unit)
      • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Target unit of ability being cast)
      • Unit Group - Add (Target unit of ability being cast) to EK_Group
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Trigger - Turn on EK Remove Buff <gen>
  • EK Remove Buff
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in EK_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Random integer number between 1 and 100) Less than (Load 0 of (Key (Picked unit)) from EK_Hash)
                  • ((Picked unit) has buff EK_Buff (Pause)) Equal to False
            • Then - Actions
              • Unit - Remove EK_Buff (Pause) buff from (Picked unit)
              • Unit Group - Remove (Picked unit) from EK_Group
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in EK_Hash
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in EK_Group) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
Btw, why were you using hashtables in your version, if you don't want it to be MUI?
 
Status
Not open for further replies.
Top