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

[Trigger] Fading Daze/Slow System

Status
Not open for further replies.
Level 8
Joined
Oct 2, 2013
Messages
288
I'm looking to make a system for units that are dazed/slowed with fading effect.
- So that they would become less dazed/slowed over time.


I had in mind that I would add units to a Unit Group and then a Periodic Timer event to handle those units.

What I've used so far is a Spell Book trick with Slow Aura in it, that only affects the carrying unit.
Then, the Periodic Timer event would reduce the Slow effect over time for each unit.

But this is more difficult than I thought, as I have to make a system that can handle units individually, in case some become more slowed than others.


I'm sure these kind of systems have been made before, so I would really like to know where I can get help :)

Thanks in advance.
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
Your idea was so complex to achieve the goal

In my opinion, such systems need some time to work on, but what I think is adding those units in one unit group ( Called - Units_Being_Dazed - for example )
hange You use their custom value as the dazing percentage, default value is their movement speed, 0 custom value means the unit is not moving, you just decrease their custom value , and then change the movement speed periodically according to their custom value.

You don't need to add any spell book, or buffs.


Try what I said and feedback , good luck
 
Level 8
Joined
Oct 2, 2013
Messages
288
Hmm, is it that complex? I can't possible be the first to get this idea.
What about knockback systems or force staff (dota) functions? Don't they work in similar ways?

How will I adjust attack and move speed without the book though?

I'm afraid I can't be using the function "Unit - Set Movement Speed" here.
I made a threat earlier this weak about how much that function bugs under certain circumstances.
http://www.hiveworkshop.com/forums/world-editor-help-zone-98/movement-speed-issues-256128/

This is how I tested it.

  • Trigger
    • Events
      • Time - Elapsed game time is 3.00 seconds
    • Conditions
    • Actions
      • Unit - Set Peasant 0000 <gen> movement speed to ((Current movement speed of Peasant 0000 <gen>) - 100.00)
      • Wait 10.00 seconds
      • Unit - Set Peasant 0000 <gen> movement speed to ((Current movement speed of Peasant 0000 <gen>) + 100.00)
In addition, I had a trigger informing me of the peasant's current ms every second.

-At first, the peasant has it's base ms of 190.
-After the trigger starts, it shows 90 ms.
-Then "Slow" is casted, reducing it's ms to 36.
-Then the trigger finished, and ms now shows 54 ms ("Slow" is still in effect).
-"Slow" runs out, and the peasant now has 136 ms by the end.

So it started with 190 and ended with 136 :/
It also bugs when using default ms.
 
Level 8
Joined
Oct 2, 2013
Messages
288
I took your advice and it seems to work out very nicely.
I'm using the spellbooks that are continuesly removed and added according to the custom value / value of slow.

I still haven't finished the whole trigger yet. I'll repost if I run into trouble. Thanks a lot for your help so far :)
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
Oh yeah, good luck. I am here to help you whenever.
Also, 'Unit - Set Movement Speed' does not bug, it's just some wrong settings you've put there. You have to save the movement speed at the beginning in a hashtable using the Unit's ID, and when Spell runs out, you return the saved value inside the hashtable.
An Example is best :
  • Hashtable - Save (Peasant's Movement Speed) as 0 in (String(PeasantID)) in (Your Hashtable)
Here when you eject the value from the hashtable
  • Unit - Set Peasant's Movement Speed to (Load 0 of (String(PeasantID)) in (Your Hashtable))
As far as I know, this is the best solution I'd think for now. I am not sure if (PeasantID) function does exist or not, but with it, you have the default speed of the peasant. Yet, it may bug if many peasants have different movement speeds, the solution is different then.
 
Last edited:
Level 8
Joined
Oct 2, 2013
Messages
288
Thanks for your help on the matter! :) I would like to post my trigger later some time, it just needs a few more fixes.

About the 'Unit - Set Movement Speed' subject, your suggestion might work.
I wonder, does this hashtable method return the unit's ms to default, no?

If I use spells that slows through triggers(your method), will it also work if multiple spells are cast on the same target?
If the value is returned to default while a different slowing spell is still active, it would interfere I believe.
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
Well , to think far.
Let's assume the unit has 250 MS.
Someone targets the unit by 'Slow', after one second The Unit's movement speed becomes 150 and (Slow) ability is still existing on the unit... Another one casts Slow on unit... The movement speed will be decreasing with double speed according to my method... After 3 seconds first Slow ability finishes, the movement speed here will return 250 and the second slow will be affecting. When it ends, the unit's movement speed will be 150...

You see here the interference between the two spells... And it will be all bugged...

The solution basically is to overwrite default first casting spell's unit's speed which is 250 with the second one which is 150, so when the first spell ends , the movement speed should be 150 , and when the second spell ends, it should return 250.
It's best to detect how many 'Slow's have been casted on the unit using integers... When Slow is casted, 'SlowInteger' increases by One like this :
'SlowInteger' = 'SlowInteger + 1
When a Slow ability ends, it decreases by one...

