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

Stun System Bug [GUI/MUI]

Status
Not open for further replies.
Level 10
Joined
Feb 20, 2008
Messages
448
IM tryng to make a Stun system, but somehow it didnt work, i used the Hanke dynamic system!!

atm i need a stun system that i can make it non stackable with an option true/false!!

i have tryed a vjass stun fround here wich didnt worked at all!!

thats what i tryed, somehow the Loop only turn 1 time O_O

edit : it is mui ?

  • stun
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fireblast
    • Actions
      • -------- Set stun duration to whatever it is, here I use 5.00 --------
      • Set stun_duration = 5.00
      • -------- Saves the duration by matching it with the target unit's ID --------
      • Hashtable - Save stun_duration as (Key duration) of (Key (Target unit of ability being cast)) in H_Fireblast
      • -------- Adds the target to a global unit group of all units stunned by the spell --------
      • Unit Group - Add (Target unit of ability being cast) to temp_group
      • -------- Starts the countdown trigger if it is not already running --------
      • If ((stun2 <gen> is on) Equal to False) then do (Trigger - Turn on stun2 <gen>) else do (Do nothing)
  • stun2
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in temp_group) Greater than 0
        • Then - Actions
          • -------- If there are more than 0 units that are stunned, the trigger runs fo each unit --------
          • Unit Group - Pick every unit in temp_group and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load (Key duration) of (Key (Picked unit)) from H_Fireblast) Greater than 0.00
                • Then - Actions
                  • -------- If the duration remaining is more than 0.00, then it takes 0.25 off the duration since this checks every 0.25 seconds --------
                  • Hashtable - Save ((Load (Key duration) of (Key (Picked unit)) from H_Fireblast) - 0.25) as (Key duration) of (Key (Picked unit)) in H_Fireblast
                • Else - Actions
                  • -------- If the duration remaining is 0.00 or less, then it takes the stun buff off the unit --------
                  • Unit - Remove Stunned buff from (Picked unit)
                  • -------- And takes the unit out of the global group of stunned units --------
                  • Unit Group - Remove (Picked unit) from temp_group
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in H_Fireblast
        • Else - Actions
          • -------- If there are 0 units stunned, the trigger stops (why run a trigger 4 times a second if it doesn't do anything?) --------
          • Trigger - Turn off (This trigger)
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,232
You cast storm bolt on the unit with a 0 second duration.
You then fire a timer that after X ammount of time it will remove the stun buff from the unit.
You attach the timer to the unit via hashtables.
When another stun is run, you can recall the timer and alter its expiration time.

I honestly do not see any stun related coding in your trigger so ofcoruse it does not work.
 
Level 10
Joined
Feb 20, 2008
Messages
448
You cast storm bolt on the unit with a 0 second duration.
You then fire a timer that after X ammount of time it will remove the stun buff from the unit.
You attach the timer to the unit via hashtables.
When another stun is run, you can recall the timer and alter its expiration time.

I honestly do not see any stun related coding in your trigger so of course it does not work.

the buff doesnt supposed to be removed? cant u show me an exemple becuz my english very failed & im visual

i wonder do u mean like adding
  • Unit - Add a 0.03 second Generic expiration timer to (Triggering unit)
with a timer ?
 
Last edited:
Level 8
Joined
Apr 30, 2009
Messages
338
Someone should check this because I'm pretty new to Hashtables but I think this is going to work for what you want, it is 2 triggers:

  • stun
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fireblast
    • Actions
      • -------- Set stun duration to whatever it is, here I use 5.00 --------
      • Set stun_duration = 5.00
      • -------- Saves the duration by matching it with the target unit's ID --------
      • Hashtable - Save stun_duration as (Key duration) of (Key (Target unit of ability being cast)) in H_Fireblast
      • -------- Adds the target to a global unit group of all units stunned by the spell --------
      • Unit Group - Add (Target unit of ability being cast) to temp_group
      • -------- Starts the countdown trigger if it is not already running --------
      • If ((stun2 <gen> is on) Equal to False) then do (Trigger - Turn on stun2 <gen>) else do (Do nothing)
  • stun2
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in temp_group) Greater than 0
        • Then - Actions
          • -------- If there are more than 0 units that are stunned, the trigger runs fo each unit --------
          • Unit Group - Pick every unit in temp_group and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load (Key duration) of (Key (Picked unit)) from H_Fireblast) Greater than 0.00
                • Then - Actions
                  • -------- If the duration remaining is more than 0.00, then it takes 0.25 off the duration since this checks every 0.25 seconds --------
                  • Hashtable - Save ((Load (Key duration) of (Key (Picked unit)) from H_Fireblast) - 0.25) as (Key duration) of (Key (Picked unit)) in H_Fireblast
                • Else - Actions
                  • -------- If the duration remaining is 0.00 or less, then it takes the stun buff off the unit --------
                  • Unit - Remove Stunned buff from (Picked unit)
                  • -------- And takes the unit out of the global group of stunned units --------
                  • Unit Group - Remove (Picked unit) from temp_group
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in H_Fireblast
        • Else - Actions
          • -------- If there are 0 units stunned, the trigger stops (why run a trigger 4 times a second if it doesn't do anything?) --------
          • Trigger - Turn off (This trigger)
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
i wonder do u mean like adding
  • Unit - Add a 0.03 second Generic expiration timer to (Triggering unit)
with a timer ?

^I think he meant that you save a real in a hashtable, and use that as a timer. In the periodic loop, you then subtract from the saved real and check when it becomes zero.

When the spell is cast again, the stun timer gets reset again. You can make all spells in your map share the same stun timer value, so they don't clash with each other, making stuns end before they're supposed to.

Someone should check this...

That's the way to do it.

EDIT: Shit. I missed my 666th post :(
 
Level 10
Joined
Feb 20, 2008
Messages
448
Someone should check this because I'm pretty new to Hashtables but I think this is going to work for what you want, it is 2 triggers:

  • stun
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fireblast
    • Actions
      • -------- Set stun duration to whatever it is, here I use 5.00 --------
      • Set stun_duration = 5.00
      • -------- Saves the duration by matching it with the target unit's ID --------
      • Hashtable - Save stun_duration as (Key duration) of (Key (Target unit of ability being cast)) in H_Fireblast
      • -------- Adds the target to a global unit group of all units stunned by the spell --------
      • Unit Group - Add (Target unit of ability being cast) to temp_group
      • -------- Starts the countdown trigger if it is not already running --------
      • If ((stun2 <gen> is on) Equal to False) then do (Trigger - Turn on stun2 <gen>) else do (Do nothing)
  • stun2
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in temp_group) Greater than 0
        • Then - Actions
          • -------- If there are more than 0 units that are stunned, the trigger runs fo each unit --------
          • Unit Group - Pick every unit in temp_group and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load (Key duration) of (Key (Picked unit)) from H_Fireblast) Greater than 0.00
                • Then - Actions
                  • -------- If the duration remaining is more than 0.00, then it takes 0.25 off the duration since this checks every 0.25 seconds --------
                  • Hashtable - Save ((Load (Key duration) of (Key (Picked unit)) from H_Fireblast) - 0.25) as (Key duration) of (Key (Picked unit)) in H_Fireblast
                • Else - Actions
                  • -------- If the duration remaining is 0.00 or less, then it takes the stun buff off the unit --------
                  • Unit - Remove Stunned buff from (Picked unit)
                  • -------- And takes the unit out of the global group of stunned units --------
                  • Unit Group - Remove (Picked unit) from temp_group
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in H_Fireblast
        • Else - Actions
          • -------- If there are 0 units stunned, the trigger stops (why run a trigger 4 times a second if it doesn't do anything?) --------
          • Trigger - Turn off (This trigger)

how does this trigger save stun effect o_O or do stun unit

p.s can u send me the code in a map would spare me some time
 
Level 10
Joined
Feb 20, 2008
Messages
448
you cast a stun spell with 0.00 duration (it will make it infinite) then you use that trigger to remove the buff after the duration you want is finished.

NOW I UNDERSTAND omg Thanks, evry1 told me what it do but no1 told me how, i cannot understand something if i dont know how it work >.> thats how my maths logic works NOW I GET IT than ill be able to make it on my own :p

i will say feedback if i succed

EDIT i was busy alot im testing the hashtable spell now, its work :D now i will be able to make it better ^^

i wonder it is MUI ?

  • stun
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fireblast
    • Actions
      • -------- Set stun duration to whatever it is, here I use 5.00 --------
      • Set stun_duration = 5.00
      • -------- Saves the duration by matching it with the target unit's ID --------
      • Hashtable - Save stun_duration as (Key duration) of (Key (Target unit of ability being cast)) in H_Fireblast
      • -------- Adds the target to a global unit group of all units stunned by the spell --------
      • Unit Group - Add (Target unit of ability being cast) to temp_group
      • -------- Starts the countdown trigger if it is not already running --------
      • If ((stun2 <gen> is on) Equal to False) then do (Trigger - Turn on stun2 <gen>) else do (Do nothing)
  • stun2
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in temp_group) Greater than 0
        • Then - Actions
          • -------- If there are more than 0 units that are stunned, the trigger runs fo each unit --------
          • Unit Group - Pick every unit in temp_group and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load (Key duration) of (Key (Picked unit)) from H_Fireblast) Greater than 0.00
                • Then - Actions
                  • -------- If the duration remaining is more than 0.00, then it takes 0.25 off the duration since this checks every 0.25 seconds --------
                  • Hashtable - Save ((Load (Key duration) of (Key (Picked unit)) from H_Fireblast) - 0.25) as (Key duration) of (Key (Picked unit)) in H_Fireblast
                • Else - Actions
                  • -------- If the duration remaining is 0.00 or less, then it takes the stun buff off the unit --------
                  • Unit - Remove Stunned buff from (Picked unit)
                  • -------- And takes the unit out of the global group of stunned units --------
                  • Unit Group - Remove (Picked unit) from temp_group
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in H_Fireblast
        • Else - Actions
          • -------- If there are 0 units stunned, the trigger stops (why run a trigger 4 times a second if it doesn't do anything?) --------
          • Trigger - Turn off (This trigger)
 
Last edited:
Level 7
Joined
Nov 4, 2006
Messages
153
Just a note: If you do it that way, make sure the triggered stun duration is long enough for the target to get hit by the stun missile. Such as, if you set stun duration as 1 second, but the missile hits the units after 2 seconds, the unit will get removed from the stun group when he was not stunned yet, permanently stunning the unit.
 
Level 10
Joined
Feb 20, 2008
Messages
448
Just a note: If you do it that way, make sure the triggered stun duration is long enough for the target to get hit by the stun missile. Such as, if you set stun duration as 1 second, but the missile hits the units after 2 seconds, the unit will get removed from the stun group when he was not stunned yet, permanently stunning the unit.

yah i know it was a variable missclick lol but im wondering if it is mui ? i dont really know hashtable
 
Level 8
Joined
Apr 30, 2009
Messages
338
one problem is that the most recent stun will be prioritized so if a unit is hit by a 5sec stun then a 1 sec stun will take precedence (unless each stun has a different buff).

Here is a spell with a projectile, a variable stun time, and automatically uses the longest stun if there are two stuns applied.

11aide8.jpg


  • FireballA
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fireball
    • Actions
      • -------- 0 of Key = Caster --------
      • -------- 1 of Key = Damage --------
      • -------- 2 of Key = Target --------
      • -------- 3 of Key = Speed --------
      • -------- 4 of Key = Stun Duration --------
      • Set temp_point0 = (Position of (Triggering unit))
      • Set temp_point1 = (Position of (Target unit of ability being cast))
      • Set temp_point2 = (temp_point0 offset by 50.00 towards ((Angle from temp_point0 to temp_point1) - 35.00) degrees)
      • Custom script: call RemoveLocation( udg_temp_point0 )
      • Unit - Create 1 projectile for (Owner of (Triggering unit)) at temp_point2 facing temp_point1
      • Custom script: call RemoveLocation( udg_temp_point1 )
      • Custom script: call RemoveLocation( udg_temp_point2 )
      • Hashtable - Save Handle Of(Triggering unit) as 0 of (Key (Last created unit)) in H_Fireball
      • Hashtable - Save ((20.00 + (60.00 x (Real((Level of (Ability being cast) for (Triggering unit)))))) + ((0.45 + (0.45 x (Real((Level of (Ability being cast) for (Triggering unit)))))) x (Load 100 of (Key (Triggering unit)) from H_Spellpower))) as 1 of (Key (Last created unit)) in H_Fireball
      • Hashtable - Save Handle Of(Target unit of ability being cast) as 2 of (Key (Last created unit)) in H_Fireball
      • Hashtable - Save 20.00 as 3 of (Key (Last created unit)) in H_Fireball
      • Hashtable - Save (1.00 + (0.01 x (Real((Intelligence of (Triggering unit) (Include bonuses)))))) as 4 of (Key (Last created unit)) in H_Fireball
      • Unit Group - Add (Last created unit) to FireballGroup
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (FireballB <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on FireballB <gen>
        • Else - Actions
  • FireballB
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in FireballGroup) Greater than 0
        • Then - Actions
          • Unit Group - Pick every unit in FireballGroup and do (Actions)
            • Loop - Actions
              • -------- 0 of Key = Caster --------
              • -------- 1 of Key = Damage --------
              • -------- 2 of Key = Target --------
              • -------- 3 of Key = Speed --------
              • -------- 4 of Key = Stun Duration --------
              • Set temp_point0 = (Position of (Picked unit))
              • Set temp_point1 = (Position of (Load 2 of (Key (Picked unit)) in H_Fireball))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between temp_point0 and temp_point1) Less than or equal to 20.00
                • Then - Actions
                  • Unit - Cause (Load 0 of (Key (Picked unit)) in H_Fireball) to damage (Load 2 of (Key (Picked unit)) in H_Fireball), dealing (Load 1 of (Key (Picked unit)) from H_Fireball) damage of attack type Spells and damage type Fire
                  • Special Effect - Create a special effect attached to the origin of (Load 2 of (Key (Picked unit)) in H_Fireball) using Abilities\Spells\Other\Incinerate\FireLordDeathExplode.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Create 1 dummy for (Owner of (Picked unit)) at temp_point0 facing Default building facing degrees
                  • Unit - Order (Last created unit) to Neutral - Firebolt (Load 2 of (Key (Picked unit)) in H_Fireball)
                  • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Load 4 of (Key (Picked unit)) from H_Fireball) Greater than (Load (Key duration) of (Key (Load 2 of (Key (Picked unit)) in H_Fireball)) from H_Stun)
                    • Then - Actions
                      • Hashtable - Save (Load 4 of (Key (Picked unit)) from H_Fireball) as (Key duration) of (Key (Load 2 of (Key (Picked unit)) in H_Fireball)) in H_Stun
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Load 2 of (Key (Picked unit)) in H_Fireball) is in Stunned) Equal to False
                        • Then - Actions
                          • Unit Group - Add (Load 2 of (Key (Picked unit)) in H_Fireball) to Stunned
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Stun <gen> is on) Equal to False
                            • Then - Actions
                              • Trigger - Turn on Stun <gen>
                            • Else - Actions
                        • Else - Actions
                    • Else - Actions
                  • Unit Group - Remove (Picked unit) from FireballGroup
                  • Unit - Kill (Picked unit)
                  • Floating Text - Create floating text that reads (- + ((String((Integer((Load 1 of (Key (Picked unit)) from H_Fireball))))) + -)) at temp_point1 with Z offset 96.00, using font size 14.00, color (100.00%, 92.50%, 12.50%), and 0.00% transparency
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
                  • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
                  • Floating Text - Set the velocity of (Last created floating text) to (Random real number between 96.00 and 256.00) towards (Random real number between 97.50 and 135.00) degrees
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in H_Fireball
                • Else - Actions
                  • Set temp_point2 = (Position of (Picked unit))
                  • Set temp_point3 = (temp_point2 offset by (Load 3 of (Key (Picked unit)) from H_Fireball) towards (Angle from temp_point0 to temp_point1) degrees)
                  • Hashtable - Save ((Load 3 of (Key (Picked unit)) from H_Fireball) + 0.20) as 3 of (Key (Picked unit)) in H_Fireball
                  • Unit - Move (Picked unit) instantly to temp_point3, facing temp_point1
                  • Custom script: call RemoveLocation( udg_temp_point2 )
                  • Custom script: call RemoveLocation( udg_temp_point3 )
              • Custom script: call RemoveLocation( udg_temp_point0 )
              • Custom script: call RemoveLocation( udg_temp_point1 )
        • Else - Actions
          • Trigger - Turn off (This trigger)
  • Stun
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in Stunned) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Unit Group - Pick every unit in Stunned and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load (Key duration) of (Key (Picked unit)) from H_Stun) Less than or equal to 0.00
                • Then - Actions
                  • Unit - Remove Stunned buff from (Picked unit)
                  • Unit Group - Remove (Picked unit) from Stunned
                • Else - Actions
                  • Hashtable - Save ((Load (Key duration) of (Key (Picked unit)) from H_Stun) - 0.10) as (Key duration) of (Key (Picked unit)) in H_Stun
 
Status
Not open for further replies.
Top