So by using this, the default speed's real variable has an array with this integer.
Let's give an example but it's not for Multiplayer, because to achieve a multiplayer one I will have to test in a blank map.
Spell Setup Trigger ( This is to save the very default speed of the unit in case no Slow spell is casted on unit ):
  • Set SlowInteger = 0
  • Hashtable - Save (TargetUnit's Current Movement Speed) as (SlowInteger) in (Target's ID) in 'Any Hashtable
First 'Slow' Casted on Unit :
  • Set SlowInteger = SlowInteger + 1
  • Hashtable - Save (TargetUnit's Current Movement Speed) as (SlowInteger) in (Target's ID) in 'Any Hashtable
  • Set BooleanToStartSlowing = true
Second 'Slow Casted on Unit :
  • Set SlowInteger = SlowInteger + 1
  • Hashtable - Save (TargetUnit's Current Movement Speed) as (SlowInteger) in (Target's ID) in 'Any Hashtable
  • Set BooleanToStartSlowing = true
First Slow ends
  • Set SlowInteger = SlowInteger - 1
  • Set EjectMS_FromHashtable = (Load SlowInteger of (TargetUnit's ID) from 'Hashtable)
  • Unit - Set TargetUnit's Movement Speed to (EjectMS_FromHashtable)
I believe this will do the job. I will do a blank map soon and check everything and I will try to achieve the goal. I am not just thinking by Logic and Maths, no tests :p

Tell me if there is any interference
 
Level 8
Joined
Oct 2, 2013
Messages
288
Here's the trigger!

I am very aware that there are likely more efficient ways of making this trigger.

First we have the trigger that adds units to the system. Here the '+50' custom value works like points of Daze Effect.

  • Initiator
    • Events
    • Conditions
    • Actions
      • Unit Group - Pick every unit in UG_Temp and do (Actions)
        • Loop - Actions
          • Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) + 50)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is in UG_DazeSystem) Equal to False
            • Then - Actions
              • Unit Group - Add (Picked unit) to UG_DazeSystem
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (UG_DazeSystem is empty) Equal to False
        • Then - Actions
          • Trigger - Turn on The Daze System <gen>
        • Else - Actions

Here comes the system. Further comments are below.
Also, this daze slows both attack speed and movement speed.
  • The Daze System
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in UG_DazeSystem and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is in UG_DazeCheck) Equal to False
            • Then - Actions
              • Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Orc\StasisTrap\StasisTotemTarget.mdl
              • Hashtable - Save Handle Of(Last created special effect) as 0 of (Key (Picked unit)) in Hashtable_Daze
              • Unit Group - Add (Picked unit) to UG_DazeCheck
            • Else - Actions
          • Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of (Picked unit)) Greater than or equal to 90
            • Then - Actions
              • Unit - Add Dazed 99% (Spellbook) to (Picked unit)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Custom value of (Picked unit)) Greater than or equal to 80
                • Then - Actions
                  • Unit - Remove Dazed 99% (Spellbook) from (Picked unit)
                  • Unit - Remove Dazed buff from (Picked unit)
                  • Unit - Add Dazed 90% (Spellbook) to (Picked unit)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Custom value of (Picked unit)) Greater than or equal to 70
                    • Then - Actions
                      • Unit - Remove Dazed 90% (Spellbook) from (Picked unit)
                      • Unit - Remove Dazed 2 buff from (Picked unit)
                      • Unit - Add Dazed 80% (Spellbook) to (Picked unit)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Custom value of (Picked unit)) Greater than or equal to 60
                        • Then - Actions
                          • Unit - Remove Dazed 80% (Spellbook) from (Picked unit)
                          • Unit - Remove Dazed buff from (Picked unit)
                          • Unit - Add Dazed 70% (Spellbook) to (Picked unit)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Custom value of (Picked unit)) Greater than or equal to 50
                            • Then - Actions
                              • Unit - Remove Dazed 70% (Spellbook) from (Picked unit)
                              • Unit - Remove Dazed 2 buff from (Picked unit)
                              • Unit - Add Dazed 60% (Spellbook) to (Picked unit)
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Custom value of (Picked unit)) Greater than or equal to 40
                                • Then - Actions
                                  • Unit - Remove Dazed 60% (Spellbook) from (Picked unit)
                                  • Unit - Remove Dazed buff from (Picked unit)
                                  • Unit - Add Dazed 50% (Spellbook) to (Picked unit)
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Custom value of (Picked unit)) Greater than or equal to 30
                                    • Then - Actions
                                      • Unit - Remove Dazed 50% (Spellbook) from (Picked unit)
                                      • Unit - Remove Dazed 2 buff from (Picked unit)
                                      • Unit - Add Dazed 40% (Spellbook) to (Picked unit)
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (Custom value of (Picked unit)) Greater than or equal to 20
                                        • Then - Actions
                                          • Unit - Remove Dazed 40% (Spellbook) from (Picked unit)
                                          • Unit - Remove Dazed buff from (Picked unit)
                                          • Unit - Add Dazed 30% (Spellbook) to (Picked unit)
                                        • Else - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • (Custom value of (Picked unit)) Greater than or equal to 10
                                            • Then - Actions
                                              • Unit - Remove Dazed 30% (Spellbook) from (Picked unit)
                                              • Unit - Remove Dazed 2 buff from (Picked unit)
                                              • Unit - Add Dazed 20% (Spellbook) to (Picked unit)
                                            • Else - Actions
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • (Custom value of (Picked unit)) Greater than or equal to 0
                                                • Then - Actions
                                                  • Unit - Remove Dazed 20% (Spellbook) from (Picked unit)
                                                  • Unit - Remove Dazed buff from (Picked unit)
                                                  • Unit - Add Dazed 10% (Spellbook) to (Picked unit)
                                                • Else - Actions
                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    • If - Conditions
                                                      • (Custom value of (Picked unit)) Less than or equal to 0
                                                    • Then - Actions
                                                      • Unit - Remove Dazed 10% (Spellbook) from (Picked unit)
                                                      • Unit - Remove Dazed 2 buff from (Picked unit)
                                                      • Unit Group - Remove (Picked unit) from UG_DazeSystem
                                                      • Special Effect - Destroy (Load 0 of (Key (Picked unit)) in Hashtable_Daze)
                                                      • Unit Group - Remove (Picked unit) from UG_DazeCheck
                                                    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (UG_DazeSystem is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
I wanna point out a few things.
- All spellbooks are pre-disabled in the map initialization.
- The reason it changes from Dazed 1 to Dazed 2 is because every second Spellbook uses a different buff to avoid interferences in the trigger.
- Since multiple spellbooks of same kind dont stack, I figured it would be fine to do it like this. I hope it doesn't cause any major leaks?
- I would later to add features such as 'Daze Reduction' or 'Increasement' that would affect how fast/slow the Daze Effect wears off. Eventually by adding a variable to the '-1 Custom Value' function. But I need that to be defined for each specific unit. I would like to know some methods on that.
 
Last edited:
Level 8
Joined
Oct 2, 2013
Messages
288
Well , to think far.
Let's assume the unit has 250 MS.
Someone targets the unit by 'Slow', after one second The Unit's movement speed becomes 150 and (Slow) ability is still existing on the unit... Another one casts Slow on unit... The movement speed will be decreasing with double speed according to my method... After 3 seconds first Slow ability finishes, the movement speed here will return 250 and the second slow will be affecting. When it ends, the unit's movement speed will be 150...

You see here the interference between the two spells... And it will be all bugged...

The solution basically is to overwrite default first casting spell's unit's speed which is 250 with the second one which is 150, so when the first spell ends , the movement speed should be 150 , and when the second spell ends, it should return 250.
It's best to detect how many 'Slow's have been casted on the unit using integers... When Slow is casted, 'SlowInteger' increases by One like this :
'SlowInteger' = 'SlowInteger + 1
When a Slow ability ends, it decreases by one...

So by using this, the default speed's real variable has an array with this integer.
Let's give an example but it's not for Multiplayer, because to achieve a multiplayer one I will have to test in a blank map.
Spell Setup Trigger ( This is to save the very default speed of the unit in case no Slow spell is casted on unit ):
  • Set SlowInteger = 0
  • Hashtable - Save (TargetUnit's Current Movement Speed) as (SlowInteger) in (Target's ID) in 'Any Hashtable
First 'Slow' Casted on Unit :
  • Set SlowInteger = SlowInteger + 1
  • Hashtable - Save (TargetUnit's Current Movement Speed) as (SlowInteger) in (Target's ID) in 'Any Hashtable
  • Set BooleanToStartSlowing = true
Second 'Slow Casted on Unit :
  • Set SlowInteger = SlowInteger + 1
  • Hashtable - Save (TargetUnit's Current Movement Speed) as (SlowInteger) in (Target's ID) in 'Any Hashtable
  • Set BooleanToStartSlowing = true
First Slow ends
  • Set SlowInteger = SlowInteger - 1
  • Set EjectMS_FromHashtable = (Load SlowInteger of (TargetUnit's ID) from 'Hashtable)
  • Unit - Set TargetUnit's Movement Speed to (EjectMS_FromHashtable)
I believe this will do the job. I will do a blank map soon and check everything and I will try to achieve the goal. I am not just thinking by Logic and Maths, no tests :p

Tell me if there is any interference

It looks very promising. Nice job!
I will try and test it when I have established it. I'll get back to you on that :)
 
Last edited:
Status
Not open for further replies.
Top